How to Connect a Bot to Email and Gmail
Bot Libre allows a bot to be connected to email. This lets you create a bot to be your first tier of support or customer service for your business. The bot can answer common user questions and defer more difficult questions to your second tier support. Connecting a bot to email can also be used to let your bot send email notifications from scripts, such as when a user wishes to escalate an issue from live chat. Email also provides a novel way to let people interact with your bot.
You can connect a bot to any SMTP, POP3, or IMAPS email account, such as Gmail. Connecting a bot to email can allow the bot to read and reply to email messages, and can let the bot send emails from scripts. This post will show you step by step instructions on how to connect your bot to a Gmail account.
Step 1 - Create Bot
First you must create the bot that you want to connect to Gmail, or you can use one of your existing bots. To create a bot, follow the instructions here: How to create your own chat bot in 10 clicks.
Step 2 - Connect Bot to Email Account
In the admin console page of your bot click on "Email" link. This will take you to your bot's "Email" settings page.
Step 3 - Configure Email Settings
In the "Email" text input field enter the Gmail email address. In the "User" text input field enter the same email as above. In the "Password" text input field enter the password that you use to login to this email address.
A bot can be connected to an email account in two ways. The bot can either just use the email account to send messages (such as a script that escalates issues through email), or the bot can check for new messages and reply to all messages. If you want your bot to reply to new messages, enable "Reply to Email" check box. Then click save.
Upon successful user credentials authentication you should see the following message at the top of the page.
Note, if there is a problem with connecting your bot to Gmail, then at the top of the "Email" page you will see a message highlighted in red colour. At this point go to Step 5 and adjust your email settings.
Step 4 - Test your bot to email replies
In the "Test Email" text input field enter an email to which you want your bot to send a message to and click the "Test" button. At this point you should see a new "test" message appear in your email.
To test a bot's reply to any new messages in your user email account, first send a new message to [email protected] from another account. At this point your [email protected] account has a new message. Since the "Reply to Email" check box is enabled, there should be a grey "Check Email" button to the right of yellow "Disconnect" button. Click on the "Check Email" button. At this point the bot will send a reply message to the email that originates from the original message.
Note, be careful. Since the "Reply to Email" check box is enabled, the bot will reply to all the new emails coming in to the [email protected] account. How often the bot checks its messages depends on your account level. For a Bot Libre for Business account the bot will check its email about every 5 minutes. For a Basic Bot Libre account the bot will only check its email once per day.
To disconnect a bot from [email protected] account, click on the yellow "Disconnect" button. At this point your bot is no longer connected to [email protected] account and will not reply to any new messages.
Step 5 - Configuring Gmail Account Settings
By default Gmail does not allow external apps to access an email account. You must enable a few settings in Gmail to enable this.
Sign in to your Gmail account. Then click on the settings icon and choose the "See all settings" option from quick settings menu. Then select "Forwarding and POP/IMAP. Make sure "IMAP access" is enabled. Click on the "Save Changes" button at the bottom for changes to take effect.
In addition, you will need to enable 2-Step-Verification and create an "App Password" for your Gmail account. You can follow this link to do so Sign in with App Passwords.
Click on option (1) under "Create & use App Passwords" and follow the steps to enable 2-Step-Verification and create an App Password. For the "Select app" dropdown on the "App passwords" page, select the "Other (Custom name)" option and enter a name such as "Bot Libre". After generating the App Password, enter this password into the password input field from Step 3. At this point you should be able to successfully connect you bot
Your bot should now be able to send and receive emails. Please ensure your bot does not spam.
If you encountered any issues, or would like help setting up your bot please email us at [email protected] or upgrade to our Platinum service and we can build your bot for you.