On the next page select Slash Commands, and then Create New Command.
Enter the following values:
(Enter a dummy URL for now)
List your todos
An API Gateway URL will be entered in the Request URL field later on, but for now a dummy URL can be set. Once the Slash Command has been created, navigate to Settings and then Basic Information and take note of the Signing Secret found in App Credentials.
Generate an API Token for the App and set the View records permissions for it. For more information on API Tokens, refer to the
API Tokens article.
Make note of the API token as it will be used later.
Click Save and then Update App to save the changes made to the App.
Prepare the Lambda Function and API Gateway on AWS
Set up the Lambda function
Log into an AWS account, open the AWS Web Console and navigate to Lambda.
Select Author from scratch and set the Function name and Runtime settings as follows. Click Create function.
Prepare the following code for the Lambda function code. Replace the following variables with the information of the Kintone and Slack environments set up earlier.
The Kintone domain name
The App ID of the To do app
The Slack Signing Secret
The Kintone API token
In order to protect the token and the API token, encrypt these tokens using AWS Key Management System when in a production environment. Refer to the
documentation of KMS for more information.
On the settings page, set the configurations as follows. Click Add once the settings are complete.
The API endpoint is displayed under the name of the Lambda function. Copy the URL to add to the Slack settings.
Test the Slash Command on Slack
On the Slack API Applications settings page, set the endpoint URL of the API Gateway that was created. Navigate to the Basic Information settings page. Under Building Apps for Slack, click Install App to Workspace.
On the next page, allow the App to access the workspace.
Navigate to the created channel within Slack. Typing in the Slash command /mytodo should run the Lambda function and the incomplete To Dos in Kintone for the current user should be displayed in the channel.
Note: Records are retrieved by matching the Slack login name with the Kintone login name, so only Kintone records assigned to the current logged in Slack user are displayed.