feat: Contactable Inboxes API (#2101)

- Add endpoint which lists inboxes through which a contact can be contacted
- Conversation creation API auto-creates contact_inbox for specific channels [ Twilio, email, api]
- Ability to send the initial message payload along with the conversation creation
- Fixes #1678 ( issue saving additional attributes for conversation )
This commit is contained in:
Sojan Jose
2021-04-15 15:13:01 +05:30
committed by GitHub
parent ba41a10609
commit 45e43b0b89
14 changed files with 494 additions and 10 deletions

View File

@@ -4,7 +4,7 @@ class Api::V1::Accounts::ContactsController < Api::V1::Accounts::BaseController
before_action :check_authorization
before_action :set_current_page, only: [:index, :active, :search]
before_action :fetch_contact, only: [:show, :update]
before_action :fetch_contact, only: [:show, :update, :contactable_inboxes]
def index
@contacts_count = resolved_contacts.count
@@ -40,6 +40,10 @@ class Api::V1::Accounts::ContactsController < Api::V1::Accounts::BaseController
def show; end
def contactable_inboxes
@contactable_inboxes = Contacts::ContactableInboxesService.new(contact: @contact).get
end
def create
ActiveRecord::Base.transaction do
@contact = Current.account.contacts.new(contact_params)