Slack integration: audio files posted in a Slack thread are relayed as generic files, so Instagram (and WhatsApp) never receive a voice note
Describe the bug
When an agent replies inside the Slack thread of a conversation by uploading an audio file (mp3, m4a, wav, ogg), Chatwoot creates the outgoing message with the attachment typed as file rather than audio.
The cause is Integrations::Slack::SlackMessageHelper#file_type, which only maps image and video Slack filetypes and falls through to :file for everything else:
The channel send services pass that type straight to the provider (Instagram::BaseSendService#attachment_type uses attachment.file_type), so Instagram receives attachment.type: "file" and shows a document, not a playable voice note. Instagram documents its file type as PDF only. The very same clip uploaded from the dashboard or the API arrives as audio, because Messages::MessageBuilder types attachments by content type through FileTypeHelper#file_type, which returns :audio for any audio/*.
To Reproduce
- Connect the Slack integration in two-way mode and have an Instagram (or WhatsApp) inbox.
- Let a contact write in, so the conversation appears as a Slack thread.
- In that Slack thread, upload an mp3 (or wav / m4a).
- In Chatwoot the message is created with
attachments[0].file_type == "file"; on Instagram the contact receives a file attachment instead of an audio message. - Upload the same mp3 from the Chatwoot dashboard:
file_type == "audio", Instagram shows a voice note.
Expected behavior
Audio uploaded from Slack should be typed audio, consistent with uploads from the dashboard and API, so Instagram and WhatsApp render it as a voice note.
Environment
Chatwoot Cloud (app.chatwoot.com), Instagram channel, Slack integration.
Additional context
Slack reports filetype values mp3, m4a, wav, ogg for audio and a mimetype of audio/*. A fix that checks the mimetype first (mirroring FileTypeHelper) and adds those filetypes to the explicit list follows in a PR.
Source: chatwoot/chatwoot