Channels
SMS with sendsms.mn
Send Ray notifications as SMS to Mongolian numbers through your own sendsms.mn account. API key and token, 8-digit recipients, how long and Cyrillic messages are split into SMS, pacing and errors.
The sendsms_mn channel sends text messages to Mongolian mobile numbers through sendsms.mn using your own account. Each send targets one 8-digit number; long messages go out as several SMS. API calls go to https://ray-api.gege.mn with Authorization: Bearer $RAY_API_KEY.
| Channel type | sendsms_mn |
| Template kind | sms_text (shared with Twilio) |
| Recipient | { "phoneNumber": "99112233" } |
| Message length | Up to 1600 characters, split into SMS of at most 159 plain Latin or 69 Cyrillic characters |
| Pacing | ratePerMinute, default 300, max 1600 |
| Suppression | None |
What you need from sendsms.mn
- Sign in to sendsms.mn and copy the API key (24 characters) and API token from your account's API page.
- Make sure the account has an active package that hasn't expired and enough balance. sendsms.mn charges every message to that balance and rejects sends when the package is inactive or the balance runs out.
Channel config
Create the config in the dashboard: Channels, New channel, SMS (sendsms.mn). The API token is stored encrypted and never shown again.
| Field | Required | Notes |
|---|---|---|
| Name | yes | Internal label, for example otp-sms. |
API key (apiKey) |
yes | 24 hex characters. |
API token (apiToken) |
yes | When editing, leave blank to keep the stored token. Changing the API key requires a new token. |
Rate limit, messages per minute (ratePerMinute) |
no | Default 300, max 1600. |
Find the config's id with GET /channels; its kind is sendsms_mn.
Template content
| Field | Type | Notes |
|---|---|---|
text |
string, 1 to 1600 | Plain text. Long messages are split into several SMS (see below). |
Long messages and Cyrillic
sendsms.mn accepts one SMS per request and rejects longer text (Монгол үсэгтэй мессеж хамгийн ихдээ 70 тэмдэгт байна), so Ray splits long messages itself. An SMS carries 140 bytes, and how many characters fit depends on the encoding the text needs:
| Text | Encoding | Limit |
|---|---|---|
| Only GSM-7 characters: Latin letters, digits, common punctuation, newlines | GSM-7, 7 bits per character | 159 characters per SMS |
Any character outside GSM-7: Cyrillic (including ө and ү), emoji, €, [ ], curly quotes, — |
UCS-2, 2 bytes per character | 69 characters per SMS |
A single Cyrillic letter switches the whole message to UCS-2, so Your code is 482913 fits 159 characters per SMS but Таны код 482913 fits 69. An emoji counts as 2 characters.
After params are filled in, Ray splits a longer message the way sendsms.mn's own composer does: at spaces and line breaks, packing as many words as fit, and cutting inside a word only when a single word is longer than one SMS. Each part is sent as its own request, in order, and billed as one SMS; a 125-character Cyrillic message goes out as 2 SMS. Parts arrive as separate messages, so write long texts to read well when split. The dashboard's SMS template editor shows the encoding and the SMS count as you type. Param values are inserted verbatim; SMS has no markup to escape.
Recipient
{ "phoneNumber": "99112233" }
| Field | Type | Notes |
|---|---|---|
phoneNumber |
string | Required. A Mongolian 8-digit number. Spaces, dashes and a +976 prefix are removed, so +976 9911-2233 is sent as 99112233. Any other length is rejected with 400. |
Send a message
curl -X POST https://ray-api.gege.mn/send \
-H "Authorization: Bearer $RAY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: otp-8f2c" \
-d '{
"channelConfigId": "8e9f0a1b-2c3d-4e5f-8a6b-7c8d9e0f1a2b",
"content": { "text": "Таны нэвтрэх код: {{code}}" },
"params": { "code": "482913" },
"logTitle": "Login code",
"logDescription": "Login code sent by SMS",
"recipient": { "phoneNumber": "99112233" }
}'
To message many people, use targets[] (up to 1000 per request). Ray sends each number as its own SMS, so each target is billed as one message:
{
"channelConfigId": "8e9f0a1b-2c3d-4e5f-8a6b-7c8d9e0f1a2b",
"templateId": "1d2e3f4a-5b6c-4d7e-8f9a-0b1c2d3e4f5a",
"params": { "branch": "Салбар 1" },
"targets": [
{ "recipient": { "phoneNumber": "88000000" } },
{ "recipient": { "phoneNumber": "88000001" } }
],
"priority": "low"
}
delivered means sendsms.mn accepted every part. providerMessageId holds the ids sendsms.mn returned, comma-separated for a split message.
Pacing
Ray paces each sendsms.mn account (API key) at ratePerMinute, default 300. A split message counts once toward the pace, whatever its number of parts. sendsms.mn doesn't publish a rate limit; a 429 is retried with backoff.
Errors
Errors appear on the delivery row as providerError: { "name": "SendsmsMnError", "message": "sendsms.mn send failed: <status> <message>" }. sendsms.mn reports errors in Mongolian, for example API түлхүүр, токен буруу байна (wrong API key or token).
| Result | Cases |
|---|---|
failed_terminal (not retried) |
Any 4xx except 429: wrong API key or token, invalid number, no active package, expired package, insufficient balance. Also anything after which an SMS may already be out, because sendsms.mn's API has no idempotency key and a retry could send (and charge for) it twice: a request timeout (sendsms.mn did not answer in time; not retried because the SMS may already have been sent), and any failure after the first part of a split message was sent (sent 1 of 3 SMS parts, then part 2 failed (not retried, to avoid resending the first 1): …). |
failed_retryable (retried) |
429, 5xx and connection errors on the first (or only) part, when nothing has been sent yet |
Request errors from POST /send are listed in Errors.