Sending SMS Text Messages from Node-RED via Esendex

Esendex is an international mobile communications provider, serving customers in the United Kingdom, Ireland, France, Spain, Australia, United States, and also Germany/Austria/Switzerland (Or DACH as they now like to be called to avoid being associated with Europe’s coach class).

Esendex offers various data-plans for SMS which vary according to country and contracted package size. As a guideline we are currently paying 16€ (approx $19) for a 200 SMS package, to be used within one year, which is pretty reasonable considering you have complete message traceability, no monthly contract fees and no costly surprises if a nasty bug in your code starts sending chargeable SMS’s every second. Esendex even offer a free 7 day trial with 25 free SMS messages, so what more incentive to try out the service?

For general information on the Edendex API you can go to https://developers.esendex.com/ and roll your own. However if you haven’t got time, a third party Node-RED node is available from the developers,TheThingBox which works just fine. https://flows.nodered.org/node/ttb-node-esendex.

Esendex does not provide direct support for this node, but as an independent company, Optomation Systems in Spain, we can confirm that the node does work correctly. We use it within Node-RED applications running on Opto22 GroovBox devices for industrial applications.

But as usual, it’s a case of insufficiently clear documentation; and a lack of working examples. With just one mistake in a parameter, the node functionality just won’t work, offering no useful help as to where the problem really is. The following guide should make things easier.

1. “How It All Connects Conceptually”

1. Node-RED Flow Example

As a first example, you probably want to create a flow something like the following:

2. “Create SMS” Function Node

Create a payload containing the text to be sent using a Node-RED function node. Keep SMS messages short and sweet. If you want to write your life-story, use a Node-RED email node instead.

If you send more than 160 characters, Esendex will break the message down into chunks of 153 characters before sending it to the recipient’s handset as multiple messages charging for each part as an SMS. Larger received messages are usually reconstructed as a single message but this depends on the receiving operator, device and operating system.

3. Esendex Node Configuration

Configuration Fields

To: Mobile Number that you want to send SMS Message to. Note the use of countrycode format (34 is Spain) and no spaces or characters. The destination phone number does not have to be registered in your Esendex account

From: The identifier that you want to appear as sender. This can be a phone number in the same format as the “To” Field or free format text. For most phones, if the text matches a name in your phone agenda, the SMS Message will be stored as a continuation of any existing conversations for that person. Note that no spaces are allowed in the text so you can configure your SMS’s to appear to come from DonaldTrump, but not from Donald Trump as the space character in the middle actually causes the message request to fail.

Account: Not so obvious, this is your Esendex Account ID: You can find this by logging onto your Esendex account and selecting Echo > Configuration or local language equivalent [Hint. It starts with EX0]

Username: Not so obvious, but this is your account name that you use to log in to your Esendex account. If you have managed to log onto your Esendex account, then you know this. [Hint: It is something like username@domain.com ] Also not completely obvious is that you must include both user and domain, not just the user name.

Password: Pretty obvious. If you have managed to log onto your Esendex account then you know your password. If you have forgotten your password, this is nobody else’s fault.

Name: If you leave this blank, then automatically the mobile phone number configured in the To: field is displayed. You could change it to something more generic like “Send SMS via Esendex

4. Debug Node

Add a debug node in the Node-RED flow to check the payload contents, which is what is being sent to the Esendex servers servers for conversion to an SMS message

5. Confirm Receipt of Request in Esendex Server

Log onto your Esendex account and navigate to Echo > Sent Messages (Or local language equivalent) This shows all of the message requests that have been received by the Esendex servers and the status of their delivery.

If your message does not appear here then the problem is that the request never reached the Esendex servers. If your message does appear, a status update shows current status of conversion to SMS, and the sending process to the destination phone number (The To: Field in the node configuration] including a confirmation of the reception. Very useful when operators or maintenance staff delete the SMS text message and claim that they never received it.

6. Confirm Reception in Destination Mobile Device

If the state is a Green “Delivered”, then you can be pretty sure that the SMS has been received in the destination device.

7. And Finally

Don’t forget that Esendex counts every SMS message they send. It’s their business! Log into your Esendex account occasionally to check available credit in the dataplan that you purchased, and purchase more credits if necessary. Menu [Echo > Send]

Not so obvious is that credit expires one year after purchase if not used or topped up. If you find that your requests are being received in Esendex’es servers, but SMS’s are not being sent, it’s probably because you have no credit left in the account or set up the credit plan over a year ago. How time flies when you are having fun!

2 Likes

Wow, thanks for sharing, gmitchell!

As everyone appears to enjoy our “How It All Connects Conceptually” presentations, I have included the relevant slide showing how the SMS message gets from the groovbox Node-RED environment to your mobile phone. :slight_smile:

Thanks, gmitchell. Have you done anything with sending an SMS to the groov box (e.g. “shut off X”), too?