Skip to main content

Connecting to Twilio and send SMS

This page explains how to integrate Kuroco with Twilio and send SMS from Kuroco.
SMS transmissions from Kuroco are compatible with Japanese domestic phone numbers starting with "090", "080", "070", and "060".

Integrate with Twilio

1. Register a Twillio account

Register your Twilio account. Visit Twilio's site.

https://www.twilio.com/

Image from Gyazo

Click "Start for free" on the top right.

Fill in the required fields, check "I accept the Twilio Terms of Service..." and click the red button "Start Your Free Trial". A dialog box will appear to verify that you are not a robot. Please follow the instructions and proceed. Image from Gyazo

The following screen will be displayed and a confirmation email will be sent. Image from Gyazo

Please check your email and open the email sent by Twilio. Click the red button in the email body that says "Verify Your Email". Image from Gyazo Sign up is now complete.

2. Set up two-factor authentication

Then set up two-factor authentication. Please log in to the Twilio console screen from the URL below.
https://www.twilio.com/login

Image from Gyazo

Please enter your mobile phone number to set up two-factor authentication.
Image from Gyazo

Check the SMS sent to your mobile device and enter the verification code.
Image from Gyazo

The recovery code will be displayed as shown below, so please make a note of it. You can use it when you lose your mobile device.
Image from Gyazo

Enter your phone number again to verify your identity.
Image from Gyazo

The settings of two-factor authentication is now complete. The survey from Twilio will be displayed. Answer about the service you're looking to build using Twilio products.
Image from Gyazo

3. Get the phone number to send from

Instructions for getting started with Twilio products are displayed. Click the blue button that says "Get a Twilio phone number" to get one USA or Canada phone number. This number will be used as the source phone number when sending SMS using Twilio.
Image from Gyazo

4. make a payment

Next, click "Upgrade" in the header and proceed with payment.
Image from Gyazo

5. Get system linkage information

Click on the part that says "My first Twilio account" in the header to go to the console top page. From the section labeled "Account Info," please copy and keep the following values.

  • Account SID
  • Auth Token
  • My Twilio Phone number

Image from Gyazo

6. Set up on Kuroco Admin panel

Next, access your Kuroco admin panel and click[External system integration] > [Text(SMS)] on the side menu.
Image from Gyazo

Check "Enable" for [Text(SMS)] and enter Account SID, Auth Token and My Twilio Phone number you saved previously.
Then click [Update].
Image from Gyazo

The settings on admin panel is now complete.

How to use linked SMS

To send SMS from Kuroco, you need to write an SMS sending program in your custom process. Originally, some timing such as batch processing or a specific Post-process is used as a trigger to call custom function.
Here, we will implement custom function for testing and try to execute it manually.

1. カスタム処理を追加する

Click [Operation] > [Custom function] on the side menu.
Image from Gyazo

Click [Add] on the top right of the page.
Image from Gyazo

Enter as follows and click [Add]. |item |value | | :--- | :--- | |Title|Enter any name. (SMS sending test in this tutorial)| |Category|Select the type of custom processing (uncategorized in this tutorial)| |Identifier|Enter the identifier to be used when calling this custom process from another. (sms_test in this tutorial)|

Image from Gyazo

Please implement the custom processing as below and click the "Test" button. Please write the recipient's phone number without hyphens, such as 090xxxxxxxx, for the part written as "(phone number)".

caution

Sending SMS from Kuroco is limited to phone numbers in Japan starting with "090", "080", "070", "060".

{sendmail 
var=result
to="(phone number)@twilio.r-cms.jp"
subject="Test"
contents="This is sent from Kuroco"}

Image from Gyazo

caution

You cannot send SMS to any phone number from Twilio during the trial period. If you want to test sending SMS during the trial period, you need to register the destination phone number in "Verified Caller IDs".

The test is successful if the message below arrives on the terminal.
Image from Gyazo

Now you can send SMS by linking Kuroco and Twilio.


Support

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