Is it possible to get a conversation’s updated_at datetime from the Plugin SDK?
No, that’s not currently exposed via the Plugin SDK (Feel free to share a feature suggestion if you would like to see this data added)
What is it you’re trying to learn about the conversation from it’s updated_at timestamp?
The aim is to determine if the conversation has changed, since contextUpdates will trigger twice on conversation change. But also in order to be able to cache some elements without having to reacquire them on conversation revisit.
Perhaps there is another way determine if the context.conversation has changed?
Front.contextUpdates.subscribe(async (context) => {
switch(context.type) {
case 'singleConversation':
console.log('singleConversation will trigger twice on conversation change');
break;
}
});
The context event should only send once on a context change. Is it possible you’re experiencing something like this → sentry.io/answers/react-useeffect-running-twice ?
Something you could do to help cache data is generating an md5 hash of the context.conversation
object to use as a cache key; this can allow you to cache your external API result based on a given conversation state.
Depending on what data you send to your API, you may need to include other Front conversation data in that cache key generation step, such as the latest message ( via Front.listMessages() ) etc.
Reply
Login to the community
No account yet? Create an account
Use your Front credentials
Log in with FrontEnter your E-mail address. We'll send you an e-mail with instructions to reset your password.