Issue with JSON Formatting in invokeURL task

Issue with JSON Formatting in invokeURL task

Hello Zoho Community,

I'm reaching out for assistance with an issue I've encountered while trying to integrate Zoho with HubSpot using a webhook trigger. Despite following documentation and trying various configurations, I consistently encounter an "Error 415 Unsupported Media Type" when making a POST request to a HubSpot webhook URL from Zoho Deluge.

Here's a detailed look at the attempts I've made, including the exact scripts used and the errors encountered:

First Attempt:
Objective: Trigger a HubSpot workflow via a webhook trigger with a JSON body.
Method: Passed parameters as a map directly in Deluge.

param = Map();
param.put("text", "hello world");
forward_ticket_info = invokeurl
[
    type :POST
    parameters:param
];
Error Received: HTTP ERROR 415 Unsupported Media Type.

Second Attempt:
Method: Attempted passing parameters as a JSON string in Deluge.

param = Map();
param.put("text", "hello world");
jsonString = param.toString(); // Assuming conversion to JSON string
forward_ticket_info = invokeurl
[
    type :POST
    parameters:jsonString
];
Error Received: HTTP ERROR 415 Unsupported Media Type.
Note: This snippet assumes an attempt to convert the map to a JSON string. Deluge script may require a specific method to correctly serialize the map to a JSON string format.

Third Attempt:
Method: Explicitly setting the Content-Type header to application/json in Deluge.

param = Map();
param.put("text", "hello world");
head = Map();
head.put("Content-Type", "application/json");
forward_ticket_info = invokeurl
[
    type :POST
    parameters:param
    headers: head
];
Error Received: HTTP ERROR 415 Unsupported Media Type.

For comparison, executing a similar request with a raw JSON body format in Postman triggers the webhook successfully. This discrepancy suggests the issue may lie in how Deluge formats or sends JSON bodies and headers.

Given these attempts and the persistent error, I suspect there may be specific requirements for JSON bodies and headers in Deluge that I am not aware of, or there might be a limitation or bug affecting this integration.

I would greatly appreciate any insights, guidance, or suggestions on:
  1. The correct method to format and send JSON bodies in POST requests from Deluge to external webhooks.
  2. Any specific headers or configurations required to ensure the content type is correctly recognized.
  3. Known issues or limitations with Deluge's invokeurl method that might be relevant to this issue.
Your support in this matter is immensely appreciated, as it is crucial for our integration project. Looking forward to any advice the community can offer.

Best regards,

Lars

    Zoho Desk Resources

    • Desk Community Learning Series


    • Digest


    • Functions


    • Meetups


    • Kbase


    • Resources


    • Glossary


    • Desk Marketplace


    • MVP Corner


    • Word of the Day


      Zoho CRM Plus Resources

        Zoho Books Resources


          Zoho Subscriptions Resources

            Zoho Projects Resources


              Zoho Sprints Resources


                Zoho Orchestly Resources


                  Zoho Creator Resources


                    Zoho WorkDrive Resources



                      Zoho Campaigns Resources

                        Zoho CRM Resources

                        • CRM Community Learning Series

                          CRM Community Learning Series


                        • Tips

                          Tips

                        • Functions

                          Functions

                        • Meetups

                          Meetups

                        • Kbase

                          Kbase

                        • Resources

                          Resources

                        • Digest

                          Digest

                        • CRM Marketplace

                          CRM Marketplace

                        • MVP Corner

                          MVP Corner




                          Zoho Writer Writer

                          Get Started. Write Away!

                          Writer is a powerful online word processor, designed for collaborative work.

                            Zoho CRM コンテンツ




                              ご検討中の方