Introduction:
In this article, we explain everything regarding the email action in OBI Bots. For example, you can find explanations on how to configure an email account, how to ask a chatbot user for an email address, and how to add an email address to your chatbot.
Configuring an e-mail account:
With the e-mail action, you can let your chatbot send e-mails in certain points in your conversation. To make this work, you'll need an e-mail account and the details of your mail provider's SMTP server.
You can use any mail account, as long as the provider has enabled the SMTP-server for outgoing e-mail.
To configure your e-mail in OBI Bots:
- Step 1: Go to Build > Actions > E-mail.
- Step 2: Enter your host's SMTP server name, the mail address from which e-mails are sent and the SMTP port number through which the mail should be sent (standard ports are 25, 465 or 587, check your provider for the exact host name and port number).
- Step 3: Enter user name and password for the mail account that you specified in the Sender field.
- Step 4: Select which safety protocol OBI Bots should use for sending your mail (check your provider on whether this should be TLS or SSL).
- Step 6: Save your e-mail configuration.
Common SMTP setttings:
Field | Gmail | Office365 |
Host | smtp.gmail.com | smtp.office365.com |
Sender | This is your Gmail or Gsuite email address. | This is your Office365 email address. |
Port | 587 | 587 |
User | This is your Gmail or Gsuite email address. | This is your Office365 email address. |
Password | The password of your Gmail or Gsuite email. | The password of your Office365 email. |
UseTls | On | On |
UseSsl | Off | Off |
Google by default disables the use of smtp. If you want to use that, go to this Google page and allow less secure apps: https://myaccount.google.com/lesssecureapps
Asking your user for their e-mail:
Before you can send an e-mail to your user, you'll first need to capture their e-mail adress. Let's use an example 'order status' to have your bot ask for the user's e-mail, so that they can send a mail message with the order information.
First, make sure that there's an entity for e-mail, like mail.address. If you don't have one yet, create one first.
-
Step 1: Create a user intent 'system.status' so that your user can ask for the order status.
- Step 2: Create a bot question 'Great, what's your mail address?' to capture your user's e-mail. To do so, we need an entity for e-mail, like system.email. If you don't have an entity for this yet, you can create one by simply typing an entity name in the Entity field.
- Step 3: Create a user turn where the user can enter their e-mail. Select the e-mail entity, and select the option 'Save user message'.
-
Step 4: Create a bot reply to confirm the user's e-mail. Use the variable {{system.email}} (or the name of your own entity for e-mail) to show the mail address that your user entered.
Adding e-mail to your chatbot:
Once you have asked for the email address of the chatbot user, the next step is to add an email action in the dialog.
In your conversation, select the point where you want your bot to send an e-mail to your user. Add an Action turn and select action type 'Send Email'.
In the email recipient, you can either enter:
- Your own email address, if you are the recipient of the mail. This can be a constant value, in this case just complete email@address.com. This will be used if you want to receive a reminder of the conversation for your own administration or ticketing service.
- The email address of the user, which would have been collected prior in the conversation. If you used the default entities in the platform, you most likely would have used the following entity: {{system.mail}}. This will be used if you want to send some additional information to the user by email, like a confirmation.
When setting up the email action turn, enter the following information:
- Email Recipient: The e-mail address to which the mail will be sent.
- Subject: the subject line of your e-mail
- Email body: the message text. Here too, you can use information that you retrieved earlier in your conversation. Simply insert the entities between curly brackets, and the retrieved values will automatically be inserted.
The slots in your mail message will only be filled when your chatbot has actually recognised and stored values for these slots. If no values can be found, your user will see the empty slots with curly brackets instead.
Example: Google
Google by default disables the use of smtp. If you want to use that, go to this Google page and allow less secure apps:https://myaccount.google.com/lesssecureapps
- In Host type 'smtp.gmail.com '
- In Sender type the email
- In Port type '587'
- In User type the same mail address as in the Sender field
Example: Google met 2FA
if you don't turn off 2-factor authentication and don't allow less secure apps then :
Check the settings in your Gmail account:
-
Settings
-
Advanced settings
-
Forwarding and POP/IMAP
-
Select Enable IMAP
-
Save
- Open your google account
- Select 'Security'
- Click on the '2-Step Verification' (confirm password)
- Select 'App-password'
- Type the name in the field and click on the 'Create' button
- Copy the password
- Paste the password in the OBI Bots, on the email configuration page.
- Click on the 'SAVE' button -> Success message is visible!