Receive an SMS Message
Overview
Receive inbound SMS messages to your numbers. Get your message returned via SMPP or via a webhook URL that you provide. For production traffic, we don’t recommend using this endpoint, but instead registering a webhook.
Authentication
Authentication is done by passing your TSG Global API key via the Authorization header in the format "Authorization: Bearer <api_key>" (using the messaging API key specifically). API credentials can be found here: https://customer-portal.tsgglobal.com/account
Method
Returns a single message. Useful for manually checking message status.
GET
https://sms.tsgglobal.world/messages/<uuid>
You can either use a message id, or one of the part ids. In the case of the latter, you will see detailed information about the part (the raw SMS).
We don’t recommend using this endpoint - perhaps only for testing. For production traffic, we recommend registering a webhook (see below).
Path Parameters
Name | Type | Description |
---|---|---|
uuid* | String | The UUID for the message ID you are wanting to query. |
Example Responses
Single message
Longer message consisting of multiple UDH parts
Set your webhook URL for your Number
The new webhook will deliver both new messages as well as delivery receipts. You can distinguish the event type based on the object
parameter (sms
for messages, sms_dlr
for delivery receipts).
Note: Webhook objects will also return Message objects, and include a parts
section in the case of a UDH multi-part message.
Your webhook must return 200 OK HTTP status code to acknowledge the event, otherwise we’ll attempt to redeliver up to 17 times over 2-3 days (with exponential backoff).
You can optionally send back a JSON response with the body
key, containing a message response (which will be encoded with the same encoding rules mentioned under the Message Send API) to be sent back to the originator. We currently only support the body
key, but are evaluating adding encoding
and other functionality supported by Message Send.Receive your Content.
Message Object
Represents a single message. This can be either one actual SMS, or more if the message was longer and split into multiple UDH parts.
This is done because of convenience for our users, generally it’s more important to track the status of a whole message, instead of individual parts. Note that you can still retrieve the number of parts sent (for billing purposes) etc., as well as view part information as needed.
If the low level SMS details are important (down to the PDU), then our SMPP API might be more suitable for you.
In the case of a single message, id, represents the actual sms id.
In the case of a multipart message, the id is representing all the parts. The object will also contain a parts section which will contain information about each of the individual sms parts that were sent. (currently just the part ids, you can use those to retrieve more information via the above Message Get API). To get the number of actual sms sent (in v1, that was the X-Message-Count header), you can either check the length of parts array, or check udh.count.
Below is an example of the package that will be sent to your webhook.
Delivery Receipts
Delivery Receipt Object
Name | Description |
---|---|
id | string Unique identifier for the object |
type | string
Message type, either |
from | string Number (or sender ID) of the original sender |
to | string Number of the message recipient |
object | string
Always set to |
delivery_status | string Delivery status. |
submitted_at | timestamp Time at which the message was submitted |
done_at | timestamp Time at which the message has reached it’s final state (minute accuracy, seconds ignored) |
delivery_error_code | string If unsuccessful, will contain upstream error code. |
inserted_at | timestamp Denotes when the message was initially received. |
updated_at | timestamp Denotes when the data last changed. |
sms.id | uuid ID of the matching SMS. |
Delivery Status
Id | Description |
---|---|
delivered | Message was successfully delivered. |
expired | Message validity period has expired (for instance, the phone was turned off). |
deleted | Message has been deleted. |
undelivered | Message is undeliverable (for instance the number doesn’t exist) |
accepted | Message was accepted and will be sent. |
unknown | Delivery status is unknown. |
rejected | Message was rejected by the carrier |
failed | Delivery was unsuccessful. |
enroute | Message is enroute. |
skipped | Message was skipped. |
Example DLR
Last updated