Feature: Rich Message Types (#610)
Co-authored-by: Pranav Raj S <pranavrajs@gmail.com> Co-authored-by: Nithin David Thomas <webofnithin@gmail.com>
This commit is contained in:
@@ -31,4 +31,19 @@ class ContactInbox < ApplicationRecord
|
||||
belongs_to :inbox
|
||||
|
||||
has_many :conversations, dependent: :destroy
|
||||
|
||||
def webhook_data
|
||||
{
|
||||
id: id,
|
||||
contact: contact.try(:webhook_data),
|
||||
inbox: inbox.webhook_data,
|
||||
account: inbox.account.webhook_data,
|
||||
current_conversation: current_conversation.try(:webhook_data),
|
||||
source_id: source_id
|
||||
}
|
||||
end
|
||||
|
||||
def current_conversation
|
||||
conversations.last
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user