Skip to content
  • Auto
  • Light
  • Dark
Get Started

Send

Send a message
messages.send(MessageSendParams**kwargs) -> MessageResponse
post/api/send-message

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

ParametersExpand Collapse
content: str

Message text content

maxLength18996
from_number: str

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.

number: str

Recipient phone number in E.164 format

media_url: Optional[str]

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

formaturi
send_style: Optional[Literal["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_callback: Optional[str]

Webhook URL for message status updates

formaturi
ReturnsExpand Collapse
class MessageResponse:
account_email: Optional[str]

Email of the account that sent the message

content: Optional[str]

Message content

date_created: Optional[datetime]

When the message was created

formatdate-time
date_updated: Optional[datetime]

When the message was last updated

formatdate-time
error_code: Optional[int]

Numeric error code if message failed

error_message: Optional[str]

Error message if message failed

from_number: Optional[str]

Sending phone number

is_outbound: Optional[bool]

Whether this is an outbound message

media_url: Optional[str]

URL of attached media

message_handle: Optional[str]

Unique identifier for tracking the message

number: Optional[str]

Recipient phone number

send_style: Optional[Literal["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: Optional[Literal["QUEUED", "SENT", "DELIVERED", 2 more]]
Accepts one of the following:
"QUEUED"
"SENT"
"DELIVERED"
"READ"
"ERROR"
Send a message
from sendblue_api import SendblueAPI

client = SendblueAPI(
    api_key="My API Key",
    api_secret="My API Secret",
)
message_response = client.messages.send(
    content="Hello, World!",
    from_number="+19998887777",
    number="+19998887777",
)
print(message_response.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"
}