User chat matching

Hi Guys,

I had a question around how I could set up backend workflows to match users based on a couple of conditions.
My app (a debating app) currently collects users’ survey data and place each of their answers into the database as a thing ‘Answer’. Below is an example of the answers belonging to user X (forgive my formatting :sleepy: )

Step 1. I want a backend workflow to place user X in a chat with user Y at a specific time of the day. User Y can be any user that:

  • Has filled out the survey (I could use answer count > 0 here)

  • **Has an answer that directly opposes an answer that user X has. For example, User Y should Strongly Agree with the question Sport 3 (it can be any question they have both answered). Bubble then uses the selected ‘Trigger Question’ for Step 2 below **

Step 2. If the random selection was based on Sport 3, the final step would be to push one of a list of specific ‘Sport 3’ news stories to that conversation.

The second condition of Step 1 (text in bold) is turning out to be quite difficult for me, so any help on it would be much appreciated.
Also, is there any way to fetch (Step 2) news stories using an API, so that I don’t have to manually update the database of available news stories that my workflow picks from?

Many thanks in advance!

Sam

1 Like

For 1.

You will need to kick off an API Workflows for this.

So for all users, you run an API workflow that would then iterate on the answers and build a list of matching Users.

For all Users that have answered > Schedule API on that List > All responses > Schedule API on THAT list. Do a search for Answers with an opposite, and store the User who made that.

I would be tempted to store the responses as something like -3,-2,-1,0,1,2,3 so that you can * -1 to get the value you want.

News story APIs are common. You can use the API connector to do that. Just find one you like.

1 Like