Skip to main content

Sending an SMS

To send an SMS, replace the following variables in the example below:

KeyDescription
SENDLIME_API_KEYYour SendLime API key (see it on your dashboard).
SENDLIME_API_SECRETYour SendLime API secret (see it on your dashboard).
SENDLIME_BRAND_NAMEThe registered brand or purchased number.
TO_NUMBERThe phone number you are sending the message to.
info

HTTP requests to the API are protected with HTTP Basic authentication.

User your API Key as the username and your API Secret as the password for HTTP Basic authentication.

Write the code

Add the following to send-sms.sh:

curl -X "POST" "https://brain.sendlime.com/sms" \
-d "from=$SENDLIME_BRAND_NAME" \
-d "text=A text message sent using the SendLime API" \
-d "to=$TO_NUMBER" \
-u $SENDLIME_API_KEY:$SENDLIME_API_SECRET
info

If you don't have any approved brand or any purchased number, you don't need to pass from. We will send the SMS from a random number.

Run your code

Save this file to your machine and run it:

sh send-sms.sh

Try it out

When you run the example above, the text message will be sent to the mobile number that you specified.

caution

As per the BTRC guidelines, promotional messages have to be in Bangla.