Answered

Dynamically update widget within SPA

  • 28 September 2023
  • 1 reply
  • 51 views

Hi all,

 

After going through this article in the help center, we have implemented the update requests every time the URL changes in our SPA. I see the ping requests being made as expected.

However, the widget is not behaving as expected. Article suggestions & page-specific messages are not being triggered. The widget does not change at all from how it is on first page load.

As suggested in the article, I am just passing the last_request_at field, as no user data has changed, but I want the widget to update based on URL. I have also tried passing the user_id along but there is no difference.

 

Am I doing something wrong, or is this the expected behaviour?

 

The article seems to have contradicting information, which is a bit confusing: 

and later in the article:

 

Which one is correct? Any help is appreciated.

 

Thank you!

icon

Best answer by Jacob Cox 1 October 2023, 19:01

View original

1 reply

Userlevel 4
Badge +5

Hi @onurfesci 

I think those two messages that you sent are actually saying the same thing. The bottom message that you sent is saying that, for a SPA, Intercom will not recognize that the URL has changed unless there’s a page reload. Therefore, you will need to send the update call with an attribute with a changed value. This will re-ping Intercom like a page reload would, and will update the URL that the User is being seen on in Intercom. It will also then send any messages that the User now qualifies for.

 

That said, this won’t update the Messenger Home page, itself. For example, if you have an app that is supposed to appear in the Home page based on that update, it will also require an actual page reload for the Messenger to get reloaded. Let me know if you have any questions about that! 

Reply