Skip to main content

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.

Image from Gyazo

Create a group to receive notifications

Next, create a group chat to receive the notifications.

Image from Gyazo

Once you are ready, note down the room ID from the group chat settings.

Image from Gyazo

Get the API token

Access Chatwork APIへようこそ! and click [Apply for API Usage] at the bottom of the page.

Image from Gyazo

Log in with the bot account, and you will be redirected to the API Token page where you can confirm the API token.

Image from Gyazo

Kuroco settings

Save the API token

Access the Kuroco management screen and In the left sidebar menu, under "SETTINGS", click [Environment] -> [Secrets].

Image from Gyazo

Click on [Add].

Image from Gyazo

Enter the following information and click on [Add].

FieldValue
NameCHATWORK_API_TOKEN
ValueThe API token obtained from Chatwork

Image from Gyazo

Create a custom process to post to Chatwork

Create a custom process to post to Chatwork using custom processing.

Click [Operations] -> [Custom Processing].

Image from Gyazo

Click [Add].

Image from Gyazo

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 variables room_id and text.
  • It returns the result of the processing with {return value=$status}.
ItemValue
Titlechatwork_post_message
Identifierchatwork_post_message
ProcessingThe following content
chatwork_post_message
loading...

Image from Gyazo

Once you have entered the information, click [Add] to add the custom processing.

Edit message template

Click [Operation] > [Message template].

Image from Gyazo

Search for "inquiry/inquiry_contact" and click the displayed title [inquiry/inquiry_contact].

Image from Gyazo

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*}

Image from Gyazo

caution

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].
    Image from Gyazo
  • 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].

Image from Gyazo

Click the title of the form.
Image from Gyazo

On the basic settings tab, check [Notify] and enter the email address and title.

Image from Gyazo

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.

Image from Gyazo

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.


Support

If you have any other questions, please contact us or check out Our Slack Community.