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:
Recipient identifier (phone number, user ID, username, etc.)
Text message content (at least one of
message, mediaUrl, or mediaUrls required)Channel ID (e.g.,
"signal", "telegram", "discord", "slack")Unique key to prevent duplicate sends
Single media attachment URL
Array of media attachment URLs
Enable GIF playback (for animated GIFs)
Account ID for multi-account channels
Thread ID for threaded messages
Session key for tracking conversation context
Whether the message was sent successfully
Platform-specific message identifier
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
TheidempotencyKey parameter ensures duplicate messages are not sent:
- Same
idempotencyKeywithin a short time window returns cached result - Prevents accidental duplicate sends
- Returns
cached: truein response metadata
Channels
Available channels depend on your configuration:| Channel | ID | Recipient Format |
|---|---|---|
| Signal | signal | Phone number (E.164): "+1234567890" |
| Telegram | telegram | User ID or username: "@username" |
| Discord | discord | User ID or channel ID |
| Slack | slack | User ID or channel ID: "#channel" |
whatsapp | Phone number (E.164) | |
| iMessage | imessage | Phone number or email |
Message Routing
OpenClaw automatically routes messages based on:- Explicit channel - Use
channelparameter - Session key prefix - Extract channel from session key (e.g.,
"signal:+1234567890") - Default channel - Use configured default channel
signal: prefix.
Polls
Send interactive polls via supported channels.Method: poll
Poll question
Array of poll options (strings)
Recipient identifier
Channel ID
Unique key for idempotency
Allow multiple selections
Hide voter identities
Error Handling
Missing recipient:Example: Send with Media
Example: JavaScript Client
Message Format
Messages support basic formatting depending on the channel: Markdown (Signal, Telegram, Discord, Slack):Best Practices
Always use idempotency keys
Always use idempotency keys
Generate unique keys to prevent duplicate sends:
Validate recipients
Validate recipients
Ensure phone numbers are in E.164 format:
Handle media URLs correctly
Handle media URLs correctly
- Use publicly accessible URLs
- Ensure HTTPS for secure content
- Check file size limits per channel
Check channel status
Check channel status
Verify channel is logged in before sending:
Next Steps
Channels
Configure messaging channels
Sessions
Manage conversation sessions
Agent Protocol
Invoke agents to generate responses

