Question

POST File with Webhooks

  • 11 November 2020
  • 9 replies
  • 3068 views

Hello, I am fairly new to Zapier and am looking for some help.

I have a zap that triggers from a Ninja Forms Submission and POSTS this data to a WebHook. I am having difficulty posting the Files that are attached in this form. I have tried single file in the File field but keep getting the error “The app returned "Provided Document type not found in database".” error. 

Please help


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

9 replies

Userlevel 7
Badge +10

@kpotdar 

Can you show us a screenshot of the error message and how you have that step setup in the zap editor? Thanks!

Sorry for the delayed response @AndrewJDavison_Luhhu 

here is the screenshot

I even tried changing this to a custom request, but I am not able to attach a file when I convert it to a custom request which what the service expects.

Userlevel 7
Badge +10

Hi @kpotdar 

That looks correct to me. What error message are you getting?

Thanks for your prompt response @AndrewJDavison_Luhhu  I get an error from the service saying “Provided Document type not found in database” but I think the reason I get that is because the JSON request that gets sent to the service by Zapier gets formed as below: Notice the data field where it says DocTypeID=1, it should technically say “DocTypeID”:”1”, as the first line in the body.

"body": {
"data": "DocTypeID=1",
"file": {
"filename": "1606935420-LIC_Kimberlee_Lee.jpg",
"encoding": "7bit",
"mimetype": "image/jpeg",
"url": "https://pipedream-catcher-bodies.s3.amazonaws.com/13127386-a31e-427f-a86b-dc01f8720272?AWSAccessKeyId=ASIA5F5AGIEA5KJIQTX2&Expires=1607552243&Signature=b8ch6D96xswv5S%2BNGrWOkcjZYUc%3D&x-amz-security-token=FwoGZXIvYXdzEN%2F%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaDAPBc9rSqhoHXCQ3myKNBKZTJxTOtEXT5SkobtUbiWzBv038Z4%2FW2BD9fRtmV8MLJvYhudZAJnY8s7cdEZCMlauPKXNhv3d4sU3f4yg%2BZs230Isj5w33%2FroxQd9jd%2BvzaTo1WRYihUsO93CIMXx378AWsRQOP%2BB4D4CHNSZNd2WfQEDhofaN2O9G49NQeDSw0Cs8s06MoAmgR2iccIUgVAoz2r05AYyqS8wTjOANMLKv8dzpDp1cTgSLSql5ogf4WXs7%2BLMt4t4UeEb6QzfFgt1hpJNEbGR%2B45ahAeT8MEi3LqjNaJXDNzpeZAMCmMPEECWBAlyA92ftDi08CTcqnOhQA7NQM9Oi6LEF%2FM%2FqM%2Bs%2Fqrp6tirL%2F3bDSEDHPFUs14vSjQg55QuWFD63lxqLeqakdXuwRNwSAg6AaCcAHhvO5hvm5UcDeqUGs%2F9Y3IXSfiPCvku%2FRkFlA6HiMwQ5WKtc4V4HKml0KYovv4zuGwgBHycWCfxwl2T%2Fkh3f2uQzqKEN6N3cDgpPdfXVbanHGEVtNJxxkbwWJKW9FrlrHYBo00SKX2QwmsgTOl0ixpTeMXZ5evoP%2Bk7DYrTL2UGHw1woRKKSCEcoJ%2Bd0xhtdIaH08jVvF0cLGeb4Qcnsra%2BSKzIEiCJsZ4w4sRUcKQ7Go%2B213xSGzQsuOt2dNmqckOm9k1IiRVVTWBuHP9IvQR%2FQxbTiOdpqSCP%2BDExBdSjri8X%2BBTIqFB9mNvFM7mqqAH3f4igqVlTYbe5Jm3hq%2BJiQhI3pPbGgfyPbay4HebPd"
}
}
Userlevel 7
Badge +10

@kpotdar 

I'm going to flag this post for the Zapier Community Team. They should have more insight on this and can escalate to the support team if needed.

Sit tight, and someone will contact you soon.

Userlevel 7
Badge +11

Hi @kpotdar!

Generally speaking, we don’t provide that much support for Webhook steps because they can get pretty complex, depending on the service or app you’re trying to send to. 

Do you have any API docs that you can refer to? Do they say to use a format like this:

I’m not an expert in this area, but that doesn’t seem quite right. You have a “ at the beginning but not another one. And is the boundary=--------------------------221641152148081267562601 specified somewhere by the service you’re connecting to (and by the way, where are you trying to send this to?).

And based on the screenshots, it looks like you're setting payload type: form in the Zap configuration, so we're sending outgoing form data. But then in your other screenshot, you have JSON data, with body.data being form-encoded data in a string value (nested in the JSON), and body.file is properly-parsed JSON.

If you haven’t already, it may be worth also checking with the service you’re POSTing to, to see if they have any insight at all.

As a troubleshooting step, are you able to POST there successfully without the file attachment, like to a different endpoint?

Hi @nicksimard ,

Thanks for your response, I really appreciate it. I only added the content-type because thats what was showing when i checked the POST from Postman. The result is the same even if I remove it. 

I have the service folks engaged with me as well and they identified that when I use Payload type Form the data is sent as form fields instead of JSON which ie: "data": "DocTypeID=1", so i changed the Payload type from Form to JSON which resulted the request body to look like below but the service returns the same error. I am not certain why the \ are added in the data element and if that has anything to do with it.

"body": {
"data": "{\"DocTypeID\": \"1\"}",
"file": {
"filename": "1606935420-LIC_Kimberlee_Lee.jpg",
"encoding": "7bit",
"mimetype": "image/jpeg",
"url": "https://pipedream-catcher-bodies.s3.amazonaws.com/74029680-1246-48fe-a2c7-96550eca905e?AWSAccessKeyId=ASIA5F5AGIEAZRROHPNN&Expires=1607883721&Signature=qX6lnP7NkH%2B6MDP0CmB6Fwrfdyg%3D&x-amz-security-token=FwoGZXIvYXdzEDsaDBu1%2F1btGM1oX73cxiKNBPPlTggsvyne%2FFQOGbCwIK%2BUiWHrN2o47bsU9AlBEMHPS6q1h1W6qbVUelRYNHL1J%2B2LqLX%2BoF0%2FWO5Bu4h4kVpIar%2FxmFDd%2FiFDx3d7nTvqQNt5ydPd980g4PJ4sFqEEH9uLh29xzqHwCQCyp5NsNOoYe216AGlzQxM%2BFx6%2Fv56hE9TIcaYHjLuMrhFdNn8NXENJd9YA0vYBoYwI0Hm8oWTyYbpC%2FqpALunn57NWsqjRAKmgMZGjbFXeyGeggktLA%2Fec6GUjoZJFldSEMlTEE%2FVLqFKxh1dRaEAY5BY5tlmjzi5NPFJ5IsqYKNqj2V7PZN4KsndkCOq5rTD1UgrSzgSNjE01UmWVPR9aHPIeyiYI5ZgJFnYpT9laUGrTuW9S6uZv%2FVo3uuLDSUamas00cd49hrNl68X2w20VR1lDF2GzdQlpR1pqAw8WLOs%2Bxqgj0PBXAJmoUJH2pf16o9D24pMNPKJEUwmBehJrTcRUXTOSL%2BwaRQSGll75K%2BZnMZIB5ZdeiEfQXX4YpCIW7o9XaMMi%2BEyGJ%2BZ%2FWO8AAZlt3xghpIFnvagt18DCoPq86xDDTwLHm84xdieboshqqAa%2FhEgDtMO8NtolpPcqsvQOns47e7XwPD2DN3%2FiQ9mB9tRoQJItxv99fr%2BcX83%2BEBcjgEQJ4fjQk98Um%2Fl46dzXNL%2BT0Zr2fWyzFtm2PxCxyjBqdn%2BBTIqVRbkppIFrheK%2FwxVNmueS198BuddTCkXew2B2x5wyjCsAnagHYnvM26M"
}
}

 The service returns the same error, i believe because the service expects JSON like below without the Data element.

"body": {
"DocTypeID": "1",
"Image": {
"filename": "chicago.jpg",
"encoding": "7bit",
"mimetype": "image/jpeg",
"url": "https://pipedream-catcher-bodies.s3.amazonaws.com/3d15cfcf-2a57-4d18-a6f7-2a516d57856d?AWSAccessKeyId=ASIA5F5AGIEATX5CPVV2&Expires=1607884366&Signature=N6vKhfJUBmPwtRL4Us4MfSxSqAY%3D&x-amz-security-token=FwoGZXIvYXdzEDsaDCiXshmzuRZHFzyCsyKNBN5VAr5qLPVAAZHtcWwc%2B3RUjkA%2BGNMvMHhzszTrPp2FRdLcqwL2lKA5iukhG%2BY91ZC%2Bd3q%2Fi9fxzazTi5Rn3iNnxGqb%2BFS26rROCGriXgMPPu9dxDa%2BHJO0F8bHqENrkE9blr5JNj8awK4hNDAWPPzhPp1zASTOAx1IinrOHSzjx6FJOFVtH3Mkt6OxhuZ5%2BL3dWLscD68hVcsxW%2F0tlfUDhPBQ6NpravICoV1V1dP7%2BeoeaJrLaEctLabkeaw4DXBzaPM2uoYu8Rj9OYN753kwtJpD%2Bfc6wapXjlKKkgXI%2BPItvjVBZAGos0IkJtkfcMBfwces81%2FMUad2J9BjsHoKlJUifhMokZLXwtVaRQJbKU4iJtjnrBenlTuANmlVILa4%2BwrNV4oFTA6w40cjY4NifyHDruD3EjTkEbmNCf2WFZGQCAixmUolC5QPOapLw%2BMziaGP9zn3wuifnfE499%2F2FMi25nzeLrek2H%2FbqbefRxRvz2MyQSfwn3gcFIzkWCigxV5JL8y1G66opVOrgbfRDmijKHsTG3NC77pF738LsG6YVm8XHwgo6c3vUy6CvLVVdQgIz7%2FQosyos%2BlCsZ6cT0ildoCIGswC8DBmcX9TbrU89Yebomo53xJVIPHFcu1shZ6OWp85de%2B6yYn6uuhwvld34cHZnZNyTAucKiiuW%2F9VZF3unXYQUPIXFSjGrtn%2BBTIqLaX3psjBJjRjoLJR8FMp0pZPfUaogdVncChHP7tldyMDVGD8%2FtDXpFGT"
}
}

I have also tried to use a custom request but due to Zapier limitations, I am not able to send a File object using a custom request which is what the service expects. 

Any help would be highly appreciated.

Thank you

Kedar 

Userlevel 7
Badge +11

Hi @kpotdar!

Thanks for that extra information. I ran it past one of my engineer colleagues here and though he wasn’t able to dig in, he suspected that it's probably a configuration issue.

It would be surprising if we're always formatting the request body wrong when sending files with that action. I’d like to think that we'd know about that by now.

I’m going to tag in one our resident experts here in Community, @ikbelkirasan, to see if he has any insight. He’s quite handy when it comes to code and webhooks. He might see something, or know how to better guide you. Or maybe @PaulKortman? Either of you fine gents able to help out?

Userlevel 7
Badge +12

@kpotdar - Have you tried removing the Content-Type header? I’ve just tried uploading a file using the same configuration but without setting the Content-Type and it worked fine. The Content-Type header was generated automatically by Zapier. Please try this out and let me know how it goes. Thanks!