# N8N returning a pdf file

**URL:** <https://community.n8n.io/t/n8n-returning-a-pdf-file/105330>\
**Category:** Questions\
**Created:** [April 24, 2025, 4:44am UTC](https://community.n8n.io/t/n8n-returning-a-pdf-file/105330 "2025-04-24T04:44:59Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Papiro\_Silva](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/papiro_silva/32/51321_2.png) [@Papiro\_Silva](https://community.n8n.io/u/Papiro_Silva)\
**Post date:** [April 24, 2025, 4:45am UTC](https://community.n8n.io/t/n8n-returning-a-pdf-file/105330/1 "2025-04-24T04:45:00Z")

</div>

Iḿ using N8N and chatwoot.

I receive a base64 encoded pdf file in N8N and must return to the chatwoot this pdf file to specific user (user who asked for the file).

How can I do that in N8N? I tried chatwoot node but it is not working…

---

<div class="post-metadata">

**Author:** ![anon61017519](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@anon61017519](https://community.n8n.io/u/anon61017519)\
**Post date:** [April 24, 2025, 1:37pm UTC](https://community.n8n.io/t/n8n-returning-a-pdf-file/105330/2 "2025-04-24T13:37:43Z")

</div>

Hello @PapIro_SIlva.  
Hope you are well!

The default N8N Chatwoot node is usually focused on more common operations like creating contacts, conversations or sending text messages. Sending attachments, especially when you need to build the file from Base64 data, often exceeds the simplified functionality of the node and requires the flexibility of HTTP Request to assemble the multipart/form-data call correctly, as expected by the Chatwoot API.

Test this flow below and see if it works! Remember to adjust the field names (pdfBase64, account\_id, conversation\_id, filename) according to the actual data coming to your nodes.

Convert Base64 to Binary:

Add a Move Binary Data node.  
Select Base64 to Binary.  
Use an expression to point to the field that contains your Base64 string (e.g. {{ $json.pdfBase64 }}).  
Set a name for the resulting binary data, e.g. data.  
Expand the Add Option and select File Name.  
Set a name for the PDF file that will be sent to Chatwoot (e.g. {{ $json.filename || ‘requested\_document.pdf’ }}). This is crucial so that Chatwoot knows the name of the attachment.

Add an HTTP Request node.  
Method: POST  
Construct the Chatwoot API URL to send messages. Use expressions to insert the necessary IDs:  
https://\<YOUR\_CHATWOOT\_URL\>/api/v1/accounts/{{ $json.account\_id }}/conversations/{{ $json.conversation\_id }}/messages  
Replace \<YOUR\_CHATWOOT\_URL\> with your actual Chatwoot URL. Make sure that $json.account\_id and $json.conversation\_id point to the correct fields in your flow.  
Select Header Auth.  
api\_access\_token  
Paste your Chatwoot API Token here (or use N8N credentials).  
In Body Content select Form-Data Multipart.

Configure the Body Parameters:  
Click Add Body Parameter.  
Name: content  
Value: (Optional) Enter the text message that will accompany the file (e.g. Here is the PDF you requested.).  
Click Add Body Parameter.  
Name: message\_type  
Value: outgoing (to indicate that this is a message sent by your automation/bot).  
Click Add Body Parameter.  
Name: private  
Value: false (to make the message visible to the contact).  
Click Add Body Parameter.  
Name: attachments (The square brackets are important!)  
Value: Leave this field empty.  
Node Options (Important for Attachment):  
Check the Send Binary Data? option. as Yes.  
Input Data Field Name: Enter the name you defined as Destination Key in the Move Binary Data node (in this example, it was data).

I hope this helps.  
Best regards

---

<div class="post-metadata">

**Author:** ![anon61017519](https://avatars.discourse-cdn.com/v4/letter/a/67e7ee/32.png) [@anon61017519](https://community.n8n.io/u/anon61017519)\
**Post date:** [May 5, 2025, 4:40pm UTC](https://community.n8n.io/t/n8n-returning-a-pdf-file/105330/3 "2025-05-05T16:40:32Z")

</div>

@Papiro_Silva If this suggestion solved your problem, please mark my post as the solution (blue box with check mark) so that this ongoing discussion does not distract others who want to find the answer to the original question. Thanks 👍

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/system/32/195824_2.png) [@system](https://community.n8n.io/u/system)\
**Post date:** [July 9, 2025, 3:51am UTC](https://community.n8n.io/t/n8n-returning-a-pdf-file/105330/4 "2025-07-09T03:51:17Z")

</div>

Closed on July 9, 2025, 3:51am UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
