Question

How to POST files through a Zapier Webhook

  • 9 November 2021
  • 2 replies
  • 277 views

I am having trouble POSTing a Webhook from Zapier to FreshworksCRM. In my Zap I am trying to POST a file (from GDrive) to the FreshworksCRM API, which works perfectly via Postman. Entering all information in Zapier gives us the error message 400 - Bad Request. I was assuming that Zapier is changing something in the POST Request which I can not see in the frontend - which is not the fact as the support told me. link

In Postman I am using the headers authorization:Token token={{APItoken}},Content-Type:multipart/form-data and content-type:multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW.

For my Form-data I am using the file in Postman which I upload manually, as well as the targetable_id and the targetable_type.

Does anyone have an idea why I can not make it work in Zapier?


2 replies

Userlevel 4
Badge +8

Hello Ahmed, 

Greetings from the Freshworks Community!

Please find the API curl command that should be used to create a File and attach the same to a respective respective record from this link - https://developer.freshsales.io/api/#create_file 

It would be helpful if you can share the screenshots of the Zapier configuration with us to troubleshoot this further from our end to check for any errors. 

Kindly write to support@freshsales.io with the support screenshots or let us know your email address and we shall reach out to you on the same. 

Have a good day!

Badge

Troubleshooting API-related issues can be a bit complex, but let's try to identify potential causes for the "400 - Bad Request" error when using Zapier to POST a file to the FreshworksCRM API.

  1. Request Headers: Double-check the headers in your Zapier configuration to ensure they match the headers you are using in Postman. Specifically, confirm that you have the correct Authorization header and Content-Type header with the appropriate values.

  2. Authorization: Ensure that the API token ({{APItoken}}) you are using in the Authorization header is valid and has the necessary permissions to perform the file upload operation.

  3. File Upload: Since you are trying to upload a file from Google Drive, make sure you are handling the file upload correctly in Zapier. It's essential to provide the correct file data in the request.

  4. Boundary: The "boundary" value in the Content-Type header is specific to the multipart/form-data format. Check if Zapier automatically handles the boundary for you when you select the file to upload. If you manually need to set the boundary, ensure it matches the one used in Postman.

  5. Parameters: Verify that the targetable_id and targetable_type parameters are provided correctly in the request body. Ensure they have the appropriate values expected by the FreshworksCRM API.

  6. File Size Limitations: Check if the file you are trying to upload exceeds any size limitations set by the FreshworksCRM API. Some APIs impose limits on the file size that can be uploaded.

  7. URL Encoding: Make sure that any data being sent in the request (such as targetable_id and targetable_type) is properly URL-encoded, especially if they contain special characters or spaces.

  8. API Endpoint: Confirm that you are using the correct API endpoint URL in Zapier. Even a small typo in the URL can lead to a "Bad Request" error.

  9. SSL/TLS Compatibility: Ensure that Zapier and FreshworksCRM API support the same SSL/TLS protocol versions to establish a secure connection.

  10. Zapier App Version: Sometimes, new updates or changes to Zapier apps can cause issues. Check if there are any reported issues or updates related to the FreshworksCRM integration on Zapier.

If you have thoroughly reviewed all the above points and are still encountering issues, you might want to reach out to FreshworksCRM support again, providing them with as much detail as possible about the request you are trying to make using Zapier. They might be able to assist you further in identifying the cause of the "400 - Bad Request" error. Additionally, you could also try using Zapier's debugging tools or logging features to get more insights into the request being sent from Zapier to the FreshworksCRM API.

 

 

Reply