The SCG messaging API provide functionality to translate the message’s text from a source language to destination language at delivery time, sending the translated the messages to the destination numbers in the selected destination language.
This document describes how to use the SCG message_requests API method, specifically the fields related to language translation on the request body to set the message translation when posting a message request.
Requesting a translated message
We can request to send a translated message by the SCG Messaging API "message_requests”: the fields "translate", "src_language" and "dst_language" must be specified with the values for the message’s text translation to deliver by SMS.
- translate: boolean: When translate attribute is set to 'true' translation of message body is enabled.
- src_language: string: This is the source language of a message. The default is English 'en'.
- dst_language: string: Translate message to a specified language. If not set, only messages to contacts with language preference will be translated.
Example
Let’s say we want to send a SMS with the message: “First in time first in right” translated to Spanish for a recipient. The curl command to request this SMS translated to Spanish is:
curl -L -X POST \
https://api.syniverse.com/scg-external-api/api/v1/messaging/message_requests \
-H "Content-Type: application/json" \
-H "Authorization: Bearer [TOKEN]" \
-d "{\"from\":\"channel:1KJPMkuHQkair_o15etpmg\",
\"to\":[\"+1346787XXXX\"],
\"body\":\"First in time first in right\",
\"src_language\":\"en\",
\"dst_language\":\"es\",
\"translate\":true}"
When we retrieve the message’s state, we can see the translated message:
{
"application_id": 11407,
"company_id": [company_id],
"created_date": 1658949749562,
"last_updated_date": 1658949749854,
"version_number": 2,
"id": "VsljcWKT2YOJIXf5D516a",
"from": "channel:1KJPMkuHQkair_o15etpmg",
"to": [
"+1346787XXXX"
],
"consent_requirement": "OPT_OUT",
"attachments": [],
"body": "Primero en tiempo primero en derecho",
"state": "SENT",
"channel_id": "1KJPMkuHQkair_o15etpmg",
"sender_id_sort_criteria": [],
"contact_delivery_address_priority": [],
"translate": true,
"src_language": "en",
"dst_language": "es",
"mediaURL_attachIds": [],
"message_type": "SMS"
}
List of supported languages
Here is the complete list of supported languages:
Language Name |
Language Code |
Afrikaans |
af |
Irish |
ga |
Albanian |
sq |
Italian |
it |
Arabic |
ar |
Japanese |
ja |
Azerbaijani |
az |
Kannada |
kn |
Basque |
eu |
Korean |
ko |
Bengali |
bn |
Latin |
la |
Belarusian |
be |
Latvian |
lv |
Bulgarian |
bg |
Lithuanian |
lt |
Catalan |
ca |
Macedonian |
mk |
Chinese Simplified |
zh-CN |
Malay |
ms |
Chinese Traditional |
zh-TW |
Maltese |
mt |
Croatian |
hr |
Norwegian |
no |
Czech |
cs |
Persian |
fa |
Danish |
da |
Polish |
pl |
Dutch |
nl |
Portuguese |
pt |
English |
en |
Romanian |
ro |
Esperanto |
eo |
Russian |
ru |
Estonian |
et |
Serbian |
sr |
Filipino |
tl |
Slovak |
sk |
Finnish |
fi |
Slovenian |
sl |
French |
fr |
Spanish |
es |
Galician |
gl |
Swahili |
sw |
Georgian |
ka |
Swedish |
sv |
German |
de |
Tamil |
ta |
Greek |
el |
Telugu |
te |
Gujarati |
gu |
Thai |
th |
Haitian Creole |
ht |
Turkish |
tr |
Hebrew |
iw |
Ukrainian |
uk |
Hindi |
hi |
Urdu |
ur |
Hungarian |
hu |
Vietnamese |
vi |
Icelandic |
is |
Welsh |
cy |
Indonesian |
id |
Yiddish |
yi |
0 Comments