Sending SMS from email
Once we start our cooperation, you will receive access to an account in our Traffic application that provides the SMS service. This account can be used for manual sending, as well as automated SMS sending via an HTTP API (Application Protocol Interface). You can also use email to pass messages from your application as a specially crafted email message that will be delivered as SMS to the end user, which is the process described here.
Data exchange via email
Once we’ve started our cooperation, you can receive an API key that’s used for automated message sending. This key (or keys) must be specified in all automated requests from you. In case you’ve lost the key or need a new one for security reasons, we can regenerate it for you. In this case the API key is specified as part of the recipient email address.
The email for sending an SMS should be constructed like this:
- To (recipient) field: Recipient number + “@” character + your API key + “.traffic-api.lv”.
- From (sender) field: freely specified email address that you control and can receive email to. It doesn’t have anything to do with SMS sending but it could help you troubleshoot problems, if any should arise.
- Subject: You can specify the desired sender ID (alphanumeric sender) here. It should be one of sender IDs that are assigned to your account previously. If this field will contain a sender ID that is not permitted for your account, or ir it will be left empty, the sender ID that is default for your account will be used.
- Text (email message body): Message content goes here.
Example
For example, if you have an account with similar parameters:
- default country code 371 (Latvija);
- API key XXXXXXXXXX;
- Sender ID “FROM”.
to send a message to a phone number 29999999 (Latvian number) with the content “Hello!” you should create an email message that should look like this:
From: example@example.com (it doesn’t matter what you put here)
To: 29999999@XXXXXXXXXX.traffic-api.lv or 37129999999@XXXXXXXXXX.traffic-api.lv
Subject: FROM
Text: Hello!
To send a message to number 69999999 (Lithuanian number), the email message should be constructed the same way but 37069999999@XXXXXXXXXX.traffic-api.lv should be specified as the To address.
Updated on: 11/01/2023
Thank you!