Sending of SMS and WhatsApp with Twilio

Send notifications and alarms from the automation level for mobile users via SMS and as WhatsApp message

Events that should be responded to seldom happen when you are waiting for them to happen. Fault and standby services, maintenance staff, but also production managers must be constantly informed in order to react to unplanned situations and make the right decisions at the right time. In Industry 4.0, access to information is easier than ever before and yet rarely is anyone in a position to keep an eye on everything at all times. It is better if processes actively report and inform those responsible about upcoming events. Such requirements can easily be solved perfectly via mobile accessibility, which is standard nowadays, using the well-known notification services such as WhatsApp or the classic SMS. With the OPC Router and the Twilio service, events from the automation world can be sent easily and application-specific via the service. In our short manual we show you how to send your individual notification in a few steps with the OPC Router.

To let the OPC Router send SMS or WhatsApp messages, perform the following steps:

Sending of SMS and WhatsApp with Twilio

1. Login to the Twilio console after you have registered for that service with a own Twilio telephone number und a verified phone number to send messages.

2. Copy the marked credentials for use in the OPC Router Rest plug-in:

Login information for use in OPC Router Rest Plugin

3. Do following steps in the OPC Router:

  • Click “Plugins” (1)
  • Click “Rest” under “Cloud / IoT” (2)
  • Click on the Button to create a Rest connection (3)

Create a Rest Connection

4. Put in the following data:

  • Name (1)
  • Host-URL (2)
  • Authentication (3)
  • Username: Account SID of Twilio account (see step 2) (4)
  • Password: Auth Token of Twilio account(see step 2) (5)

Then click on the OK button (6):

REST Registration

5. Finally here is the finished Rest connection:

REST connection

6. In the connection you use a Rest plugin and configure it as follows:

  • Choose a connection (1)
  • Host will automatically be set (2)
  • The URL-Endpoint is “/”[Account SID]”/Messages.json” (3)
  • Choose the method “POST” (4)
  • Choose the format “application/x-www-form-uriencoded” (5)
  • Required parameters with the type “GetOrPost” are “To”, “From” and “Body” (6)
  • Save via OK button (7)

REST Configuration

7. Sending a Message as SMS is possible to a verified phone number (parameter “To”). You will send it from the Twilio registered telephone number (parameter “From”). Here will be sent a SMS with the text “Hello Twilio.”:

SMS Twilio

8. Sending a Message as a “WhatsApp” is also possible. As prefix of the parameters “To” and “From” you have to use “whatsapp:” (the yellow marked phrases). The Twilio telephone number for WhatsApp messages is “+14155238886”. For activating this functionality you must add this number into your WhatsApp contact list and firstly send the message or command “join”. In addition, it is important that the request format is manually set to “application/x-www-form-urlencoded”. Here is an connection example for sending a WhatsApp message:

WhatsApp Twilio

Creation note for the screenshots of the OPC Router: Version 4.16.5001.113

Run a free test now!

Get your personal link to the most recent OPC Router configuration and sign awake for product news.

Test now!