Send Message • AI Agent SDK

send_message: Send a message to a channel.

send_message

Async

Method

</div>

This is a method of the BotProtocol class in the protocols module.

Send a message to a channel.

Signature

python
async def send_message(channel_id: str, content: Union[str, Dict[str, Any]], reply_to: Optional[str], thread_id: Optional[str]) -> Union[BotMessage, 'SendResult']

Parameters

ParamField str

Target channel ID

ParamField Union

Message content

ParamField Optional[str]

Optional message ID to reply to

ParamField Optional[str]

Optional thread ID for threaded replies

Returns

ResponseField Union[BotMessage, 'SendResult']

class:~praisonaiagents.bots.SendResult — the transport-neutral receipt that carries a closed, branchable `status ("sent" / "failed" / "queued" / "duplicate"), the platform message_id/message_ids (for edit-in-place, delete and threading), and a classified error/error_kind on failure. This makes a silent drop unrepresentable: a caller can branch on result.status` instead of relying on an exception that may be swallowed.

A legacy :class:BotMessage remains an accepted return for backward compatibility — treat a returned `BotMessage as a successful send (status == "sent"`).

Source

View on GitHub

praisonaiagents/bots/protocols.py at line 1113