Share Process Management Statuses with Slack
Overview
This article introduces how to post a message into a Slack channel from a Kintone App. When a workflow status of a record is proceeded to "Completed", a script sends a request to Slack's Incoming Webhook. A message including information about the record is then posted into a Slack channel.
Scenario
Although Slack has many bots in the marketplace, marketplace bots tend to only function for a particular scenario, which may not always fit in with the user's needs.
Different database instances within Kintone can cover many scenarios depending on the user's needs. CRMs, Project Management, Interview Notes, Task Lists, Expense Reports, PTO Request Forms are some examples. Kintone Apps tend to result in higher productivity if their Process Management settings have been enabled, which define a streamlined workflow for every record within the database.
Setting up the Connection
Prepare Slack
Create a Slack channel
Create a Slack channel that will receive notifications from Kintone.
Set up an Incoming Webhook
In Slack, open the Incoming Webhook Integration page. Check the Slack API documentation for more details.
Choose a channel to which messages will be sent to. Click the Add Incoming WebHooks Integration button to set up an incoming webhook.
Take note of the URL displayed in the Webhook URL settings, as it will be used in the next step. Fill out the rest of the form.
Prepare the App
Create the form
Create an App with the following fields.
Field Type | Field Name | Field Code |
---|---|---|
Text | Task | taskname |
Date | Due Date | duedate |
Text area | Details | details |
Set the Process Management settings
In the settings of the App, navigate to App Settings, then to Process Management. Check the "Enable process management" checkbox. Set the following Status for the Status Settings.
Set the following settings for the Process Flow Settings
Save the settings, and click on Update App to apply the changes to the Kintone App.
Sample code
Prepare the following JavaScript code in a text editor and navigate to the Kintone App's settings. Replace {subdomain}
and {IncomingWebhookURL}
with the necessary values. Upload the file into the Upload JavaScript for PC option of the
JavaScript and CSS Customization settings
.
|
|
After saving the settings and clicking on Update App, add a new record into the App. Proceed the Status of the record to "In progress", then to "Completed".
An event should be triggered, resulting in data being sent to Slack's webhook. Check the Slack Channel to see if a message has been posted.