🆕Gmail

Lean how to integrate Gmail to your chatbot with an Action block.

This guide explains how to enhance your chatbot by integrating Gmail for sending emails, making it a versatile tool for communication and automation.

The Gmail feature shouldn't be confused with the Send mail Action step, which allows you to send emails that are Chatlayer-branded. With the Gmail integration, you can send emails directly from your own Gmail account.

Add Gmail Action to your flow

  1. Within your chatbot's workflow, locate and add a new Action block.

  2. Choose Integrations from the options available and then select the Gmail app.

  1. You will be presented with an Action field. Select Send Email to proceed.

Configure your Gmail account

  1. In the Gmail account section, click on Connect new account to connect your account.

  1. Follow the on-screen instructions to authorize your chatbot to access the Gmail account. This process may require you to log in to your Gmail account and grant specific permissions.

Compose your Email

  1. In the Action fields, locate the To input field to specify the recipient(s) of the email. There are 2 possibilities:

    • If your bot has already collected the user's email address and saved it in a variable (e.g., {userEmailAddress}), you can use this variable directly.

    • Alternatively, you can manually type the email addresses of the recipients, separating multiple addresses with commas.

  1. In the Subject field, personalize the email subject based on the interaction context. For instance, if you're sending a gym class booking confirmation, use the variable {className} to dynamically insert the class name. An example subject could be 🧘‍♂️Your {className} Class Booking Confirmation.

  1. Compose the body of your email in the Email content field. Use variables to personalize the email content with information collected by the bot, such as booking details for a gym class.

Handling the response

  1. Specify a destination variable name where the response from Gmail will be stored. This is useful for tracking the success or failure of the email sending operation.

  2. Optionally, select a block to handle situations where the operation fails, allowing for graceful error handling within your chatbot flow. For instance, in this example, we used the Error occurred block.

  1. After completing the setup and configuration, ensure to click Save to apply your changes.

By following these detailed steps, you can empower your chatbot with the ability to send emails via Gmail, enhancing its utility and your users' experience.

Last updated