Feature: Twilio Whatsapp Integration (#779)

Twilio Whatsapp Integration

Co-authored-by: Sojan <sojan@pepalo.com>
This commit is contained in:
Pranav Raj S
2020-04-30 01:41:13 +05:30
committed by GitHub
parent 168042f9a4
commit 0cb7333977
23 changed files with 238 additions and 81 deletions

View File

@@ -5,6 +5,7 @@
# id :bigint not null, primary key
# account_sid :string not null
# auth_token :string not null
# medium :integer default("sms")
# phone_number :string not null
# created_at :datetime not null
# updated_at :datetime not null
@@ -23,6 +24,8 @@ class Channel::TwilioSms < ApplicationRecord
validates :auth_token, presence: true
validates :phone_number, uniqueness: { scope: :account_id }, presence: true
enum medium: { sms: 0, whatsapp: 1 }
belongs_to :account
has_one :inbox, as: :channel, dependent: :destroy

View File

@@ -70,11 +70,12 @@ class Message < ApplicationRecord
has_many :attachments, dependent: :destroy, autosave: true, before_add: :validate_attachments_limit
after_create :reopen_conversation,
:dispatch_event,
:send_reply,
:execute_message_template_hooks,
:notify_via_mail
# we need to wait for the active storage attachments to be available
after_create_commit :dispatch_event, :send_reply
after_update :dispatch_update_event
def channel_token