Skip to content
  • Auto
  • Light
  • Dark
Get Started

Send Message

Send a group message
client.groups.sendMessage(GroupSendMessageParams { content, from_number, group_id, 2 more } body, RequestOptionsoptions?): MessageResponse { account_email, content, date_created, 10 more }
post/api/send-group-message

Send a message to a group of recipients (beta feature)

ParametersExpand Collapse
body: GroupSendMessageParams { content, from_number, group_id, 2 more }
content: string

Message text content

from_number: string

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.

group_id?: string

Unique identifier for an existing group

media_url?: string

URL of media file to send

formaturi
numbers?: Array<string>

Array of recipient phone numbers in E.164 format

ReturnsExpand Collapse
MessageResponse { account_email, content, date_created, 10 more }
account_email?: string

Email of the account that sent the message

content?: string

Message content

date_created?: string

When the message was created

formatdate-time
date_updated?: string

When the message was last updated

formatdate-time
error_code?: number

Numeric error code if message failed

error_message?: string

Error message if message failed

from_number?: string

Sending phone number

is_outbound?: boolean

Whether this is an outbound message

media_url?: string

URL of attached media

message_handle?: string

Unique identifier for tracking the message

number?: string

Recipient phone number

send_style?: "celebration" | "shooting_star" | "fireworks" | 10 more

The iMessage expressive message style

Accepts one of the following:
"celebration"
"shooting_star"
"fireworks"
"lasers"
"love"
"confetti"
"balloons"
"spotlight"
"echo"
"invisible"
"gentle"
"loud"
"slam"
status?: "QUEUED" | "SENT" | "DELIVERED" | 2 more
Accepts one of the following:
"QUEUED"
"SENT"
"DELIVERED"
"READ"
"ERROR"
Send a group message
import SendblueAPI from 'sendblue';

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

const messageResponse = await client.groups.sendMessage({
  content: 'Hello, everyone!',
  from_number: '+19998887777',
});

console.log(messageResponse.account_email);
{
  "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"
}
Returns Examples
{
  "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"
}