segmentio / segment-docs

Segment Documentation. Powered by Jekyll.
https://segment.com/docs/
Creative Commons Attribution 4.0 International
46 stars 324 forks source link

Update index.md #6792

Open joeynmq opened 3 days ago

joeynmq commented 3 days ago

Proposed changes

The customer encountered the 409 Conflict error when sending Identify events to Klaviyo.

Having reviewed our integration code here, we will first attempt to create a new profile in Klaviyo. If the first request returns with a 409 error code, we will then send a second request to update the existing profile with the given profile ID

const profile = await request(`${API_URL}/profiles/`, {
  method: 'POST',
  json: profileData
})

...

if (response?.status === 409) {
   const profile = await request(`${API_URL}/profiles/${id}`, {
      method: 'PATCH',
      json: profileData
   })

Merge timing

ASAP once approved

Related issues (optional)

https://segment.atlassian.net/browse/KCS-1535