-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix aliasing #40
base: main
Are you sure you want to change the base?
Fix aliasing #40
Conversation
@@ -148,14 +146,12 @@ export const onEvent: Plugin<CustomerIoPluginInput>['onEvent'] = async (event, m | |||
} | |||
|
|||
async function syncCustomerMetadata(event: ProcessedPluginEvent, storage: StorageExtension): Promise<Customer> { | |||
const customerStatusKey = `customer-status/${event.distinct_id}` | |||
const customerStatusKey = `customer-status/${event.person.uuid}` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would that not break existing users?
If we want to do this we can, we might just want to roll this out as a separate v2 app
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True. If there's demand we could also write a one-off script that will fetch the person UUID for every distinct_id inside of customer.io and merge it into that.
index.ts
Outdated
// Create or update customer | ||
// See https://www.customer.io/docs/api/#operation/identify | ||
await callCustomerIoApi('PUT', host, `/api/v1/customers/${id}`, authorizationHeader, customerPayload) | ||
|
||
if (['$identify', '$merge_dangerously'].includes(event.event) && !event.$merge_blocked) { | ||
const secondaryId = event?.properties?.$anon_distinct_id ?? event?.properties?.alias | ||
const mergeUserPayload = { primary : { id: event.distinct_id }, secondary: { id: secondaryId }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how does this work with the person.uuid usage change above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah this only works on the first identify, since the person UUID inside of PostHog isn't changing, but not for additional identify or merge_dangerously events. We'll need to convert this distinct_id
into the PostHog UUID. Should I just call http://localhost:8000/api/projects/1/persons?distinct_id=9fe3478a-3e19-4c7b-8c93-f0bc32b45341
inside of the plugin? That will require me to have some kind of access as well.
No description provided.