Chore: Routine Bugfixes and enhancements (#979)
- Fix slack scopes - Docs for authentication Fixes: #704 , #973
This commit is contained in:
@@ -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) },
|
||||
Reference in New Issue
Block a user