showNewMessage not working until Intercom widget is opened | Community
Skip to main content

I use the @intercom/messenger-js-sdk in react app

showNewMessage does not insert prePopulatedContent if the intercom chat has not been opened yet
showMessages also doesn't work.

showNewMessage just opens a new chat on the first call, then it starts inserting prePopulatedContent. For testing, I'm using a constant as a prePopulatedContent. However, if you open the Intercom widget, the prePopulatedContent is inserted the first time.

 

Versions:
"@intercom/messenger-js-sdk": "^0.0.14",

"react": "18.3.1",

Hey ​@Егор Рудаков 👋 Jacques here from Intercom Support. I hope all is well today!

The behaviour you are seeing is a known limitation: showNewMessage with prePopulatedContent will only insert the content if the Messenger is already open or fully initialized. On the first call, it may only open the Messenger, and only subsequent calls will insert the content. The recommended workaround is to ensure the Messenger is open before calling showNewMessage with prePopulatedContent, or to use event hooks to wait for readiness.

If you need more robust handling, consider implementing a state check or delay to ensure the Messenger is ready before attempting to pre-populate the message.

If you need more help, I’d recommend reaching out to our support team via the Messenger so they can dig deeper into things for you here! :)


Reply