# Sent binary data example

**URL:** <https://community.n8n.io/t/sent-binary-data-example/1236>\
**Category:** Questions\
**Created:** [April 29, 2020, 9:21am UTC](https://community.n8n.io/t/sent-binary-data-example/1236 "2020-04-29T09:21:34Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwillmer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jwillmer/32/46_2.png) [@jwillmer](https://community.n8n.io/u/jwillmer)\
**Post date:** [April 29, 2020, 9:21am UTC](https://community.n8n.io/t/sent-binary-data-example/1236/1 "2020-04-29T09:21:34Z")

</div>

Related feature: [http://community.n8n.io/t/how-to-sent-binary-data-as-multipart-form-data](http://community.n8n.io/t/how-to-sent-binary-data-as-multipart-form-data)

I receive a webhook with some audio file that I like to sent to a webservice for conversion. However I can’t find the right options to successfully post it to the service. Below is my node configuration and the API of the service. Could someone help me find the right configuration for this?

```
{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "ptt-input",
        "options": {
          "binaryData": true
        }
      },
      "name": "PTT-Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        260,
        300
      ]
    },
    {
      "parameters": {
        "requestMethod": "POST",
        "url": "http://audioconverter/convert-to/wav",
        "responseFormat": "file",
        "jsonParameters": true,
        "options": {
          "bodyContentType": "multipart-form-data"
        },
        "sendBinaryData": true,
       "binaryPropertyName": "file:data"
      },
      "name": "AudioConverter",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 1,
      "position": [
        540,
        140
      ]
    }
  ],
  "connections": {
    "PTT-Webhook": {
      "main": [
        [
          {
            "node": "AudioConverter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}

```

 ![image](https://europe1.discourse-cdn.com/n8n/original/1X/3fbebdca325d062fdf4e6e76fa45b23aaf837882.png)

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [April 29, 2020, 9:34am UTC](https://community.n8n.io/t/sent-binary-data-example/1236/2 "2020-04-29T09:34:00Z")

</div>

Looks on the first look ok.

When you send the data to the n8n Webhook does the data end up in the binary property named “data”?

---

<div class="post-metadata">

**Author:** ![jwillmer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jwillmer/32/46_2.png) [@jwillmer](https://community.n8n.io/u/jwillmer)\
**Post date:** [April 29, 2020, 9:45am UTC](https://community.n8n.io/t/sent-binary-data-example/1236/3 "2020-04-29T09:45:40Z")

</div>

That was what I thought. As I understand this option stores the data per default in `data`:  
 ![image](https://europe1.discourse-cdn.com/n8n/original/1X/46eaee7b39381c55ec1cbe946a3731a4072f18b6.png)

---

<div class="post-metadata">

**Author:** ![jwillmer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jwillmer/32/46_2.png) [@jwillmer](https://community.n8n.io/u/jwillmer)\
**Post date:** [April 29, 2020, 9:49am UTC](https://community.n8n.io/t/sent-binary-data-example/1236/4 "2020-04-29T09:49:44Z")

</div>

This is the error I get on the audio (post) node when executing the workflow:

```
ERROR: 400 - {"type":"Buffer","data":[123,34,116,121,...]}

StatusCodeError: 400 - {"type":"Buffer","data":[123,34,116,121,...]}
    at new StatusCodeError (/usr/local/lib/node_modules/n8n/node_modules/request-promise-core/lib/errors.js:32:15)
    at Request.plumbing.callback (/usr/local/lib/node_modules/n8n/node_modules/request-promise-core/lib/plumbing.js:104:33)
    at Request.RP$callback [as _callback] (/usr/local/lib/node_modules/n8n/node_modules/request-promise-core/lib/plumbing.js:46:31)
    at Request.self.callback (/usr/local/lib/node_modules/n8n/node_modules/request/request.js:185:22)
    at Request.emit (events.js:310:20)
    at Request.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/request/request.js:1154:10)
    at Request.emit (events.js:310:20)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/n8n/node_modules/request/request.js:1076:12)
    at Object.onceWrapper (events.js:416:28)
    at IncomingMessage.emit (events.js:322:22)
```

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [April 29, 2020, 10:43am UTC](https://community.n8n.io/t/sent-binary-data-example/1236/5 "2020-04-29T10:43:30Z")

</div>

With multi-part, multiple files can be send at the same time and they all get send under a specific name which also n8n uses.

Here an example.

Receive data workflow:

Send workflow (URL of HTTP Request2 has to be adjusted to point to receive workflow):

For me, that worked fine and I did not get the error. Can you please create an issue on Github with a workflow to reproduce the issue you are seeing that we can fix it. Thanks!

---

<div class="post-metadata">

**Author:** ![jwillmer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jwillmer/32/46_2.png) [@jwillmer](https://community.n8n.io/u/jwillmer)\
**Post date:** [April 29, 2020, 11:49am UTC](https://community.n8n.io/t/sent-binary-data-example/1236/6 "2020-04-29T11:49:38Z")

</div>

O.K., I tested it locally - like you did - with a file that I retrieve by WebApi GET. That works without a problem. So I think the multipart POST is not the problem. The problem is the webhook that is receiving the file. Maybe webhook has problems handling files?

**Webhook.site data for comparison:**

 ![image](https://europe1.discourse-cdn.com/n8n/original/1X/4af76446f1e28bc9bee83fd8728bfc1802601589.png)

**My webhook:**

 ![image](https://europe1.discourse-cdn.com/n8n/original/1X/b930c80b6ef1c492b083752f1a9ee594157aebe2.png)

```
{
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "ptt-input",
        "options": {
          "binaryData": true
        }
      },
      "name": "PTT-Webhook",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        260,
        390
      ]
    }
  ],
  "connections": {}
}

```

I can reproduce the issue by using curl to trigger the webhook via:

```
curl --location --request POST 'https://n8n...../webhook-test/53/ptt-webhook/ptt-input' \
--header 'Content-Type: application/octet-stream' \
--data-binary '@/C:/test.opus'

```

---

<div class="post-metadata">

**Author:** ![RicardoE105](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/ricardoe105/32/550_2.png) [@RicardoE105](https://community.n8n.io/u/RicardoE105)\
**Post date:** [April 29, 2020, 5:13pm UTC](https://community.n8n.io/t/sent-binary-data-example/1236/7 "2020-04-29T17:13:53Z")

</div>

@jwillmer Just tested it as you suggested using a .opus file and the webhook receives the file.

```
curl --location --request POST '/webhook-test/86/ptt-webhook/ptt-input' \
--header 'Content-Type: application/octet-stream' \
--data-binary '@/Users/Ricardo/Desktop/2019-05-01_-_Undercover_Spy_Agent_-_David_Fesliyan_1.opus'

```

 ![image](https://europe1.discourse-cdn.com/n8n/original/1X/f34ef774834f0b793e908cfac37e689ff82a5e1e.png)

---

<div class="post-metadata">

**Author:** ![jwillmer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jwillmer/32/46_2.png) [@jwillmer](https://community.n8n.io/u/jwillmer)\
**Post date:** [April 29, 2020, 8:17pm UTC](https://community.n8n.io/t/sent-binary-data-example/1236/8 "2020-04-29T20:17:57Z")

</div>

I believe the server proxy is preventing the file from getting to the n8n webhook. If I test my setup locally it works perfect. Will investigate in this direction. Thank you for validating my actions 😉

---

<div class="post-metadata">

**Author:** ![jwillmer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jwillmer/32/46_2.png) [@jwillmer](https://community.n8n.io/u/jwillmer)\
**Post date:** [April 29, 2020, 8:34pm UTC](https://community.n8n.io/t/sent-binary-data-example/1236/9 "2020-04-29T20:34:41Z")

</div>

I found the problem - had nothing to do with the proxy. I had `EXECUTIONS_PROCESS: main` enabled for n8n and after starting n8n without this flag i received the file. @jan I think there is an issue with this flag.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [April 29, 2020, 10:55pm UTC](https://community.n8n.io/t/sent-binary-data-example/1236/10 "2020-04-29T22:55:07Z")

</div>

Ah yes there were problems with `EXECUTIONS_PROCESS=main`:

> [@Problems with stopping processes](http://community.n8n.io/t/problems-with-stopping-processes/1230/11):
>
> Fix got released with n8n@0.65.0

A fix just got released with n8n@0.65.0 can you please check if it works fine in that version else we will have another look.

---

<div class="post-metadata">

**Author:** ![jwillmer](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jwillmer/32/46_2.png) [@jwillmer](https://community.n8n.io/u/jwillmer)\
**Post date:** [April 30, 2020, 7:38am UTC](https://community.n8n.io/t/sent-binary-data-example/1236/11 "2020-04-30T07:38:35Z")

</div>

Does not work for me. Without the option the webhook gets executed and I see the file. With the option the webhook gets executed but the file is missing.

Edit:  
There is also a difference in Webhook vs HTTP request:  
Receiving the ogg-file via HTTP request works fine and my next HTTP request can use the file.

 ![image](https://europe1.discourse-cdn.com/n8n/original/1X/5ac2876bbe0235e8a9da705bd8aa6625a46d3692.png)  
Receiving the same file via Webhook works (without the `EXECUTIONS_PROCESS` option) but the next step throws the error I posted previously: [Sent binary data example - #4 by jwillmer](http://community.n8n.io/t/sent-binary-data-example/1236/4).  
 ![image](https://europe1.discourse-cdn.com/n8n/original/1X/157fb14d1466fd9ccc1379ecd77f5c8737977c5f.png)

Edit2:  
When I click on the show data in the HTTP request it plays the ogg file. If I do the same on the webhook it shows me:

 ![image](https://europe1.discourse-cdn.com/n8n/original/1X/17de4485413516b7fdfda2623cd6702dd636511f.png)

File preview comparison:

 ![image](https://europe1.discourse-cdn.com/n8n/original/1X/56a4bc45a5ad04594a5c2832d71efcb83330c01e.png)

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [April 30, 2020, 11:47pm UTC](https://community.n8n.io/t/sent-binary-data-example/1236/12 "2020-04-30T23:47:04Z")

</div>

It seems to only be a display issue. The data gets send so fast to the Editor-UI that it is not aware yet what execution is active.  
So if you have the workflow active (so with the production webhook) it should work without a problem. But testing will so currently sadly not be possible. I will work on a fix. But for now you can simply test without ` EXECUTIONS_PROCESS=main`. You can, however, have it set in production.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [May 1, 2020, 8:03am UTC](https://community.n8n.io/t/sent-binary-data-example/1236/13 "2020-05-01T08:03:17Z")

</div>

Did push a fix which will be released with the next version.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [May 1, 2020, 4:45pm UTC](https://community.n8n.io/t/sent-binary-data-example/1236/14 "2020-05-01T16:45:07Z")

</div>

Btw. I could sadly not reproduce the problem with the invalid video file for webhooks. I used this example file:  
[http://techslides.com/demos/sample-videos/small.ogv](http://techslides.com/demos/sample-videos/small.ogv)

And not matter how I get it into n8n, if via HTTP Request or Webhook it works fine and plays just fine.

---

<div class="post-metadata">

**Author:** ![jan](https://dub1.discourse-cdn.com/n8n/user_avatar/community.n8n.io/jan/32/9_2.png) [@jan](https://community.n8n.io/u/jan)\
**Post date:** [May 4, 2020, 10:09am UTC](https://community.n8n.io/t/sent-binary-data-example/1236/15 "2020-05-04T10:09:31Z")

</div>

Got released with n8n@0.66.0
