Hey @marino – both the
configure and the
initialize calls happen when inserting the App into the message. This happens for a few reasons:
When you’re creating a message in Intercom you specify a set of filters (for auto messages) or the user(s) (for manual messages).
In the case of auto messages
The filters specified at message creation are only used to call up the list of matching users at the moment of sending. We do this to ensure that only the users that currently match the message at the time of send are actually sent the message. Because of this the
initialize call needs to happen at message creation – otherwise the following three things could happen:
- You might store app canvas data for users that won’t receive the message
- Or not have canvas data for users who will receive the message
- Or you could have incorrect data for users that receive the message because their user data has changed in the intervening time period between message creation and send.
In the case of manual messages
While you already know the list of users who will receive the message, case 3 above still applies.
Ok, that makes sense. But my app shows custom content based on user data.
For apps that need to customer card content based on the user that the app is being shown to the suggested (only?) way to do this is to use the
live canvas endpoint and store some degree of state on your side about how far a given user has gone through the flow of your app (otherwise you’ll continue to reset the card to it’s initial view each time the messenger or your app reloads).
Hopefully all of this makes sense. I’ve gone pretty detailed here in the hopes that this is helpful for others that come across this same issue.