Slack
This tutorial will help you add a Slack automation to your Budibase app.
The Slack notification is a webhook that allows you to send notifications from your Budibase app to a Slack channel.
Settings
The Slack Action has two settings:
Setting | Description |
---|---|
Incoming Webhook URL | Further information and directions on how to find your Slack channel's webhook URL: https://slack.com/intl/en-gb/help/articles/115005265063-Incoming-webhooks-for-Slack https://api.slack.com/messaging/webhooks |
Message | The content you would like to send to your Slack channel when your automation is triggered. |
Tutorial
The following tutorial will demonstrate how to send a Slack notification when a new record is created. We will assume you have your data setup and design screens created. If you don't, check out the Quickstart: Budibase DB.
Our Slack notification automation will consist of two automation blocks:
- Trigger - Row created
- Action - Slack notification
Click the add automation button.
Add Trigger - Row created
Name your automation. We will name ours Slack notification
. Select the Row Created
trigger. Then click Save
.
Now click the SETUP dropdown on your new automation block, and select your table.
Add Action - Slack
Now click the small plus icon button under the Trigger automation block, select Slack, then click Save.
Now it's time to set up our Slack action. If you don't have a Slack channel, please set one up. To get your Incoming Webhook URL, create a Slack App.
When creating a Slack app, choose 'From Scratch'.
Name your Slack app, and choose your Workspace.
Then select Incoming Webhooks.
Activate incoming webhooks by switching on the toggle.
Select the Add New Webhook to Workspace button.
Now select the channel you would like to post to.
Slack will generate you a webhook. Click the Copy button to copy your webhook.
Paste your Slack Webhook URL into the Incoming Webhook Url input within your Action automation block.
In the Message input, add the message you would like Budibase to post to your Slack channel when a new row is created. You can bind values from the newly created record to your message. For our use case, I want to send the following notification to our channel:
Woohoo, we just made a new sale in {{ trigger.row.Country }}
Check out the sale using the link below:
https://joe.budibase.app/app/tutorials#/sales/{{ trigger.id }}
From the above, you can see I have used automation Bindings to pull data into our message.
Trigger output bindings - Trigger.Row
To pull data from your Trigger record, you can use Trigger Output helpers (see Gif above). Using the helper trigger.row
I now have access to that data from our newly created record. I add the field/column title to the binding to pull a specific field back: trigger.row.Country
.
To allow users to access the specific record page, we must add a link to our message.
To create a link, we must first Publish our application. Save the automation, click the Publish app button. Now, go back to the app portal page (Click the Budibase icon). Locate your app, click the more icon, and click View published app. Copy your base URL - We will improve this experience soon.
Trigger output bindings - Trigger.ID
Now, click into your app and go back to the automation we were just creating and into the message section (where we were above). Paste your URL, and append it with the Trigger ID output. Click Save.
Test automation
Click Finish and test automation
. Then select your table from the dropdown.
In the Column/Field you referenced in your trigger.row binding, add a value - we'll add Budiland
to the Country field. Click test. You should now see a message in your Slack channel.
If you are happy, click Publish app. Add a new record within your app, and like magic, watch as a new Slack notification appears within your channel.
Updated 12 months ago