Nov 042015
 

I finally got around to playing with the Telstra SMS API some more after very successfully using it to send messages from my Zabbix instance at home.

I wanted to get responses from the messages so that I could potentially automate some responses if I get an alert via my Zabbix instance.

This can easily be done via a script that will poll the Telstra API for replies to specific messages, I just need to know the message ID that is sent, which is done by modifying my previous Telstra SMS API script to add a single line at the bottom to display the message ID –

print msg.read()

This line will display the message ID after the message is sent.
This example shows what the output of the script is when run from the command line –

# ./telstrasms.py 0400000000 testsubject3 testbody3
not expired
{"messageId":"00AABBE072E30149375930E85B00BBAA"}

With that messageID, you can get replies to the message you sent. I’ve written up a short script on my GitHub named getReplies.py that uses the Message ID to retrieve messages.

For example:

# ./getReplies.py 00AABBE072E30149375930E85B00BBAA
not expired
[{"from":"0400000000","acknowledgedTimestamp":"2015-10-22T03:39:00+11:00","content":"Reply"}]

As you can see from the JSON response, a message from “0400000000” was received at 2015-10-22 03:39:00 with the contents of “Reply”.

This information can then be used for your own purposes, whether it’s to update a ticketing system or just to log responses.


References: https://dev.telstra.com/content/sms-getting-started#message-response

Share

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)

This site uses Akismet to reduce spam. Learn how your comment data is processed.