send_outbound_email
Email a customer from the business and track the thread as a new help desk conversation.
send_outbound_email(context: dict, params: dict) -> dictSends an email from the business and creates a new conversation for it in the help desk. The conversation starts handed off, so the bot does not respond to it and your team handles any reply.
To send a one-off email that is not customer communication, such as forwarding a request to an internal team, use send_transactional_email: it creates no conversation.
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 |
inbox_id | str | No | Inbox to send from; defaults to the primary inbox |
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.
Each email counts against the organization's outbound email limit of 2,500 per UTC hour and 10,000 per UTC day, shared with every other outbound send. Over the limit the call raises an error and nothing is sent.
Examples
Notify a team about a flagged order
def execute_action(context):
order_id = context["args"]["orderId"]
send_outbound_email(context, {
"to": "support-escalations@example.com",
"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}