Send stuck stories to Slack
Warning: sample URLs!
Please make sure to replace
https://hooks.slack.com/services/xxxxx/yyyyyy/zzzzzzzzztGRAKwHLfm4kw
with your Slack Webhook URL andhttps://youraccount.tpondemand.com/
with your Targetprocess URL
Filter by project.id is optional.
[
{
"type": "source:schedule",
"schedule": {
"kind": "interval",
"unit": "hour",
"value": 24
}
},
{
"type": "action:JavaScript",
"script": "const api = context.getService(\"targetprocess/api/v2\");\nconst stories = await api.queryAsync(\"UserStories\", {\n select: \"{id, name}\",\n where: `project.id=3398 and LastStateChangeDate <= Today.AddDays(-14) and endDate == null`\n});\n\nconst links = stories.map(story => {\n return `<${args.accountBaseUrl}${story.id}|${story.name}>`;\n});\n\n//IMPORTANT: Update Slack link below\nreturn {\n command: \"SendHttpRequest\",\n payload: {\n url: \"https://hooks.slack.com/services/xxxxx/yyyyyy/zzzzzzzzztGRAKwHLfm4kw\",\n body: {\n text: `Stuck stories:\\n ${links.join('\\n')}`,\n username: \"TP\",\n icon_emoji: \":bangbang:\"\n }\n }\n};"
}
]
Updated over 4 years ago