Connecting to Notifyre via the Twexit API using Node.js
Twilio users can easily make the switch to Notifyre and save on their SMS messaging costs via the Twexit API. The Twexi API allows users to send SMS messages via Notifyre with minimal changes to existing Twilio SMS API code.
Setting up your account
To use the Twexit API, please ensure that you have signed up for a free Notifyre account, then follow the steps below.
Verify your phone number
- Login to the Notifyre dashboard
- If you are a first-time Notifyre user, click on the blue notification "Please verify your phone number here" to be redirected to your Profile page. Alternatively, click on your name in the top right hand corner of the dashboard and select "Profile" from the drop-down menu
- Enter your mobile number into the Phone Number field and click "Verify Number"
- You'll receive an SMS verification code. Enter the SMS code into the pop-up window and click "Verify Number"
Generate an API token
- Navigate to the settings tab on the right side of the Notifyre dashboard and click "Developer" from the drop-down menu
- Select the "API Tokens" tab and click "+New"
Find your account ID
When setting up the Twexit API, you'll need your Notifyre account ID. To find this, simply:
- Navigate to the settings tab on the right side of the Notifyre dashboard and click "Account" from the drop-down menu
- On the "General" tab you'll be able to view your account ID
Using a virtual mobile number
You have the option to use a dedicated virtual mobile number to send and receive SMS via the Twexit API. If you do not setup a virtual mobile number, you will be unable to receive SMS replies.
Using a custom SMS sender ID
You have the option to use a custom alphanumeric sender ID as the sender (from) when sending SMS via the Twexit API. In this case, you will not be able to receive SMS replies from your audience.
Sending an SMS message
To start sending SMS via the Twexit API, you must update the Request URL, the account ID and the API token in your existing Twilio API.
1. Update the request URL
To update the request URL, you will need to replace the existing HTTP POST URL:
with Notifyre's Twexit API URL in the Send SMS API endpoint:
2. Update the account ID
To update the account ID, you will need to replace the variable TWILIO_ACCOUNT_SID with your Notifyre account ID. We recommended creating a new variable called NOTIFYRE_ACCOUNT_ID and replacing the Twilio variable with the Notifyre one in the Send SMS API endpoint. Alternatively, you can hardcode your Notifyre account ID.
3. Update the API token
To update the API token, you will need to replace the variable TWILIO_AUTH_TOKEN with your Notifyre API token. We recommend creating a new variable called NOTIFYRE_API_TOKEN and replacing the Twilio variable with the Notifyre one in the Send SMS API endpoint. Alternatively, you can hardcode your Notifyre API token.
Node.js code samples
Original Twilio Send SMS API call:
Updated Notifyre Twexit SMS API call:
Responses are the same as Twilio's responses. The response should contain:
- The Twexit API does not currently support custom URL Callbacks
- The Twexit API currently only supports the SMS Send API call
- If using a Notifyre system number to send SMS, you will not be able to receive SMS replies (only available when using a dedicated virtual mobile number)