Answered

REST API - Weird/incorrect Search results

  • 10 November 2022
  • 1 reply
  • 26 views

I'm using the REST API to Search for Contacts/Conversations, with filter condition on the updated_at timestamp.

 

What I need is to find all Contacts having updated_at on 2022-11-09 UTC (i.e 1667952000 <= updated_at < 1668038400, in which 1667952000 is 2022-11-09T00:00:00Z). However, no matter how I build the query, either using the simple equal operator (as per Intercom's doc about search & timestamp), or using the complex AND/OR/</=/> operators, I always get some results having updated_at on 2022-11-08.

 

It looked like to me that when truncating the timestamps to date, the server used my timezone (UTC+10), so instead of giving me results between 2022-11-09T00:00:00+00:00 and 2022-11-10T00:00:00+00:00, it gave me results between 2022-11-09T00:00:00+10:00 and 2022-11-10T00:00:00+10:00.

 

This is an unexpected/unwanted result for me. Is there anyway to fix that?

Thanks

icon

Best answer by Oseas 14 November 2022, 19:15

View original

1 reply

Hey @user2014​! Oséas here from the Customer Support Specialist team 🕵️

 

I totally agree with you. If we ask for Unix timestamp to construct queries, is unexpected that it automatically converts it to your workspace timezone and does not remain in UTC. This is an issue our team is aware of and we've decided to take the safer option of releasing a fix with a new API version in the future.

 

Could you please reach out to us via the Messenger so we can add your case to the report? Just make sure to inform the open issue name which is "Contacts search using timestamp transforms date into workspace timezone" and mention this post in the forum. Once we add the conversation to the open bug report, any updates made will generate a notification and we'll be able to notify you once it's fixed in the new API version.

 

Thank you very much for flagging this to us - really appreciate it 🙏 

Reply