Skip to main content
In this tutorial, you’ll build a simple but real-world flow that (1) fetches order data from an API via the HTTP Request action, and (2) sends an email confirmation to the user with the Send Email action. By the end, your agent will automatically collect the user’s email and order number, call your API to verify and fetch the order, and deliver a personalized confirmation email. Send Email action preview

Setup Guide

  1. Open your agent dashboard and go to Actions.
  2. Click the New button and choose HTTP Request.
  3. Set up the action as follows:
Action name: get_order When to use: When user asks to get an email of their order confirmation, first use this action to fetch the order before using email_order_confirmation. Frequency: Whenever applicable Input parameters: Add the parameters that are required to fetch the user’s order. In this case, we will add the following parameters:
  • email: The email address of the order. Save it to a variable, such as “email”.
  • order_number: The user’s order number. Save it to a variable, such as “order_number”.
input parameters Request: Configure the request by defining the API URL, method, payload, and headers that will be used to fetch the user’s order. For this tutorial, we’ll use a dummy API that returns an order. However, in a real app, you’d point the HTTP Request to your own or third-party API, include auth (e.g., Bearer token), and the relevant payload such as the user’s email and order number. HTTP Request configuration
  1. Click the Test Request button to verify that the request runs successfully and that the agent receives a valid JSON response.
test http request
  1. Click Create action to save the action.
  2. Go back to the Actions page.
  3. Click the New button and choose Send Email.
  4. Set up the action as follows:
Action name: email_order_confirmation When to use: Use this action to send the order confirmation to the user. First use the get_order action to get the user’s order, then use this action to email the order confirmation to the user. Frequency: Whenever applicable Input parameters: We’ll add the following parameters that are required to send the email:
  • email:
    • Description: The email address where the order confirmation should be sent.
    • Save to variable: email
  • order_number:
    • Description: The order number of the user’s order.
    • Save to variable: order_number
  • order_details:
    • Description: The details of the order that you retrieve from the get_order action. Format it as HTML with bullet points.
    • Save to variable: order_details
input parameters Email Setup: configure the email as follows:
  • Sender name: A name of your choice, for example Apple
  • To: Type in {{email}} and press Enter to use the email address of the user.
  • Subject: Order confirmation for #{{order_number}}
  • Message:
Hi there!

As requested, here is your confirmation for order #​{{order_number}}​:

​{{order_details}}​
email setup
  1. Click the Create action button to save the action.

Test the actions

Now that you’ve set up the actions, it’s time to test them. From the Actions page, enable both the actions. Go to the Playground page to start a chat with your agent. Ask the agent to email your order confirmation. It should fetch the order details from the API and email the order confirmation to the email address you specify. Here’s an example of how the agent would respond: Send Email action preview
I