SlackBot notifications integration guide & sample workflow

Questions and answers on how to get the most out of FFAStrans
Post Reply
ArsenioV
Posts: 23
Joined: Thu May 14, 2020 2:13 pm

SlackBot notifications integration guide & sample workflow

Post by ArsenioV »

Slack notifications integration (SlackBot)

I have created, with the help of the precious @emcodem – thanks mate! – a SlackBot that allows to receive notifications from FFAStrans workflows.

Here is a sample workflow you can use right away or modify to your liking:
SlackBot_notifications.json
(8.48 KiB) Downloaded 197 times

If you only need the Slack integration, just copy the two “SlackBot Notif” nodes and apply them to your existing workflows.

The “Fail” node needs to be connected to all nodes on “execute on error” – there is no global fail code in FFAStrans as of now so this is the only way to receive any fail notification that comes from any of the nodes.
The “Success” node needs to be connected, of course, after the Delivery node or any other node that you have at the end of your workflows. It will get the success state from the previous node and send a POST msg to your Slack app.

Visual of the sample workflow & notifications in Slack:
Visual_notif.jpg
Visual_notif.jpg (58.28 KiB) Viewed 2252 times


Steps for creating your own Slack App (SlackBot):
1. Have a Slack room and a channel set up for receiving notifications – it can be any of your existing channels or you can create one dedicated only to this like I did.
2. Go to https://api.slack.com/apps and create a new app.
3. On the left categories column, go to Incoming Webhooks and activate the function.
4. Create a new Webhook URL and copy the given URL.
5. Paste the URL to your SlackBot nodes in FFAStrans.
6. Set the action of the Slack nodes to “POST” and edit the POST msg to your liking if necessary.
7. Enjoy Slack notifications from FFAStrans!

SlackBot_FFAStrans.gif
SlackBot_FFAStrans.gif (453.66 KiB) Viewed 2252 times



Note on the editable message to Slack:
The message that is posted to Slack must be written in JSON, and you can use the Slack message formatting notation to format your messages. Please refer to https://slack.com/intl/en-it/help/artic ... r-messages and https://api.slack.com/reference/surfaces/formatting
emcodem
Posts: 1631
Joined: Wed Sep 19, 2018 8:11 am

Re: SlackBot notifications integration guide & sample workflow

Post by emcodem »

Works like a charm! Thanks a lot for the tutorial Giacomo :D

For potential future readers:
Just don't forget to use a populate vars node and the $jsondecode function to make all stuff that can contain " or \ Json safe.
https://ffastrans.com/frm/forum/viewtop ... 1229#p6544

It's a shame that we cannot talk back from slack to ffastrans unless our ffastrans or at least some gateway/proxy is in the internet. Would be nice if users could e.g. start another workflow or such when they get a fail notification :D
emcodem, wrapping since 2009 you got the rhyme?
ArsenioV
Posts: 23
Joined: Thu May 14, 2020 2:13 pm

Re: SlackBot notifications integration guide & sample workflow

Post by ArsenioV »

Yeah it would be awesome - I was thinking of this today. I'll investigate on the possibilities there ;)

Thanks again for your help setting this up mate!
Post Reply