chore: Provider API prototype (#3112)

Enabling Support for Whatsapp via 360Dialog as a prototype for the provider APIs. 

Co-authored-by: Pranav Raj S <pranav@chatwoot.com>
This commit is contained in:
Sojan Jose
2021-10-05 23:35:06 +05:30
committed by GitHub
parent 40d0b2faf3
commit bd7aeba484
31 changed files with 506 additions and 60 deletions

View File

@@ -0,0 +1,13 @@
class Webhooks::WhatsappEventsJob < ApplicationJob
queue_as :default
def perform(params = {})
return unless params[:phone_number]
channel = Channel::Whatsapp.find_by(phone_number: params[:phone_number])
return unless channel
# TODO: pass to appropriate provider service from here
Whatsapp::IncomingMessageService.new(inbox: channel.inbox, params: params['whatsapp'].with_indifferent_access).perform
end
end