-
Notifications
You must be signed in to change notification settings - Fork 36
Escaping quotes in requests #112
Copy link
Copy link
Open
Labels
Description
We have come across an issue where the customer.io client fails to send notifications when quotes are included in the payload.
For example, when sending a payload like this:
const trackClient = new TrackClient(
process.env.CUSTOMERIO_SITE_ID,
process.env.CUSTOMERIO_API_KEY
);
trackClient.track('some_user_id', {
name: 'notify',
data: {
'title': 'My Title "Just Will Not Work" With Quotes Included',
},
});The notification will result in an "attempted" status with reason:
Custom payload is invalid JSON: invalid character 'J' after object key:value pair
I believe this is due to the quotes not being escaped by the client before the request is sent.
We are applying a fix for this prior to client use by escaping the quotes before the track call. But I wanted to flag this as a potential feature to add so others aren't caught by the same issue.
Reactions are currently unavailable