Skip to content
  • Auto
  • Light
  • Dark
Get Started

Send

Send a message
client.messages.send(MessageSendParamsbody, RequestOptionsoptions?): account_emailstringcontentstringdate_createdstringdate_updatedstringerror_codenumbererror_messagestringfrom_numberstringis_outboundbooleanmedia_urlstringmessage_handlestringnumberstringsend_styleunionstatusunionMessageResponse
post/api/send-message

Send an iMessage, SMS, or MMS to a single recipient

Parameters
bodycontentstringfrom_numberstringnumberstringmedia_urlstringsend_styleunionstatus_callbackstringMessageSendParams
Hide ParametersShow Parameters
contentstring

Message text content

maxLength18996
from_numberstring

REQUIRED - The phone number to send from. Must be one of your registered Sendblue phone numbers in E.164 format. Without this parameter, the message will fail to send.

numberstring

Recipient phone number in E.164 format

media_urlstring
optional

URL of media file to send (images, videos, etc.)

formaturi
send_styleunion
optional
"celebration" | "shooting_star" | "fireworks" | 10 more

The iMessage expressive message style

Hide ParametersShow Parameters
"celebration"
"shooting_star"
"fireworks"
"lasers"
"love"
"confetti"
"balloons"
"spotlight"
"echo"
"invisible"
"gentle"
"loud"
"slam"
status_callbackstring
optional

Webhook URL for message status updates

formaturi
Returns
account_emailstringcontentstringdate_createdstringdate_updatedstringerror_codenumbererror_messagestringfrom_numberstringis_outboundbooleanmedia_urlstringmessage_handlestringnumberstringsend_styleunionstatusunionMessageResponse
import SendblueAPI from 'sendblue';

const client = new SendblueAPI({
  apiKey: 'My API Key',
  apiSecret: 'My API Secret',
});

const messageResponse = await client.messages.send({
  content: 'Hello, World!',
  from_number: '+19998887777',
  number: '+19998887777',
});

console.log(messageResponse.account_email);
200 Example
{
  "account_email": "[email protected]",
  "content": "Hello, World!",
  "date_created": "2023-10-01T12:00:00Z",
  "date_updated": "2023-10-01T12:00:01Z",
  "error_code": 0,
  "error_message": "error_message",
  "from_number": "+19998887777",
  "is_outbound": true,
  "media_url": "https://cdn.sendblue.co/media/abc123.jpg",
  "message_handle": "msg_abc123def456",
  "number": "+18887776666",
  "send_style": "celebration",
  "status": "QUEUED"
}