Chore: Routine Bugfixes and enhancements (#979)

- Fix slack scopes
- Docs for authentication
Fixes: #704 , #973
This commit is contained in:
Sojan Jose
2020-06-25 23:35:16 +05:30
committed by GitHub
parent 0aab717bb3
commit 4f83d5451e
32 changed files with 254 additions and 147 deletions

View File

@@ -1,37 +1,14 @@
class Facebook::SendReplyService
pattr_initialize [:message!]
def perform
return if message.private
return if inbox.channel.class.to_s != 'Channel::FacebookPage'
return unless outgoing_message_from_chatwoot?
FacebookBot::Bot.deliver(delivery_params, access_token: message.channel_token)
end
class Facebook::SendOnFacebookService < Base::SendOnChannelService
private
delegate :contact, to: :conversation
def inbox
@inbox ||= message.inbox
def channel_class
Channel::FacebookPage
end
def conversation
@conversation ||= message.conversation
def perform_reply
FacebookBot::Bot.deliver(delivery_params, access_token: message.channel_token)
end
def outgoing_message_from_chatwoot?
# messages sent directly from chatwoot won't have source_id.
(message.outgoing? || message.template?) && !message.source_id
end
# def reopen_lock
# if message.incoming? && conversation.locked?
# conversation.unlock!
# end
# end
def fb_text_message_params
{
recipient: { id: contact.get_source_id(inbox.id) },