feat: send instagram message after 24 hours (#4698)
Added MESSAGE_TAG: HUMAN_AGENT for Instagram messages if the user wants to send it after the standard message window. Fixes #4689
This commit is contained in:
@@ -23,17 +23,19 @@ class Instagram::SendOnInstagramService < Base::SendOnChannelService
|
||||
end
|
||||
|
||||
def message_params
|
||||
{
|
||||
params = {
|
||||
recipient: { id: contact.get_source_id(inbox.id) },
|
||||
message: {
|
||||
text: message.content
|
||||
}
|
||||
}
|
||||
|
||||
merge_human_agent_tag(params)
|
||||
end
|
||||
|
||||
def attachament_message_params
|
||||
attachment = message.attachments.first
|
||||
{
|
||||
params = {
|
||||
recipient: { id: contact.get_source_id(inbox.id) },
|
||||
message: {
|
||||
attachment: {
|
||||
@@ -44,6 +46,8 @@ class Instagram::SendOnInstagramService < Base::SendOnChannelService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
merge_human_agent_tag(params)
|
||||
end
|
||||
|
||||
# Deliver a message with the given payload.
|
||||
@@ -96,4 +100,14 @@ class Instagram::SendOnInstagramService < Base::SendOnChannelService
|
||||
def config
|
||||
Facebook::Messenger.config
|
||||
end
|
||||
|
||||
def merge_human_agent_tag(params)
|
||||
global_config = GlobalConfig.get('ENABLE_MESSENGER_CHANNEL_HUMAN_AGENT')
|
||||
|
||||
return params unless global_config['ENABLE_MESSENGER_CHANNEL_HUMAN_AGENT']
|
||||
|
||||
params[:messaging_type] = 'MESSAGE_TAG'
|
||||
params[:tag] = 'HUMAN_AGENT'
|
||||
params
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user