feat(facebook): use HUMAN_AGENT tag for Messenger replies when human-agent config is enabled (#13690)
This PR updates Facebook Messenger outbound tagging in Chatwoot to support Human Agent messaging when enabled. Previously, Facebook outbound text and attachment messages were always sent with: ``` messaging_type: MESSAGE_TAG tag: ACCOUNT_UPDATE ``` With this change, the tag is selected dynamically: ``` HUMAN_AGENT when ENABLE_MESSENGER_CHANNEL_HUMAN_AGENT is enabled ACCOUNT_UPDATE as fallback when the flag is disabled ```
This commit is contained in:
@@ -49,7 +49,7 @@ class Facebook::SendOnFacebookService < Base::SendOnChannelService
|
||||
recipient: { id: contact.get_source_id(inbox.id) },
|
||||
message: fb_text_message_payload,
|
||||
messaging_type: 'MESSAGE_TAG',
|
||||
tag: 'ACCOUNT_UPDATE'
|
||||
tag: message_tag
|
||||
}
|
||||
end
|
||||
|
||||
@@ -90,10 +90,14 @@ class Facebook::SendOnFacebookService < Base::SendOnChannelService
|
||||
}
|
||||
},
|
||||
messaging_type: 'MESSAGE_TAG',
|
||||
tag: 'ACCOUNT_UPDATE'
|
||||
tag: message_tag
|
||||
}
|
||||
end
|
||||
|
||||
def message_tag
|
||||
@message_tag ||= GlobalConfigService.load('ENABLE_MESSENGER_CHANNEL_HUMAN_AGENT', nil) ? 'HUMAN_AGENT' : 'ACCOUNT_UPDATE'
|
||||
end
|
||||
|
||||
def attachment_type(attachment)
|
||||
return attachment.file_type if %w[image audio video file].include? attachment.file_type
|
||||
|
||||
|
||||
Reference in New Issue
Block a user