Sending Inquiry Notifications to Chatwork
Overview
Kuroco allows you to create custom APIs and has plugins to send requests to external APIs, making it possible to use services that are not displayed in external system integration by describing custom processing and batch processing.
This tutorial explains how to create a custom process to post to Chatwork and send inquiry notifications to Chatwork.
What you'll learn
You will learn how to post inquiry notifications to Chatwork using the following steps:
Chatwork settings
Create a bot account
The account that will post using the Chatwork API will be the account that created the API token.
So first, create a bot account on Chatwork to be the sender of the notifications.
Once you have created the account, set the profile picture and name.
Create a group to receive notifications
Next, create a group chat to receive the notifications.
Once you are ready, note down the room ID from the group chat settings.
Get the API token
Access Chatwork APIへようこそ! and click [Apply for API Usage] at the bottom of the page.
Log in with the bot account, and you will be redirected to the API Token page where you can confirm the API token.
Kuroco settings
Save the API token
Access the Kuroco management screen and In the left sidebar menu, under "SETTINGS", click [Environment] -> [Secrets].
Click on [Add].
Enter the following information and click on [Add].
Field | Value |
---|---|
Name | CHATWORK_API_TOKEN |
Value | The API token obtained from Chatwork |
Create a custom process to post to Chatwork
Create a custom process to post to Chatwork using custom processing.
Click [Operations] -> [Custom Processing].
Click [Add].
Configure as follows:
- Custom processing assumes that it will be called from other custom processing or batch processing using the
{function}
Smarty plugin. - It receives the
room_id
and the text to be sent as variablesroom_id
andtext
. - It returns the result of the processing with
{return value=$status}
.
Item | Value |
---|---|
Title | chatwork_post_message |
Identifier | chatwork_post_message |
Processing | The following content |
loading...
Once you have entered the information, click [Add] to add the custom processing.
Edit message template
Click [Operation] > [Message template].
Search for "inquiry/inquiry_contact" and click the displayed title [inquiry/inquiry_contact].
Add the following at the beginning of the "Body".
{*Chatwork Notification*}
{capture name=chatwork_text_body}
[toall]
An inquiry has been received for "{$inquiryHeader.inquiry_name}".
Please review the details.
{$smarty.const.ROOT_MNG_URL}/management/inquiry/inquiry_reply_edit/?inquiry_bn_id={$inquiry_bn_id}
{/capture}
{function name='chatwork_post_message' room_id="123456789" text=$smarty.capture.chatwork_text_body var=status}
{*Email Notification*}
Please use the ID of your own environment for room_id
.
Once the settings are complete, click [Update] to apply the changes.
TIPS
- If you want to send the notification only to Chatwork, set "Stop sending email" to "1" from the [custom settings].
- To mention to
ToALL
in Chatwork, write[toall]
. - To mention to an individual in Chatwork, write
[To:{account_id}]
.
Form basic settings
Click [Campaign] > [Form].
Click the title of the form.
On the basic settings tab, check [Notify] and enter the email address and title.
Confirmation of operation
Finally, perform a test to confirm the operation. When you submit an answer to a form with notification to the administrator enabled, a notification will be sent to the email and also to the Chatwork channel.
With this, you can send inquiry notifications to Chatwork. You can also post to ChatWork triggered by any action in Kuroco using the same method. Please try it out.
Related Documents
Support
If you have any other questions, please contact us or check out Our Slack Community.