send_outbound_email
Send an outbound email that creates a new handed-off conversation.
send_outbound_email(context: dict, params: dict) -> dictSends an outbound email from the business and creates a new conversation that is already handed off (the bot will not respond to it).
Parameters
| Name | Type | Description |
|---|---|---|
context | dict | The context object passed to your action |
params | dict | Email parameters (see below) |
params keys:
| Key | Type | Required | Description |
|---|---|---|---|
to | str | Yes | Recipient email address |
subject | str | Yes | Email subject line |
text | str | Yes | Plain-text body of the email |
customer_name | str | No | Recipient name |
tags | list[str] | No | Tags to attach to the created conversation |
Returns
dict — {"success": bool, "conversationId": str, "publicId": str}
Prerequisites
The business must have an email integration configured.
Examples
Notify a team about a flagged order
def execute_action(context):
order_id = context["args"]["orderId"]
send_outbound_email(context, {
"to": "[email protected]",
"subject": f"Flagged order {order_id}",
"text": f"Order {order_id} was flagged for manual review during a chatbot conversation.",
"tags": ["escalation", "flagged-order"],
})
return {"success": True, "message": "The team has been notified."}Send a confirmation email to the customer
def execute_action(context):
email = context["args"]["email"]
name = context["args"].get("name")
send_outbound_email(context, {
"to": email,
"subject": "Your request has been received",
"text": "We've received your request and will get back to you within 24 hours.",
"customer_name": name,
})
return {"success": True}