1. Teleboard | Support Center
  2. Solution home
  3. API Documentation
  4. REST API - POST Requests
Open navigation

POST/send/sms


Usage


The Post/send/sms request allows you to use your Telebroad account to send an SMS message to a recipient with a mobile phone, another Telebroad account, or a VoIP line that supports SMS messaging.


Parameters


There are no parameters in the header. All parameters go in the body in JSON Raw format.


Basic parameters


ParameterTypeFunction
sms_linestringThe user's SMS line that will be used for sending the message.

You can get this from the GET/myProfile request.
receiverstringThe number of the intended recipient of the message.

Use a valid North American number format including the '1' country code.

Short numbers are not supported and international numbers cannot be used.
msgdatastringThe text content of the SMS message.

Additional MMS parameters

Use these additional parameters to send a file attachment as a multimedia message.


The main parameter to add multimedia functionality to the message is "media". It is a JSON array that contains all the other relevant parameters for the message.

ParameterTypeFunction
mediaarrayA JSON array containing the other relevant multimedia parameters. 
mimetype
(type can also be used)
stringThe type and format of media sent with the message. For example a JPEG image or a WAV audio file.

The syntax is image/png,  audio/wav, video/mp4, application/pdf, etc.

Although this is also included in the base64 information for image files, without this parameter the preview of the message on the recipient's side may not display properly.
namestringThe name of the file attached to the MMS message.
icon (optional)stringAn icon to identify the attached file.

If the recipient is a VoIP number the icon might not show.

Possible values:

image the icon will look like the attached image file itself. Use this for image attachments.

insert_drive_file the icon will be a general "download file icon" -> . Use this for any other file attachments other than images.

If the parameter is not included in the request, the message preview on the recipient's side may not display properly but he can still retrieve the content itself.
size(optional)stringYou can indicate the size of the attached file in Bytes, KB, or MB.

If the recipient is a VoIP number the size might now show.

It is helpful to let the receiver know how big the file is before he downloads it.
Value

or

compressed
stringThe data for the MMS message encoded as base64 format text string.

Use compressed for image attachments. This also includes the type and format of the media (same as "type") with this syntax - data:image/png;base64,

Use value for all other file types. You don't have to include the ;base64 syntax here.

Converting a file to base64 can be easily done with one of many online converters, such as this one. After performing the conversion simply copy and paste the resulting string into the data field. Note that the resulting string may be many pages long, especially for a PDF file.

Examples


Basic SMS


To send the SMS message "Hello world" from SMS line 1-646-702-4430 to 1-323-444-7299 use this syntax:


HTTPS method: POST


Header


webserv.telebroad.com/api/teleconsole/rest/send/sms


Body


{"sms_line":16467024430,"receiver":13234447299,"msgdata":"Hello world"}


Response:


See below.


MMS Message


To send an image and a messages saying "The data you requested" from SMS line 1-646-702-4430 to 1-323-444-7299 use this syntax:


HTTPS method: POST


Header

webserv.telebroad.com/api/teleconsole/rest/send/sms


Body


{"sms_line":16467024430,"receiver":13234447299,"msgdata":"The data you requested","media":"[{\"name\":\"info.png\",\"size\":\"23.7KB\",\"icon\":\"image\",

\"value\":\"iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAclBMVEX///8AAADJycnj4+PS0tLn5+fZ

2dnCwsJkZGRPT0/5+fmgoKCWlpYyMjJDQ0OlpaWFhYUiIiKysrJ2dnZKSkqNjY1qampycnLz8/NfX19tbW25ubnm5uYa

GhpaWlqtra0MDAw7OzstLS0dHR0SEhKJiYmGEUCgAAAEZ0lEQVR4nO2d63aqMBBGEbxUxYq2Wmw9Kra+/yseE7BLlNGE

pMmE9e1fijjMhoSwICRRBAAAAAAAAADAhHzAHxO9/eZfjz/r1oJT36mr0lIxf/eduDqbVoIL32nr8NLC8LX869t+ZEpx

DrOLjcPU2IvcTuJT/Cnz1C+oZR3MJi32zS2itL9ZiHNNIrJblp/XrRRz+a+9lWz+2jAqj6JmXZzLUmAnmz83jD5aHMWd

+IuNIhq5MIz062J+EJXQUjYODKu6qHFGHdwEMMKFYVVQ1RVlgNhSNjYM57tNybj8fmeoWxeHYu2+YVYXbBieftv28vu9

oWajwc5w9dywUlRsNII01CqoYRrqKAZqqNFohGqofgEXrKFyQQ3XUPUCLmDDqi4+u1wJ2bAsqJ02HHTeUOmiGoZawFAF

GF4DQwkMtYChCjC8BoYSGGoBQxVgeE2YhlnnDYe/z7fL77wMX86xdpZiXZAJfjX/5t5Q3DdZWIp1IX5g4d5wajNYhbzb

RDyjdm8otzi2FEwhpHvDsmvO3FY0geyuRfUU8WAoK01vaitcNJG7bEb97MEw2kjFYpnnE2PypGr9R5wMJ7Oquf5ZGHNp

+VNyaz4Mo7zoWWZFb8yLYRS9WfU7EI29T8NouLbW3bhIH/bW8mV4LqrxfJUZky6HT7bjz9AVMJTAkDUwlMCQNTCUwJA1

MJTAkDUwlMCQNTCUwJA1MJTAkDUwlDwwnMTp6YUB61U6bL4xbGY4yA70vWjnHKdNjkaGe79G93w3JGlimD3enBfuu5wY

GKZV0GLMgcszybsnpe0NRzLgz9xkxBuLTLbVw+DbfNobysev49xikqYk3yKlj9ulbQ2XYtm7zQTNyX9EUkl9YWvDXVOJ

8M2XSOqml0dbQ7m72gx087eIRF/ri9oaPuor5xFxtjnW2/22hv3GBsQ7YpiZQ73utDUccayG1UA6MGwAhnyAIQUM+QBD

ChjyAYYUMOQDDClgyAcYUsCQDy4MV8WrG4qm92RcGNp9G+YRTS8Tw9CG4Yczw9sHFK4Mv1JXNN2PxrmUAoZ8gCEFDPkA

QwoY8gGGFDDkAwwpYMgHGFLoGCZ9VyQNW3dhWA7V74JPT4bdvxPVfcPul1Lz4buU8WToFxhSwJAPMKSAIR9gSAFDPsCQ

AoZ8gCGFjuFo6oqmsZHR28SGYffvYnTfMDvO3HBsmuwd51IKGPIBhhQw5AMMKWDIBxhSwJAPMKSAIR9gSAFDPsCQAoZ8

gCEFDPkAQwoY8gGGFN03TDpvOBAr1UfKDsdQTrDc9ObCNblY6VRbFI7hVCnT8Xmlf7V+1eEYFuclxcPZZgVyP9TGWA7G

UI7K3fS4uM62d1tdQzGUzUDv2Yy6UTnGcm3K9zgMQ3kEG9/MuGVSTvE9S/uJZCsnfoi3CS8G6XVa/amcV753eFoLBWU5

DROFMipIFs9DseSgKHguqO76AtnkU2f2hiQrfOerySxTPoCX4zhI4nBIBkqnGAAAAAAAAAAAFP8BAuSGXB+mifYAAAAA

SUVORK5CYII=\"}]"}


Responses and Errors


The message was sent successfully.

It is not possible to verify if the receiving number can accept SMS/MMS messages. As long as the message had been sent out no errors will be reported.

{

"error": null,

"result": true

}


There was a problem sending the message:

{

"error":{

"code": 444,

"message": "Failed to send message

}

There was a problem with the base64 text string. Because there is a checksum verification, it is enough that even one character in the string is missing or wrong for an error to be generated.

Try encoding the base64 data again and copy-paste it into the request.

"error": { "code": 444, 

"message": "Failed to send message: Malformed attachment" } }



Check that you entered the correct numbers for the user's SMS line and the recipient. Make sure both numbers are correct and have the '1' country code.

 Note that you may get this message even if both numbers are correct but there is an error with the syntax or format of the request (like a redundant double quotes or curly brackets) that prevent the request from reading the numbers. 

{

  "error": {

    "code": 444,

    "message": "Invalid SMS Line"

  }

}


or


error: { code: 400, 
message: sms_line is required, receiver is required. } 
}