HI, Questetra users! I’m HATANAKA, Questetra CTO.

At the end of the previous blog post “Phone Number Verification through Web Form Application”, I mentioned that

Some may say that if I specialize the phone number to mobile phone, SMS is enough rather than a phone call.

Phone Number Verification through Web Form Application

Twilio can also handle SMS, so I’d like to work on sending SMS.

To do so, I will utilize “Send an SMS with the SMS API” of Twilio.

Programmable SMS: Send an SMS with the SMS API

I needed two steps for the API to make a phone call, but this can be realized in one step. Simple.

Just send a POST request for a specific URL, including the following parameters.

  • Source number
  • Destination telephone number
  • Contents

However, there are caveats in the phone numbers to be used. Which is, SMS cannot be sent with a Japanese telephone number that can be purchased at Twilio. Therefore, I need to purchase a phone number that is “other than Japan” and capable of sending SMS to Japan. Depending on the country, there may be cases where even though you can use SMS, it is capable of sending only to the number in the same country. With a U.S. phone number, you can send SMS anywhere in the world.

Although all of voice/SMS/MMS/FAX can be sent if these were checked at buying like in the above figure, I will ignore MMS (Multimedia Messaging Service) since the service is not provided in Japan.

Now, I will create a simple Workflow App.


It is a flow that

  1. At “Input” Step, destination phone number and a message text are entered.
  2. “Send” (auto) Step is a Throwing Message Intermediate Event (HTTP), and it calls “SMS API”.

Data Items are as follows.
Although the input check etc is not the points this time, I set it continuing the contents of the last time.

Data Item Type Required Permission at “Input” Step
Title String type single line No Editable
Phone number String type single line Yes Editable
Regular expression to be satisfied: \+81\d{9,10}
Placeholder: +8175205XXXX
Description:

Please start with the country code (+81).<br>Only numeric without a hyphen.
Text body String type multiple lines Yes Editable
Max Length: 100

I will show you a list of variables used in the App.

Variable Value
AccountSID Account ID of Twilio
AuthToken token used for accessing API (AUTHTOKEN). Something like a password.
PhoneNumber The phone number to call. Those purchased from Twilio. Designated in international call format.

Finally, it is the setting of Throwing Message Intermediate Event (HTTP).

Access URL https://api.twilio.com/2010-04-01/Accounts/${var[AccountSID]}/Messages.json
HTTP Method POST (application/x-www-form-urlencoded)
Security Connect with Basic Authentication
User name ${var[AccountSID]}
Password ${var[AuthToken]}

Regarding Send parameters, it is as follows.

Parameter name Value
From ${var[PhoneNumber]}
To “Phone number”
Body “Text body”

That’s it, for the development of the App. The content as exactly as entered in the text body will be sent to the destination mobile phone/smartphone via SMS.

There is one point to note. In the setting of the mobile phone/smartphone receiving SMS, it could be set to not receiving SMS from overseas. Also, instead of the settings of the terminal, but also the setting of the mobile carrier could be so. In that case, SMS sent from this Workflow App cannot be received. That is because the SMS is not from Japan.

That’s it for today. Next time, I would like to substitute the part of Throwing Message Intermediate Event (HTTP) with a Script Task. See you around.