Skip to main content

Messages API

The Messages API allows you to send messages via configured messaging channels (Signal, Telegram, Discord, etc.).

Send Message

Send a message to a recipient via a messaging channel.

Method: send

Request:
string
required
Recipient identifier (phone number, user ID, username, etc.)
string
Text message content (at least one of message, mediaUrl, or mediaUrls required)
string
Channel ID (e.g., "signal", "telegram", "discord", "slack")
string
required
Unique key to prevent duplicate sends
string
Single media attachment URL
array
Array of media attachment URLs
boolean
default:false
Enable GIF playback (for animated GIFs)
string
Account ID for multi-account channels
string
Thread ID for threaded messages
string
Session key for tracking conversation context
Response:
boolean
Whether the message was sent successfully
string
Platform-specific message identifier
boolean
Whether the response was cached (idempotency)

Send Message with Media

Send messages with image, video, or document attachments.

Single Media Attachment

Multiple Media Attachments

Media-Only Message

Idempotency

The idempotencyKey parameter ensures duplicate messages are not sent:
  • Same idempotencyKey within a short time window returns cached result
  • Prevents accidental duplicate sends
  • Returns cached: true in response metadata
Example cached response:

Channels

Available channels depend on your configuration: See Channels for configuration details.

Message Routing

OpenClaw automatically routes messages based on:
  1. Explicit channel - Use channel parameter
  2. Session key prefix - Extract channel from session key (e.g., "signal:+1234567890")
  3. Default channel - Use configured default channel
Example with session key routing:
Channel is inferred from signal: prefix.

Polls

Send interactive polls via supported channels.

Method: poll

string
required
Poll question
array
required
Array of poll options (strings)
string
required
Recipient identifier
string
Channel ID
string
required
Unique key for idempotency
boolean
default:false
Allow multiple selections
boolean
default:false
Hide voter identities

Error Handling

Missing recipient:
Channel not configured:
Delivery failed:

Example: Send with Media

Example: JavaScript Client

Message Format

Messages support basic formatting depending on the channel: Markdown (Signal, Telegram, Discord, Slack):
Mentions:
Emojis:
Formatting support varies by channel. See individual channel documentation.

Best Practices

Generate unique keys to prevent duplicate sends:
Ensure phone numbers are in E.164 format:
  • Use publicly accessible URLs
  • Ensure HTTPS for secure content
  • Check file size limits per channel
Verify channel is logged in before sending:

Next Steps

Channels

Configure messaging channels

Sessions

Manage conversation sessions

Agent Protocol

Invoke agents to generate responses