Skip to main content
Question

Handling Asynchronous User Data Updates with Customer.io API


YourBestAccent

Hi,

I noticed that when identifying a customer in my backend like this:
 

await trackClient.identify(userId, {
  ...data,
  created_at: Math.floor(Date.now() / 1000),
})

I notice that immediately calling:

const response = await apiClient.getAttributes(userId, IdentifierType.Id)

 

returns stale data without my new attributes. This is expected since the identify call is asynchronous.

Here is my question:

Rather than polling the API (which feels unreliable), what's the recommended pattern to ensure my UI updates only after customer.io has processed the identify call and the new attributes are available? I'm using the JS sdk in an Express app.

2 replies

YourBestAccent

Any update here? This functionality makes us adding random sleep times in the code. We are considering switching away from customer.io because of the potential synching problems of our data with customer.io backend.

 

Please forgive me my previous message in this thread. It’s actually NOT expected not to receive the data immediately in my 

const response = await apiClient.getAttributes(userId, IdentifierType.Id)

contrary to what I wrote before. 

How to make sure that succesfully updated data (we get 200) is retrievable immediately.


  • Community Manager
  • 11 replies
  • March 14, 2025

Hi ​@YourBestAccent ! Thanks for raising this question. It looks like this will require further investigation, so our Support Team will be in touch via email shortly!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings