Hey@kartikey chauhan! Oséas here from the Support Engineering team ️
I can’t say for sure why your current solution is not working consistently as I would need to investigate a few examples where this has happened to confirm if there’s indeed a delay blocking your bots. However, a more robust solution would be using event triggers instead of custom attributes (e.g. product_type) to trigger these bots.
For this, you would need to create a logic on your end to fetch the ID, associate it with the product type and then trigger an event in Intercom using the method Intercom('trackEvent', 'event-name'); from our JS API. Once you have this set, you will need to edit your bot’s rule to trigger every time this event happens. You can find more information on how to use event trigger based messages here.
Hope that helps!
Hey @Oseas,
Thanks for the reply.
We are unable to use event trigger based messages for our use case. We want to select the custom bot once we know the product_type, but only open the chat window if the user clicks on the intercom icon.
So effectively we want.
1. product_type fetched/computed.
2. Intercom custom bot selected programmatically based on product_type.
3. Use the custom bot if the user/lead clicks on the intercom icon.
The issue with using data attributes was product_type persistence on the user even on other pages.
So what we are effectively looking for is short lived conversation state which decides what custom bot should be used.
One hacky workaround I can think of to achieve this behavior is by overlaying the intercom icon with a div and have custom bots based on “When a customer clicks on a website element”.
I can then set css classes on custom div programmatically, use these in the custom bot rules, and have different different bots are invoked based on current context.
Is there anything better that I can do, or am I missing something?
Thanks!
Hey @kartikey chauhan, I’m not sure if this workaround would do the tricky as I never tested it myself. We usually advise against manipulating the Messenger with CSS as this might break other features in your Messenger.
Would be an option for you to add an URL rule instead? So you can show the bot depending on the ID. Although this would only work if you have any kind of pattern in your ID or if you don’t have many different IDs.