feat: Add attachment support for Signal and WhatsApp channels
- Signal: Use base64Attachments field in signal-cli-rest-api - WhatsApp: Implement Baileys attachment sending for images, videos, audio, and documents - Both channels retrieve attachments from Zammad Store model - Support multiple attachments per message
This commit is contained in:
parent
9139c8e8de
commit
d2a3c71bcd
8 changed files with 255 additions and 85 deletions
|
|
@ -334,6 +334,20 @@ class CdrSignal
|
|||
options = {}
|
||||
options[:conversationId] = ticket.number if ticket
|
||||
|
||||
# Get attachments from the article
|
||||
attachments = Store.list(object: 'Ticket::Article', o_id: article.id)
|
||||
if attachments.any?
|
||||
attachment_data = attachments.map do |attachment|
|
||||
{
|
||||
data: Base64.strict_encode64(attachment.content),
|
||||
filename: attachment.filename,
|
||||
mime_type: attachment.preferences['Mime-Type'] || attachment.preferences['Content-Type'] || 'application/octet-stream'
|
||||
}
|
||||
end
|
||||
options[:attachments] = attachment_data
|
||||
Rails.logger.debug { "Sending #{attachment_data.length} attachment(s) with message" }
|
||||
end
|
||||
|
||||
@api.send_message(recipient, article[:body], options)
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue