Receive SMS Delivery Notifications and Incoming Text Messages Via Callback URLs

You can set up callback URLs to get the delivery status of both the text messages you have sent and incoming messages. The TextMagic server will call your callback URL and post SMS delivery notifications and incoming SMS messages directly to your application, which means that you get delivery notifications and incoming SMSs as soon as they arrive.

API callbacks is the method TextMagic recommends for obtaining message-status updates or fetching your inbox messages, as these do not require your application to poll the TextMagic API gateway continually.

Setting Up Callback URLs

You can setup these callback URL's online at http://www.textmagic.com. Just login and under the My Services section click on API. Please note that we will try to validate your URL. We send an HTTP HEAD request and your server should reply with HTTP code 200. If not, the system considers the URL to be invalid and cannot set it. POST uses UTF-8 encoding.

The URL must begin with either http:// (non-encrypted) or https:// (encrypted). The TextMagic server sends HTTP POST queries to your URL with the variables listed below.

We use multipart POST for API callbacks. Want to know more? Visit RFC2388 - Returning Values from Forms: multipart/form-data

SMS Delivery Notification Callback

Variable Value
message_id A unique ID assigned to a message.
timestamp The time of receiving a delivery notification from a mobile operator, in Unix time format.
status The delivery status.
credit_cost The total cost of the message in SMS credits.

Incoming SMS Message Callback

Variable Value
message_idA unique ID assigned to an incoming message.
timestamp The time of receiving the message, in Unix time format.
from The sender’s phone number.
text The message’s text, in the UTF-8 character set.

Troubleshooting and Testing Callback URLs


To test notifications of incoming messages, you can generate fake incoming message callbacks on the TextMagic website at web page (TextMagic > Services > API). These callbacks contain some auto-generated data.

Back to top