Send SMS message to a mobile number

Log in to see full request history
timestatususer agent
Retrieving recent requests…
LoadingLoading…

📘

If the user includes stop code in the Transactional SMS, then it will be switched to Marketing SMS automatically and it will be interpreted as a Marketing SMS. To send Transactional SMS as Transactional, it is important not to use stop code.

Note: For adding a stop code, client has to add reply STOP to [STOP_CODE] and the [STOP_CODE] will be replaced with the number.

📘

For end users in France

Transactional SMS can be sent at any time without time restrictions. However, if a message is categorized as Marketing, it must adhere to specific time restrictions. Messages sent outside of these restricted hours will experience delays and will be processed during allowable times. Specifically, Marketing SMS cannot be processed between 10pm and 8am, on Sundays, and on French public holidays.

Code Examples

You can use as reference the code below to implement this call in your preferred language.
Check all our official API clients here

const SibApiV3Sdk = require('sib-api-v3-sdk'); const defaultClient = SibApiV3Sdk.ApiClient.instance; let apiKey = defaultClient.authentications['api-key']; apiKey.apiKey = 'YOUR API KEY'; let apiInstance = new SibApiV3Sdk.TransactionalSMSApi(); let sendTransacSms = new SibApiV3Sdk.SendTransacSms(); sendTransacSms = { "sender":"string", "recipient":"string", "content":"string", }; apiInstance.sendTransacSms(sendTransacSms).then(function(data) { console.log('API called successfully. Returned data: ' + JSON.stringify(data)); }, function(error) { console.error(error); });
<?php require_once(__DIR__ . '/vendor/autoload.php'); $config = SendinBlue\Client\Configuration::getDefaultConfiguration()->setApiKey('api-key', 'YOUR API KEY'); $apiInstance = new SendinBlue\Client\Api\TransactionalSMSApi( new GuzzleHttp\Client(), $config ); $sendTransacSms = new \SendinBlue\Client\Model\SendTransacSms(); $sendTransacSms['sender'] = 'senderName'; $sendTransacSms['recipient'] = '+33123456789'; $sendTransacSms['content'] = 'This is a transactional SMS'; $sendTransacSms['type'] = 'transactional'; $sendTransacSms['webUrl'] = 'https://example.com/notifyUrl'; try { $result = $apiInstance->sendTransacSms($sendTransacSms); print_r($result); } catch (Exception $e) { echo 'Exception when calling TransactionalSMSApi->sendTransacSms: ', $e->getMessage(), PHP_EOL; } ?>
const SibApiV3Sdk = require('sib-api-v3-typescript'); let apiInstance = new SibApiV3Sdk.TransactionalSMSApi() let apiKey = apiInstance.authentications['apiKey']; apiKey.apiKey = 'YOUR API KEY'; let sendTransacSms = new SibApiV3Sdk.SendTransacSms(); sendTransacSms.sender = 'senderName'; sendTransacSms.recipient = '919152861500'; sendTransacSms.content = 'This is a transactional SMS'; sendTransacSms.type = 'transactional'; sendTransacSms.webUrl = 'https://example.com/notifyUrl'; apiInstance.sendTransacSms(sendTransacSms).then(function(data) { console.log('API called successfully. Returned data: ' + JSON.stringify(data)); }, function(error) { console.error(error); });
from __future__ import print_function import time import sib_api_v3_sdk from sib_api_v3_sdk.rest import ApiException from pprint import pprint configuration = sib_api_v3_sdk.Configuration() configuration.api_key['api-key'] = 'YOUR API KEY' api_instance = sib_api_v3_sdk.TransactionalSMSApi(sib_api_v3_sdk.ApiClient(configuration)) send_transac_sms = sib_api_v3_sdk.SendTransacSms(sender="string", recipient="string", content="string", type="string", web_url="https://example.com/notifyUrl") try: api_response = api_instance.send_transac_sms(send_transac_sms) pprint(api_response) except ApiException as e: print("Exception when calling TransactionalSMSApi->send_transac_sms: %s\n" % e)
using sib_api_v3_sdk.Api; using sib_api_v3_sdk.Client; using sib_api_v3_sdk.Model; using System; using System.Collections.Generic; using System.Diagnostics; namespace Sendinblue { class Program { static void Main(string[] args) { Configuration.Default.ApiKey.Add("api-key", "YOUR API KEY"); var apiInstance = new TransactionalSMSApi(); string sender = "senderName"; string recipient = "+33123456789"; string content = "This is a transactional SMS"; SendTransacSms.TypeEnum type = SendTransacSms.TypeEnum.Transactional; string tag = "testTag"; string webUrl = "https://example.com/notifyUrl"; try { var sendTransacSms = new SendTransacSms(sender, recipient, content, type, tag, webUrl); SendSms result = apiInstance.SendTransacSms(sendTransacSms); Debug.WriteLine(result.ToJson()); Console.WriteLine(result.ToJson()); Console.ReadLine(); } catch (Exception e) { Debug.WriteLine(e.Message); Console.WriteLine(e.Message); Console.ReadLine(); } } } }
# load the gem require 'sib-api-v3-sdk' # setup authorization SibApiV3Sdk.configure do |config| # Configure API key authorization: api-key config.api_key['api-key'] = 'YOUR API KEY' end api_instance = SibApiV3Sdk::TransactionalSMSApi.new send_transac_sms = SibApiV3Sdk::SendTransacSms.new # SendTransacSms | Values to send a transactional SMS send_transac_sms = { 'sender'=>'string', 'recipient'=>'string', 'content'=>'string', } begin #Send SMS message to a mobile number result = api_instance.send_transac_sms(send_transac_sms) p result rescue SibApiV3Sdk::ApiError => e puts "Exception when calling TransactionalSMSApi->send_transac_sms: #{e}" end
Body Params

Values to send a transactional SMS

string
required
length ≤ 15

Name of the sender. The number of characters is limited to 11 for alphanumeric characters and 15 for numeric characters

string
required

Mobile number to send SMS with the country code

string
required

Content of the message. If more than 160 characters long, will be sent as multiple text messages

string
Defaults to transactional

Type of the SMS. Marketing SMS messages are those sent typically with marketing content. Transactional SMS messages are sent to individuals and are triggered in response to some action, such as a sign-up, purchase, etc.

string

A tag can have two types of values, either a string or an array of strings.

url

Webhook to call for each event triggered by the message (delivered etc.)

boolean
Defaults to false

Format of the message. It indicates whether the content should be treated as unicode or not.

string

A recognizable prefix will ensure your audience knows who you are. Recommended by U.S. carriers. This will be added as your Brand Name before the message content. Prefer verifying maximum length of 160 characters including this prefix in message content to avoid multiple sending of same sms.

Responses

Language
Credentials
Click Try It! to start a request and see the response here! Or choose an example:
application/json