Escape quotes in Webhook payload

I have…

I’m submitting a…

  • [ ] Regression (a behavior that stopped working in a new release)
  • [ ] Bug report
  • [ ] Performance issue
  • [ x] Documentation issue or request

Current behavior

Hi,

If have a web hook for my app that sends my system updates on changes made in the CMS.
In our custom payload we include the title of the content item that was changed.

{
                        "type": "${CONTENT_TYPE}",
                        "contentId": "${CONTENT_ID}",
                        "modifiedBy": "${USER_ID}",
                        "libraryId": "${APP_NAME}",
                        "contentTitle": "${CONTENT_DATA.title.iv}",
}

The above snippet is what is configured in squidex.
This works for most payloads, however if I include a title like my "title it breaks the JSON.

Is there anyway to configure the web hook to escape the data in custom fields?

Thanks
Max

You can use

{ 
   "type": "${CONTENT_TYPE | escape}",
   "contentId": "${CONTENT_ID | escape}",
   "modifiedBy": "${USER_ID | escape}",
   "libraryId": "${APP_NAME | escape}",
   "contentTitle": "${CONTENT_DATA.title.iv | escape}",
}

I have improved the docs for that:
https://docs.squidex.io/02-documentation/developer-guides/rule-formatting/simple#filters

2 Likes

Thanks that did the trick :slight_smile: