send_message
Send a message to ONE contact right now, outside any flow. For reaching many contacts use a broadcast instead. Target the contact with contactId (globally unique — preferred), or with platformId (the platform-side id, e.g. the Telegram user id). platformId is NOT globally unique: it is unique only per bot, so the same Telegram user talking to two of your bots is two contacts sharing one platformId. Pass botId alongside it whenever the application has more than one bot; without botId the call succeeds only if exactly one contact in the application matches, and otherwise fails listing the candidate bots. {{var|name}} placeholders in the text resolve against that contact's variable context. Requires the manage_broadcasts permission. Media: pass up to 10 attachments as publicly reachable http(s) URLs; the text becomes the caption (max 1024 characters) and may be empty. Several attachments send as one album. The kind is inferred from the URL's file extension — override with type when the URL has none. Not supported for SDK bots. Buttons: up to 8, each carrying EXACTLY ONE destination — a url (http(s) or tg://) the recipient opens, or a flowId, an already-applied INTERACTIVE flow that runs for that recipient when they tap it. The two kinds mix freely in one keyboard, so a custom text with flow-wired buttons needs no wrapper flow. A flow button starts its flow from the start block with the recipient's own variable context, and re-runs on every tap. Broadcast and operation flows are rejected, as are flow buttons on SDK bots (taps never reach the runtime there). To send a WHOLE flow as the message instead of wiring one behind a button, use send_flow_to_contacts. Buttons cannot be combined with media; send those as two messages. Delivery is asynchronous: a successful response means the bot accepted the send, not that the platform delivered it (a broken media URL surfaces in the flow logs, not here). Unsubscribed contacts are rejected. NOT idempotent and not reversible — each call sends another message to a real person, and a sent message cannot be recalled. Confirm the recipient and text with the user before calling, and never retry a timed-out call blindly.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text | No | Message body. Required unless media is passed; with media it becomes the caption (max 1024 characters) and may be omitted. `{{var|name}}` placeholders resolve against the recipient's variable context. | |
| botId | No | Bot to send from. Required in practice when targeting by platformId in a multi-bot application; without it the call succeeds only if exactly one contact matches, and otherwise fails listing the candidate bots. | |
| media | No | Up to 10 attachments. Several items send as one album with `text` as the shared caption. | |
| buttons | No | Up to 8 buttons, rendered one per row under the message. Each needs exactly one of url or flowId; the two kinds may be mixed. Rejected together with media. | |
| contactId | No | Preferred way to target the recipient: the globally unique FlowCastle contact id. Supply either this or platformId. | |
| platformId | No | Platform-side user id (e.g. the Telegram user id). NOT globally unique — unique only per bot — so pass botId alongside it when the application has more than one bot. | |
| applicationId | No | Application (workspace) id. Optional: an application-scoped key (app_...) defaults to its own application, but a personal key (usr_...) has no default and omitting it fails with MCP_APPLICATION_REQUIRED. Call list_applications to get the id. |