Webhook Data Corruption

We have a webhook that publishes data to a Google Sheet. This data is base85 encoded binary blobs. As a result, the sequence {{ is valid and necessary. However, we are noticing that somewhere between the event arriving in Particle Console and the data being published in the Google Sheet, the character sequence “{{” is stripped from the data.

For instance, if we send only “{{” in an event, the integration generates the following:

{
  "name": "Sfin-5d0036001750483553353920-test_msg",
  "data": "{{",
  "published_at": "2022-07-20T06:23:11.363Z",
  "coreid": "[redacted]",
  "userid": "[redacted]",
  "version": 0,
  "public": false,
  "productID": [redacted]
}

In the Google AppSheet, we process the request, then do the following:

return ContentService
          .createTextOutput(JSON.stringify({"result":"success", "row": nextRow, "content": e}))
          .setMimeType(ContentService.MimeType.JSON);

Particle indicates the return data as such:

HTTP/1.1 302 Moved Temporarily
Content-Type: text/html; charset=UTF-8
Access-Control-Allow-Origin: *
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Mon, 01 Jan 1990 00:00:00 GMT
Date: Wed, 20 Jul 2022 06:23:13 GMT
Location: https://script.googleusercontent.com/macros/echo?user_content_key=tt436q-fVPd82_H4u2aXEy9kCbZtdScJVa5QkYYwQ5ObdSUE-dFqd26qG7wlLKAeqZRq7bjukgaKPOITuBPtFzRvBdp6AF3rm5_BxDlH2jW0nuo2oDemN9CCS2h10ox_1xSncGQajx_ryfhECjZEnMW5KRpnclU_1J4UKZIoSAquu0Z6O3y4Mo_QSM7nZTb0fNz4iM2LvklNf6P8Z0wEuI8h39H0GbmsBe5-hOqPw8Ab3dlq0gXm4dz9Jw9Md8uu&lib=MOvMODCsoIaoyKluNvoQ-q3fIv8Qt4ZAQ
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
Content-Security-Policy: frame-ancestors 'self'
X-XSS-Protection: 1; mode=block
Server: GSE
Alt-Svc: h3=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"
Accept-Ranges: none
Vary: Accept-Encoding
Transfer-Encoding: chunked

GQajx_ryfhECjZEnMW5KRpnclU_1J4UKZIoSAquu0Z6O3y4Mo_QSM7nZTb0fNz4iM2LvklNf6P8Z0wEuI8h39H0GbmsBe5-hOqPw8Ab3dlq0gXm4dz9Jw9Md8uu&amp;lib=MOvMODCsoIaoyKluNvoQ-q3fIv8Qt4ZAQ">here</A>.
</BODY>
</HTML>

0

{"result":"success","row":1425,"content":{"postData":{"contents":"event=Sfin-5d0036001750483553353920-test_msg&data=&published_at=2022-07-20T06%3A23%3A11.363Z&coreid=[redacted]&userid=[redacted]&fw_version=0&public=false","length":182,"name":"postData","type":"application/x-www-form-urlencoded"},"queryString":"","contentLength":182,"parameter":{"data":"","public":"false","published_at":"2022-07-20T06:23:11.363Z","coreid":"[redacted]","fw_version":"0","event":"Sfin-5d0036001750483553353920-test_msg","userid":"[redacted]"},"parameters":{"coreid":["[redacted]"],"published_at":["2022-07-20T06:23:11.363Z"],"event":["Sfin-5d0036001750483553353920-test_msg"],"userid":["[redacted]"],"fw_version":["0"],"public":["false"],"dat (truncated)

Note that the “data” field in the response is blank.

Is there a way to avoid this by reconfiguring the Particle integration? If not, how can we easily escape the “{{” sequence?

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.