Twilio Voice Message

Introduction

Use the Twilio is a web service to make a call to a phone and play a voice message.

Prerequisites

  • A Twilio account is required.

  • From your Twilio account console, note Account SID, Auth Token, and Phone number.

Configure Twilio Voice Message within the NETx Core Studio

  • In the Core Studio menu, open Modules → Messenger → [Live] Twilio Voice Message.

  • Right-click to open the context menu and select Insert new definition to add a new profile.

  • Fill the following fields:

    • Profile: profile name

    • AccountSid: Account SID as in your Twilio console

    • AuthToken: Auth Token as in your Twilio console

    • SenderPhoneNumer: the Phone number as in your Twilio console

  • Save the definition table. Changes are immediately applied.

Send a voice message via XLogic

Use a Twilio Voice Message messenger profile in combination with the MESSENGER.SENDVOICEMESSAGE XCommand.

Testing

To test the profile from the Core Studio,

  • Go to Menu → Tools → Run XCommand…

  • Select XCommand MESSENGER.SENDVOICEMESSAGE and fill the required fields:

    • Profile: the name of the configured profile (note: if the profile name does not exist or if this parameter is blank, the first found Twilio Voice Message definition will be used)

    • Recipient: recipient phone number

    • Message: message text as string

  • Click Execute to send the message.

You will receive a phone call on the device with the provided phone number, shortly. Take the call, and the voice message will be played.

Send a voice message from an action

In order to send a voice message triggered by an alarm or a conditional event,

  • Set up an action that uses the MESSENGER.SENDVOICEMESSAGE XCommand.

  • Select the configured Twilio Voice Message profile and provide Recipient and Message.

  • Save the action.

  • Use this action in the desired alarm or conditional event.

Send a voice message via LUA

To send a voice message within LUA scripts, use the XMessage LUA function.

XMessage is a general LUA function that can be used to send notification and visualization message via LUA. For sending Twilio voice messages, use the following parameter values:

  • Device: not used for sending SMS. Leave empty.

  • UserOrGroup: not used for sending SMS. Leave empty.

  • MessageType: "TwilioVoiceMessage"

  • Parameter1: name of the Twilio Voice Message messenger profile

  • Parameter2: recipient phone number

  • Parameter3: message text as string

The following example uses the Twilio Voice Message messenger profile "your-profile-name" to send a voice message:

nxa.XMessage("","","TwilioVoiceMessage","your-profile-name", "+436641234567", "This is an voice message sent by LUA.")

Â