Transactional SMS
The Transactional SMS object represents a transactional SMS template in your Go-Mailer account. The API lets you send SMS messages to your users from your application.
Send an SMS
Sends the specified transactional SMS to the specified recipient. The recipient doesn't have to be a contact in your account.
https://api.go-mailer.com/v1/smsRequest body
| Parameter | Type | Required | Description |
|---|---|---|---|
code | string | Required | The SMS template's unique code. |
to | string | Required | The recipient's phone number, in the format |
tracking_id | string | Optional | A unique tracking ID for the message. It's returned to you in delivery notifications. |
context | object | Optional |
Each key is the placeholder's name. If your template uses |
Sample request
const response = await fetch("https://api.go-mailer.com/v1/sms", {
method: "POST",
headers: {
Authorization: "Bearer <API_KEY>"
},
body: JSON.stringify({
code: "BIRTHDAY_SMS",
to: "234xxxxxxxxx",
tracking_id: "unique-tracking-id",
context: {
firstname: "John",
age: 47,
}
})
});Delivery webhook
If you've configured a webhook URL in your Go-Mailer account, SMS delivery notifications are sent to that URL.
Payload
| Field | Type | Description |
|---|---|---|
message_id | string | The unique ID of the SMS message. |
messagestate | string | The state of the message, e.g. |
tracking_id | string | The tracking ID you supplied when you sent the message. |
Sample payload
{
"message_id": "unique-message-id",
"messagestate": "failed",
"tracking_id": "unique-tracking-id"
}