Allow direct local file upload (PDF/Image/Video) for WhatsApp Media Header templates instead of requiring a public URL #16300
ldaniel-jmz
started this conversation in
Feature Requests
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Is your feature or enhancement related to a problem? Please describe.
Currently, when sending a WhatsApp Cloud API message template that includes a media header (
DOCUMENT,IMAGE, orVIDEO), the Chatwoot UI (TemplateParser.vue) only renders a plain text input requiring the agent to manually paste an external, publicly accessible HTTPS URL (media_url).In real-world support and sales workflows, human agents have files (such as invoices, quotes in PDF, or product images) stored locally on their computers. Forcing agents to upload a local PDF/image to an external hosting service or public S3 bucket just to copy and paste a public link into the template modal creates significant operational friction and slows down response times.
Describe the solution you'd like
Allow agents to upload or drag-and-drop a local file (
<input type="file">) directly inside the WhatsApp Template modal when the selected template has aHEADERcomponent with formatDOCUMENT,IMAGE, orVIDEO(while optionally keeping the URL input as a fallback/tab).From a technical standpoint, this could be handled in one of two ways:
Via ActiveStorage / Direct Upload: Upload the file using Chatwoot's existing ActiveStorage pipeline (similar to standard conversation attachments), generate a publicly accessible/signed URL, and inject it into
processedParams.header.media_url(and automatically populatemedia_namefromfile.nameforDOCUMENTheaders).Via Meta's
/mediaEndpoint (Recommended for private/self-hosted instances): Upload the binary directly to WhatsApp Cloud API's/vXX.0/{phone_number_id}/mediaendpoint, retrieve themedia_id, and send the template header parameter using{ "type": "document", "document": { "id": "<MEDIA_ID>", "filename": "..." } }instead oflink. This avoids issues where self-hosted Chatwoot instances use private storage buckets not reachable by Meta's servers.Describe alternatives you've considered
Asking agents to upload the file to an external cloud drive / S3 bucket first and paste the link (error-prone and poor UX for non-technical agents).
Sending a text-only template first, waiting for the customer to reply to open the 24-hour window, and then attaching the local PDF as a regular message (adds unnecessary steps when the business needs to deliver the document immediately in the first outbound message).
Additional context
Frontend component impacted:
app/javascript/dashboard/components/widgets/conversation/WhatsappTemplates/TemplateParser.vueBackend service impacted:
app/services/whatsapp/providers/whatsapp_cloud_service.rbAll reactions