Setting up the connection
It's true that kintone does have it's own notification feature, but there are several advantages for utilizing the notification features on Slack:
- Team members not using kintone can receive the same notifications
- Users can choose to turn on/off the notification for each channel
- Desktop/Mobile apps are available for receiving push notifications
These features are useful when you wish to send notifications to a wide group of recipients but leave each recipient to decide the importance of the notification, such as in case of a system failures.
In this article, we will post messages from kintone to Slack with the below scenario:
- Users use a shared to-do App inside kintone, where they use the process management feature to keep track of the status of each task
- Tasks in kintone that are set to "Completed" are notified to a Slack channel
Get Slack ready
Create a channel that will receive notifications from kintone.
Set up an Incoming Webhook
Open the Incoming Webhook Integration page.
Choose the channel to which you want to send messages to and click the [Add Incoming WebHooks Integration] button. An Incoming Webhook will be set up.
Copy the URL of the Incoming Webhook, as we will use this later on. Customize the bot name and icon to fit your needs. Save your settings, and Slack will now be ready.
Next, we will set up the settings for kintone.
Here, we use the app.record.detail.process.proceed event so that the event is triggered when a user proceeds a process management status. In this example, the kintone.proxy API will send a POST request to the Incoming Webhook URL of Slack when the status is changed to "Completed".
Make sure that your App also has the Process Management feature turned on that includes a "Completed" status.
Once you are ready, save your settings, and update your App.
Test the connection
To test to see if the connection is working, add a new record to your App. Proceed the process management status until it reaches "Completed". Check your Slack Channel to see if your message has reached your Slack channel.
If nothing is being posted into your Slack channel, try reading through the Debugging Tips for kintone JS article to check for bugs.
In this example, we used the app.record.detail.process.proceed event to send messages to Slack, to utilize kintone's strong process management features. You can replace this event with other events, such as the app.record.create.submit.success event to post messages when new records are added and the app.record.edit.submit.success event to post messages when records are edited, etc.
For more details on Slack's Incoming Webhook feature, refer to the following document: