We are trying to use official @intercom/messenger-js-sdk with our react app.
https://www.npmjs.com/package/@intercom/messenger-js-sdk
We are calling Intercom instance in our App component
Intercom({
app_id: ...,
});
and then updating user info when user data is available using following functions:
import { boot, shutdown, update } from "@intercom/messenger-js-sdk";
when there is no user data we are calling boot with only id,
boot({
"app_id": "...",
})
and if there is user data, we are passing required properties to boot function
boot({
"app_id": "...",
"user_id": "...",
"name": "...",
"email": "...@......",
"created_at": ....,
})
It seems that when calling with boot({ "app_id": "..."}), user data is not cleared and in chat we continue to receive messages as if user is still logged in.
Once boot() is called with user data, can it be rebooted with no data (for example, in scenario if user is logged out from our app and we want new chat instance without user data)?
Also, if the boot function is called before Intercom({ id: ... }) finishes initialising, Intercom functions (boot, shutdown, update) cease to work indefinitely and completely. This issue is evidenced by the lack of network calls when inspected, and the shutdown function failing to close the widget.
use case:
import Intercom from "@intercom/messenger-js-sdk";
function App() {
...
Intercom({
app_id: ...,
});
...
// custom hook that utilises Intercom functions
useIntercomInit(userData);
...
When using unofficial https://github.com/devrnt/react-use-intercom , everything seems to work without problems. Is there a way to resolve and achieve this with official sdk - @intercom/messenger-js-sdk?