customerio / customerio-ruby

A ruby client for the Customer.io event API.
https://customer.io/docs/api/
MIT License
64 stars 75 forks source link

Updating A Customer Using cio_id Replaces id Attribute #78

Closed mikefey closed 7 months ago

mikefey commented 2 years ago

If there is a workspace that uses both id and email as identifiers, then the cio_id must be passed as the id in order to update the email:

{ id: "cio_<customerio id>", email: "email@test.com" }

This works fine, but then passes the id attribute in the request body, which results in the customer's id attribute also being updated to "cio_<customerio id>". It doesn't seem possible to use the "cio_<customerio id>" in the customer url and not overwrite the id attribute for the customer.

It seems like whichever attribute key is used here (in this case :id) to build the customer_path should not be automatically included in the request body.

richdawe-cio commented 7 months ago

Thanks for reporting this issue.

This issue has been resolved in a couple of ways now in the Ruby client library:

  1. Since release 5.2.0 (PR: https://github.com/customerio/customerio-ruby/pull/109 ), if you include the cio_id in the attributes to the identify method, it will use that in the Track API call to identify the person. In this case, no prefix is required on the value of cio_id.

  2. Since release 5.3.0 (PR: https://github.com/customerio/customerio-ruby/pull/111 ), there is a new customer_id attribute for the identify method, which allows you to specify whichever identifier you want to identify the person. It can be id, cio_id (prefixed with cio_) or email.

Please see README.md for some examples.

I'm going to close this issue, since I believe it's. If you have any further problems, please feel free to comment on or re-open this issue.