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 differ more difficult questions to your second tier support. Connecting a bot to email can also be used to let your bot send email notification from scripting, 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 email from scripting. 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 message to and click "Test" button. At this point you should see a new "test" message appear in your email.
To test bot's reply to any new messages in your user email account, first send a new message to email@example.com account from another account. At this point your firstname.lastname@example.org account has a new message. Since the "Reply to Email" check box is enabled there should be grey "Check Email" button to the right of yellow "Disconnect" button. Click on "Check Email" button. At this point the bot will send a reply message to an email that originated the original message.
Note, be careful. Since the "Reply to Email" check box is enabled, the bot will reply to all the new email coming in to the email@example.com account. How often the bot checks it 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 firstname.lastname@example.org account, click on yellow "Disconnect" button. At this point your bot is no longer connected to email@example.com 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 you gmail account. Then click on settings icon and choose settings from the drop down. Then select "Forwarding and POP/IMAP. Make sure "IMAP access" is enabled. Click on "Save Changes" button at the bottom for changes to take effect.
In addition, make sure that you gmail account has "Less Secure Apps" option enabled. For this follow this link Less secure apps access.
Click on option (1) under Turn off "Less secure app access" and click the button to enable it as shown in the image below. At this point you should successfully connect you bot firstname.lastname@example.org account by clicking on "Save" button once again.
Your bot should now be able to send and receive email. Please ensure your bot does not spam.