Contacts search API: using event data to filter contacts is not possible?

Is it possible to filter contacts based on events that have?

I’m working on UI application, that has some buttons inactive, e.g. with padlock icons on them. Whenever user clicks on such button, we show him a modal window, offering him to upgrade his account.

In the UI, we’re sending two events here:

  1. When modal is open:

    Intercom("triggerEvent", "modalOpen", { feature: "activity-feed" })
  2. When “Accept” button is clicked in the modal:

    Intercom("triggerEvent", "offer-accepted", { feature: "activity-feed" })

Now, with API, I’d like to fetch all users who:

  1. opened modal,
  2. opened modal and clicked “Accept” button.

~Seems like this can be done from the UI, but~ I cannot see a way to do it using API. What am I missing?

Upd. Seems like relying on event metadata is not possible from the UI either. At this point I feel like I must be solving the problem at hand incorrectly. I open to any suggestions of how to segments contacts in my case.

do you use Segment? Fetch the events from your data warehouse. Or get a Segment Peronsas subscription and grab it from their via API.

Or, maybe the “event.created” webhook could be a raw stream of events and your service can filter for this?

@nielsfogt thanks. Segment too expensive for us.

Using webhook is an of course option, but in this case we might as well just send the event data directly on our own API server bypassing Intercom altogether.

The key thing here was to understand if we can run reports on contacts based on their event metadata, and that doesn’t seem like possible at all (see my update to OP).

@eugene ya, Intercom has been lacking the ability to use event meta data in any meaningful way for quite some time. We ended up having a very flat event structure at my last place b/c of this and it’s honestly not a great route to go (esp if you’re using systems outside of Intercom like Segment or your own service) since it makes it much harder to query these sorts of things in aggregate (e.g., of all my modal opens, what % accept offer?).

Frankly I’d set it up to bypass Intercom. I just don’t think using them as a sudo Segment like data source is a good long term solution.

If you’re hell bent on it, one possible way to do this could be to set up a user segment that looks for the generic events happening in some defined time frame (e.g., last 7 days) then call that segment via API to find the user ids who fall underneath it, then loop through them and call the list all data events endpoint for each user in the segment. That’s a quick off the cuff response, so of course would need to walk through that in a bit more detail to see if it would be viable.