Chatwoot/docs/development/project-setup/conversation-continuity.md

63 lines
3.9 KiB
Markdown
Raw Normal View History

Feature: Conversation Continuity with Email (#770) * Added POC for mail inbox reply email * created mailbox and migratuion for the same * cleaned up sidekiq queues and added the queues for action mailbox and active storage * created conversation mailbox and functionlaity to create a message on the conversation when it's replied * Added UUID to conversation to be used in email replies * added migration to add uuid for conversation * changed parsing and resource fetching to reflect matching uuid and loading conversation alone * cleaned up conversation mailbox.rb * Added content type & attribute for message * Added the new reply email to outgoing emails * Added migration to accounts for adding domain and settings * Modified seeds to reflect this changes * Added the flag based column on account for boolean settings * Added the new reply to email in outgoing conversation emails based on conditions * Added dynamic email routing in application mailbox * Added dynamic email routing in application mailbox * Added a catch all deafult empty mailbox * Added annotation for account * Added the complete email details & attachments to the message * Added the complete email details to the message in content_attributes, like subject, to, cc, bcc etc * Modified the mail extractor to give a serilaized version of email * Handled storing attachments of email on the message * Added incoming email settings, env variables * [#138] Added documentation regarding different email settings and variables * Fixed the mail attachments blob issue (#138) * Decoided attachments were strings and had to construct blobs out fo them to work with active storage * Fixed the content encoding issue with mail body * Fixed issue with Proc used in apllication mailbox routing * Fixed couple of typos and silly mistakes * Set appropriate from email for conversation reply mails (#138) * From email was taken from a env variable, changed it to take from account settings if enabled * Set the reply to email correctly based on conversation UUID * Added commented config ind development.rb for mailbox ingress * Added account settings for domain and support email (#138) * Added the new attributes in accounts controller params whitelisting, api responses * Added options for the the new fields in account settings * Fixed typos in email continuity docs and warnings * Added specs for conversation reply mailer changes (#138) * Added specs for * conversation reply mailer * Accounts controller * Account and Conversation models * Added tests for email presenter (#138) * Specs for inbound email routing and mailboxes (#138)
2020-04-30 14:50:26 +00:00
---
path: "/docs/conversation-continuity"
title: "Configuring Conversation Continuity with Email"
---
### Conversation continuity
Conversation continuity is a de-facto most expected feature for all kind of support platforms. When we support multiple channels and integrations it becomes really difficult to implement this from the start. As for Chatwoot, with Facebook or Twitter channels, the users usually expect you to reach back on the same platform itself.
When it comes to the Web Widget which is embedded in a website, this is not the case. There are technical limitations for us to maintain this conversation continuity. When an end-user initiates the chat from the Web Widget and an agent is not online, there are questions on how you reach back to that user and how a conversation can progress.
As a first step what we did for this was to capture the email of the user when the chat is initiated. The chat window prompts the user for an email when the user starts a conversation. This is captured in the system as part of the contact's information. The agent can reach back to the user using this given email, but until now the replies used to come back to the agent's email address directly and not Chatwoot.
With a second step that we have done, we are now introducing the capability of conversation continuity directly in Chatwoot Inbox. How this works is, once you have configured all the email settings (which will be discussed shortly in the upcoming sections below), you can send a reply as an email to any of the conversations with a contact having an email and receive the email reply in the conversation thread. This is irrespective of the channel from where the conversation was first initiated. It can be Facebook, Twitter, Web Widget, Twilio, Whatsapp and what not. You conversation always continues seamlessly.
### Configuring inbound reply emails
There are a couple of email infrastructure service providers to handle the incoming emails that we support at the moment. They are
Sendgrid, Mandrill, Mailgun, Exim, Postfix, Qmail and Postmark.
Step 1 : We have to set the inbound email service used as an environment variable.
Feature: Conversation Continuity with Email (#770) * Added POC for mail inbox reply email * created mailbox and migratuion for the same * cleaned up sidekiq queues and added the queues for action mailbox and active storage * created conversation mailbox and functionlaity to create a message on the conversation when it's replied * Added UUID to conversation to be used in email replies * added migration to add uuid for conversation * changed parsing and resource fetching to reflect matching uuid and loading conversation alone * cleaned up conversation mailbox.rb * Added content type & attribute for message * Added the new reply email to outgoing emails * Added migration to accounts for adding domain and settings * Modified seeds to reflect this changes * Added the flag based column on account for boolean settings * Added the new reply to email in outgoing conversation emails based on conditions * Added dynamic email routing in application mailbox * Added dynamic email routing in application mailbox * Added a catch all deafult empty mailbox * Added annotation for account * Added the complete email details & attachments to the message * Added the complete email details to the message in content_attributes, like subject, to, cc, bcc etc * Modified the mail extractor to give a serilaized version of email * Handled storing attachments of email on the message * Added incoming email settings, env variables * [#138] Added documentation regarding different email settings and variables * Fixed the mail attachments blob issue (#138) * Decoided attachments were strings and had to construct blobs out fo them to work with active storage * Fixed the content encoding issue with mail body * Fixed issue with Proc used in apllication mailbox routing * Fixed couple of typos and silly mistakes * Set appropriate from email for conversation reply mails (#138) * From email was taken from a env variable, changed it to take from account settings if enabled * Set the reply to email correctly based on conversation UUID * Added commented config ind development.rb for mailbox ingress * Added account settings for domain and support email (#138) * Added the new attributes in accounts controller params whitelisting, api responses * Added options for the the new fields in account settings * Fixed typos in email continuity docs and warnings * Added specs for conversation reply mailer changes (#138) * Added specs for * conversation reply mailer * Accounts controller * Account and Conversation models * Added tests for email presenter (#138) * Specs for inbound email routing and mailboxes (#138)
2020-04-30 14:50:26 +00:00
```bash
# Set this to appropriate ingress service for which the options are :
# "relay" for Exim, Postfix, Qmail
# "mailgun" for Mailgun
# "mandrill" for Mandrill
# "postmark" for Postmark
# "sendgrid" for Sendgrid
RAILS_INBOUND_EMAIL_SERVICE=relay
Feature: Conversation Continuity with Email (#770) * Added POC for mail inbox reply email * created mailbox and migratuion for the same * cleaned up sidekiq queues and added the queues for action mailbox and active storage * created conversation mailbox and functionlaity to create a message on the conversation when it's replied * Added UUID to conversation to be used in email replies * added migration to add uuid for conversation * changed parsing and resource fetching to reflect matching uuid and loading conversation alone * cleaned up conversation mailbox.rb * Added content type & attribute for message * Added the new reply email to outgoing emails * Added migration to accounts for adding domain and settings * Modified seeds to reflect this changes * Added the flag based column on account for boolean settings * Added the new reply to email in outgoing conversation emails based on conditions * Added dynamic email routing in application mailbox * Added dynamic email routing in application mailbox * Added a catch all deafult empty mailbox * Added annotation for account * Added the complete email details & attachments to the message * Added the complete email details to the message in content_attributes, like subject, to, cc, bcc etc * Modified the mail extractor to give a serilaized version of email * Handled storing attachments of email on the message * Added incoming email settings, env variables * [#138] Added documentation regarding different email settings and variables * Fixed the mail attachments blob issue (#138) * Decoided attachments were strings and had to construct blobs out fo them to work with active storage * Fixed the content encoding issue with mail body * Fixed issue with Proc used in apllication mailbox routing * Fixed couple of typos and silly mistakes * Set appropriate from email for conversation reply mails (#138) * From email was taken from a env variable, changed it to take from account settings if enabled * Set the reply to email correctly based on conversation UUID * Added commented config ind development.rb for mailbox ingress * Added account settings for domain and support email (#138) * Added the new attributes in accounts controller params whitelisting, api responses * Added options for the the new fields in account settings * Fixed typos in email continuity docs and warnings * Added specs for conversation reply mailer changes (#138) * Added specs for * conversation reply mailer * Accounts controller * Account and Conversation models * Added tests for email presenter (#138) * Specs for inbound email routing and mailboxes (#138)
2020-04-30 14:50:26 +00:00
```
This configures the ingress service for the app. Now we have to set the password for the ingress service that we use.
```bash
# Use one of the following based on the email ingress service
# Set this if you are using Sendgrid, Exim, Postfix, Qmail or Postmark
RAILS_INBOUND_EMAIL_PASSWORD=
# Set this if you are Mailgun
MAILGUN_INGRESS_SIGNING_KEY=
# Set this if you are Mandrill
MANDRILL_INGRESS_API_KEY=
```
If you are using Mailgun as your email service, in the Mailgun dashboard configure it to forward your inbound emails to `https://example.com/rails/action_mailbox/mailgun/inbound_emails/mime` if `example.com` is where you have hosted the application.
If you are choosing Sendgrid to be your email service, configure SendGrid Inbound Parse to forward inbound emails to forward your inbound emails to `/rails/action_mailbox/sendgrid/inbound_emails` with the username `actionmailbox` and the password you previously generated. If the deployed application was hosted at `example.com`, you can configure the following URL as the forward route.
```bash
https://actionmailbox:PASSWORD@example.com/rails/action_mailbox/sendgrid/inbound_emails
```
If you are configuring Mandrill as your email service, configure Mandrill to route your inbound emails to `https://example.com/rails/action_mailbox/mandrill/inbound_emails` if `example.com` is where you have hosted the application.
If you want to know more about configuring other services visit [Action Mailbox Basics](https://edgeguides.rubyonrails.org/action_mailbox_basics.html#configuration)