How to send SMS alert with an external API provider such as Twilio
Q: Is it possible to send SMS using third-party services, such as Twilio?
A: Yes, you can do that with either “Script or Program” or “Python script” monitor, see the instructions below.
1. Prerequisites
The mentioned monitor files require sample script files available from the following archive: send-sms-twilio.zip (1489 bytes).
You can use either trial (i.e., for testing purposes) or paid-for Twilio account. In either case, you should obtain source SMS phone number from Twilio; for more information, please consult with Twilio SMS-related documentation.
In the below sample monitor configuration, it is assumed that
- you downloaded the above mentioned archive and unpacked its contents into C:\Scripts folder
- you have registered an account with Twilio and have required data at hand (Twilio API key and SMS source phone number)
If you use another directory name to keep scripts file in, please change the name appropriately in the below instructions.
Important: sending SMS via Twilio may incur significant fees from Twilio service. Please consult their pricing section first, and make sure you only use Twilio-driven SMS alerts when absolutely necessary. Always use testing mode when checking parameters.
2. Use cURL utility to send SMS via Twilio
This method uses curl.exe binary bundled with IPNetwork; if you plan to use standalone curl.exe executable, edit C:\Scripts\send-sms\curl.cmd file correspondingly.
Start IPNetwork Monitor GUI client, proceed to “Settings > Alerts”, click “New” to create a new alert (in this example, it’s named “Twilio SMS (cURL)”; click “Add > New Simple Action > Execute program”, to open new simple action editor and enter data like below:

Detailed fields description:
where
Important: please pay attention to where quotes are used, and where they are not.
Note: do not use the example values above; they won’t work. Use actual data. Note that you can use template variables (like the above: $Hostname and $NewState).
Click “OK” when finished. Now create an alerting rule and specify when to execute the “Twilio SMS (cURL)” alert.
Test the SMS sending by assigning new alerting rule to a monitor, proceeding to “Alerting > Testing” tab and clicking “Test” on corresponding state change.
Note: to run the above test from command line, open elevated cmd.exe (“Run as Administrator”) and type command like
cmd.exe /c C:\Scripts\send-sms-curl.cmd ACCTID TOKEN FROM TO MESSAGE
Replace the parameters placeholders with their actual values, as shown above.
3. Use Python script to send SMS via Twilio
Start IPNetwork Monitor GUI client, proceed to “Settings > Alerts”, click “New” to create a new alert (in this example, it’s named “Twilio SMS (Python)”; click “Add > New Simple Action > Execute Python script”, to open new simple action editor and enter data like below:

Detailed fields description:
where
Important: please pay attention that all fields are used with quotes.
Note: do not use the example values above; they won’t work. Use actual data. Note that you can use template variables (like the above: $Hostname and $NewState).
Click “OK” when finished. Now create an alerting rule and specify when to execute the “Twilio SMS (Python)” alert.
Test the SMS sending by assigning new alerting rule to a monitor, proceeding to “Alerting > Testing” tab and clicking “Test” on corresponding state change.
To run the above test from command line, start elevated cmd.exe (“Run as Administrator”) and type command like below
"%ProgramFiles(x86)%\IPNetwork Monitor\Python-3\python.exe" C:\Scripts\send-sms-python.py ACCTID TOKEN FROM TO MESSAGE
Replace the parameters placeholders with their actual values, as shown above.
4. References
The below documents might be useful when setting up alerts:
- IPNetwork online help: Alerting and actions
- IPNetwork reference on template variables (such as $HostName)
- Twilio docs on sending SMS programmatically
Note: please refer all questions on setting up trial Twilio account, gaining source phone number etc to Twilio docs/tech.support.
Related topics
Check out our Knowledge Base where we answer questions regarding various topics. SMS can be sent through Twilio with either an Execute program action that calls cURL or an Execute Python script action that runs the sample Python script. You need the Twilio account ID, auth token, sending phone number, recipient phone number, and the message text. Template variables such as $HostName and $NewState can be used in the message. Assign the alerting rule to a monitor, open the monitor Alerting Testing tab, and run a test for the desired state change. Command-line tests can also be run with the same placeholder values replaced by real credentials.
Frequently Asked Questions
Which alert action types can send SMS through Twilio?
What Twilio values are needed for the sample SMS alert?
How should Twilio SMS alert settings be tested?