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 –
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
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.
# ./getReplies.py 00AABBE072E30149375930E85B00BBAA
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.