closeio / closeio-node

An Unofficial Close.io API wrapper for Node.js.
18 stars 17 forks source link

Support adding leads to email sequences #21

Open cypris75 opened 5 years ago

cypris75 commented 5 years ago

The wrapper supports creating sequences but not adding contacts to sequences.

The wrapper should support the following API endpoint:

https://app.close.io/api/v1/sequence_subscription/

e.g. https://developer.close.io/#email-sequences-subscribe-a-contact-to-a-sequence

cypris75 commented 5 years ago

Added PR here: https://github.com/closeio/closeio-node/pull/22

taylorbrooks commented 5 years ago

Good to close?

cypris75 commented 5 years ago

@taylorbrooks Can you check the status code please which is returned from the https://app.close.io/api/v1/sequence_subscription/ endpoint? I think it returns 201 instead of 200 which is technically correct however the script expects 200 to not throw an error.

cypris75 commented 5 years ago

Fix would be to also allow 201 to the if statement:

if (!error && (response.statusCode === 200 || response.statusCode === 201)) {
      d.resolve(JSON.parse(body));
      return;
    }
cypris75 commented 5 years ago

Any update on this one?

taylorbrooks commented 5 years ago

Will you open up a PR for that fix and I can test and merge?