Skip to main content

SMS API

How to send SMS messages to players using the InTarget SMS API

Use the InTarget SMS API to send text messages to players straight from your backend — from a saved SMS template or with inline text. It's built for messages your platform triggers in real time, like deposit confirmations.

Contact [email protected] to get your access token. We recommend passing it in the Authorization header — see Authentication below.

Use Cases

  • Deposit confirmation. A player tops up their balance, and your backend immediately sends a transactional SMS with the amount — passed through variables.

  • One-time codes. You send a verification code as a transactional SMS. If your service retries the request, the idempotencyKey makes sure the player gets only one message.

  • Personalized promo. You send a promotional SMS from a saved template, and the player's first name fills in automatically from their profile because you pass playerId.

  • Short links in SMS. Your message includes a link to a promo page. You pass "shortUrlEnabled": true, and the long URL is replaced with a short one — so it takes less space in the SMS. This works both with a template and with inline text.

Send an SMS

POST https://api.intarget.app/v2/messages/sms
Authorization: Bearer <TOKEN>

Send an SMS either from a saved template (templateId) or with inline text. The request uses the same structure as the /v2/messages/email endpoint described in Email API.

Authentication

You can pass your access token in one of two ways:

  • Authorization header (recommended) — Authorization: Bearer <TOKEN>. This keeps the token out of the request URL.

  • Query parameter — ?access-token=<TOKEN> appended to the endpoint URL. Still supported.

POST https://api.intarget.app/v2/messages/sms?access-token=<TOKEN>

payload

  • templateId — the SMS template to send. Use it instead of text.

  • senderName — the sender name of the message, for example InTarget.

  • shortUrlEnabled — boolean — controls link shortening for this send. See Link Shortening below.

  • text — inline message text. Supports variables, for example {{ topUpValue }}.

recipient

  • playerId — the player the message is addressed to.

  • address — the recipient's phone number, for example 380000000000.

Other Fields

  • category — message category. One of promotional or transactional.

  • providerId — the SMS provider that sends the message. If empty, the project's default provider is used.

  • variables — object with string values — external template variables, for example {"topUpValue": "20.00 €"}.

  • internalName — your own label, kept with the send record.

  • idempotencyKey — a caller-side key that makes a repeated send return the first result instead of sending again. Required for transactional messages.

Link Shortening

The shortUrlEnabled flag is the only thing that decides whether links in an API send get shortened:

  • true — all long links in the message are replaced with short ones. Works with a template (templateId) and with inline text.

  • false — no shortening, even if the template has shortening turned on.

  • Not passed (null) — no shortening

Write every link as a full URL, including https:// — for example https://intarget.space/. Only full links are recognized and shortened. A link written as intarget.space won't be detected.

Example

POST https://api.intarget.app/v2/messages/sms
Authorization: Bearer <TOKEN>
Content-Type: application/json
{
"payload": {
"senderName": "InTarget",
"shortUrlEnabled": true,
"text": "{{ firstName|default('Friend') }}, Funds have been deposited {{ topUpValue }} https://intarget.space/"
},
"recipient": {
"playerId": "2023022617000",
"address": "380000000000"
},
"category": "transactional",
"providerId": 18,
"variables": {
"topUpValue": "20.00 €"
},
"internalName": "Test SMS",
"idempotencyKey": "84b1ff74-364f-47fb-a4d1-a8074dcadf6b"
}

Here firstName comes from the player profile (because playerId is passed), and topUpValue comes from variables. With shortUrlEnabled set to true, the full link https://intarget.space/ is sent as a short URL. To send from a saved template, replace text with "templateId": <id>.

Responses

  • 202 — the message is accepted and queued for sending. The response returns the message id, channel, and status.

  • 401 — API token missing or invalid.

  • 403 — the API token is not allowed to perform this action.

  • 422 — request validation failed.

Transactional messages require an idempotencyKey.

Things to Know

  • If you pass recipient.playerId, standard player variables resolve automatically in text. Use variables only for values that don't live in the player profile — like a deposit amount or a one-time code.

  • Use the default filter to set a fallback: {{ firstName|default('Friend') }} prints "Friend" when the player has no first name.

  • Generate a fresh idempotencyKey per logical event — a UUID works well.

  • Treat internalName as a stable identifier — for example deposit-confirmation-sms — and keep it the same for every send in the same scenario.

  • Sending with cURL? Single quotes inside a single-quoted --data body must be escaped as '\'' — for example default('\''Friend'\'').

See the full list of standard player variables: Email, SMS, Webhook and Push Notifications Variables.

Learn more about the shortener: TRG.TO: the URL Shortener Feature.

Did this answer your question?