Twilio

The ThingWorx Twilio extension provides the ability to send SMS text and voice messages from ThingWorx through the Twilio communication platform. It allows you to create a Twilio Thing in ThingWorx that stores the configuration information for the Twilio account to be used to send the messages from. The services provided by the Twilio extension can be used directly or can be used in conjunction with the ThingWorx Notifications feature. The ThingWorx Twilio extension is available on IQNOX Free ThingWorx Widgets website.

Configuration #

You need to import the Twilio extension to ThingWorx. After importing the Twilio extension, a Thing Template named Twilio appears in the Thing Templates list. To create and configure a new Twilio Thing, do the following:

  1. In ThingWorx, create a new Thing and assign the Twilio Template.
  2. Click the Configuration view and enter the following details in the Twilio account from which messages will be sent:
General settingsDescription
authTokenEnter the auth token associated with the Twilio account.
callerIDEnter a valid phone number associated with the Twilio account. This will be the number from which the messages will originate.
accountSIDEnter the accountSID associated with the Twilio account.
  1. Once you enter the information, click Save. In the Services area, the following services are available:
    • GetNotificationHandlers — used by the ThingWorx Notifications feature and is generally not useful.
    • SendSMSMessage — requires the receiver’s phone number and the text to send.
    • SendVoiceMessage — requires the receiver’s phone number, the text to send, the voice of the message (male or female), loop capability, and the voice language.

If new services are created in the Twilio Thing, they can be called in a custom service from the Me/Entities service editor area.

Usage #

The Twilio Extension can be used by invoking one of the following services:

Send SMS message #

The Twilio Thing Template includes a service to send SMS messages. SendSMSMessage takes the recipient’s phone number and a message as an input. For example, to send a mass text to all your employees, you can create a service containing the following code:

Example: Send SMS to all members of a ThingWorx group

JavaScript
var employeeList = Groups[employees].GetGroupMembers();

for (var x = 0; x < employeesList.rows.length; x++) {
  var employee = employeesList.rows[x];

  me.SendSMSMessage({
    to: employee.smsAddress,
    text: "Hey, " + employee.firstName + "." + message
  });
}

Send voice message #

The Twilio Thing Template also includes a service to make phone calls. SendVoiceMessage takes the recipient’s phone number and a message as input in addition to optional voice, language, and loop input. For example, to automate a complimentary wake-up service, you could create a service containing the following code:

Example: Send voice message service

JavaScript
var date = new Date();
var hour = date.getHours();

if (hour == 5) {
  me.SendVoiceMessage({
    to: "(555) 555-5555",
    text: "Rise and shine!"
  };); 
}

You are now ready to send SMS messages and make phone calls.

Was this article helpful?

  • Happy
  • Normal
  • Sad

Contact Support

Please fill in the form below and we will get back to you ASAP!
Support form is only accessible for logged in users.
IQNOX Logo
Log In

Welcome back!

Remember me
Don't have an account? Sign Up

Schedule a Demo

Schedule a personalized demo to explore how our widgets can streamline your workflow, enhance efficiency, and drive better results.
Name
Preffered Date / Time (US Eastern time)
We’ll do our best to accommodate your preferred date and time. If it’s not available, our team will reach out to find a time that works for everyone.