feat: Support 360Dialog Interactive Templates (#3823)

fixes: #3795
This commit is contained in:
Sojan Jose
2022-01-20 17:09:30 -08:00
committed by GitHub
parent e997aaceb7
commit 693f2531ab
2 changed files with 20 additions and 1 deletions

View File

@@ -29,6 +29,7 @@ class Whatsapp::IncomingMessageService
def message_content(message)
# TODO: map interactive messages back to button messages in chatwoot
message.dig(:text, :body) ||
message.dig(:button, :text) ||
message.dig(:interactive, :button_reply, :title) ||
message.dig(:interactive, :list_reply, :title)
end
@@ -77,7 +78,7 @@ class Whatsapp::IncomingMessageService
def attach_files
message_type = params[:messages].first[:type]
return if %w[text interactive].include?(message_type)
return if %w[text button interactive].include?(message_type)
attachment_payload = params[:messages].first[message_type.to_sym]
attachment_file = Down.download(inbox.channel.media_url(attachment_payload[:id]), headers: inbox.channel.api_headers)