Skip to content

Escaping quotes in requests #112

@danielpadmore

Description

@danielpadmore

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions