Freshdesk webhook issue for a Google Apps Script endpoint

Hi. I’m trying out Freshdesk webhook automations, and for a test setup, I created a web-app endpoint in Google Apps Script to receive ticket data from Freshdesk, the script is receiving the data successfully but for some reason the Google response to Freshdesk is an error response, even though when trying the same endpoint in Postman the response is sucessful.

These are the steps I followed with some screenshots:

  1. I created a Google Apps Script web app, with no authentication requirements for the purposes of this test. My script writes down the contents of the webhook request in a Google Sheets document, and responds with a 200 status and a success message.

  2. I tested the endpoint in Postman and it worked OK - the data sent in the body was written in the target document, and the response received from the endpoint was the success response.

  3. I created a Ticket Creation automation rule in Freshdesk. The request is POST method and sends some ticket fields (ticket ID, ticket description, etc.).

  4. I tested the rule by creating a ticket with the required filters in Freshdesk. The request was received sucessfully by the endpoint and ticket data was written in the target document.

  5. However, Freshdesk apparently received an error response from the endpoint, because it re-tried the request 4 times in total, and later sent to me an email alerting about the error response.

HTTP Status Code = 400,

Response Text = “\n\n \n <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">\n Error 400 (Bad Request)!!1\n \n {margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px} > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n \n <span](http://www.google.com/%3E%3Cspan) id=logo aria-label=Google>\n

400. That’s an error.\n

Your client has issued a malformed or illegal request. That’s all we know.\n”

The data received by the endpoint is straightforward and looks correct:

{"freshdesk_webhook":{"ticket_id":64562,"ticket_subject":"Ticket de Prueba Isaac","ticket_description":"<div style=\"font-family:-apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif; font-size:14px\"><div dir=\"ltr\">Este ticket es una prueba.</div></div>","ticket_tags":"ops_test","ticket_latest_public_comment":"","ticket_priority":"Low","ticket_source":"Phone","ticket_cf_n_pedido":"NA","ticket_cf_rut_cliente":"NA"}}

I contacted Freshdesk support and after reviewing these steps and the requests together, they sent me here to see if someone may help out with why Google may be sending the error response to Freshdesk, but sending a success response to Postman - when the two requests are theoretically identical.

Thank you.