HELP! Customer-Activity Association Issue in Bubble WhatsApp Workflow

I’m developing a customer management system in Bubble that integrates with WhatsApp message reception. The goal is to log each WhatsApp message as an activity and associate it with the corresponding customer. If the customer doesn’t exist in the database (based on phone number), the system should create a new one.

Current Workflow:

  1. Create a new activity for WhatsApp received:
  • Activity type: WhatsApp received
  • Activity date: Current date/time
  • Activity description: Request Data’s body
  • Phone number: Request Data’s from:find & replace (to remove extra characters)
  • Associated customer: Empty (to be updated later)
  1. Check if customer exists:
  • Action: Search for Clienti (Search for Customers)
  • Constraints: Phone number = Request Data’s from:find & replace
  • Only when: Search for Clienti’s count > 0
  1. Update activity table with existing customer:
  • Thing to change: Result of step 1 (Create a new activity for WhatsApp received)
  • Field to change: Associated customer
  • Value: Search for Clienti’s first item
  • Only when: Search for Clienti’s count > 0
  1. Create new customer:
  • Type: Clienti (Customers)
  • Name: Request Data’s pushname
  • Phone number: Request Data’s from:find & replace
  • Only when: Search for Clienti’s count is 0
  1. Update activity table for new customer:
  • Thing to change: Result of step 1 (Create a new activity for WhatsApp received)
  • Field to change: Associated customer
  • Value: Result of step 4 (Create new customer)
  • Only when: Search for Clienti’s count is 0

Problem Encountered:

The workflow works correctly only for the first message received from a new customer. For subsequent messages, even if they come from different phone numbers, the system doesn’t create new customers and associates all activities with the first customer created.

Attempted Solutions:

We have tried various solutions, including:

  • Using “Result of step” and “:first item”: We tried to use the result of the customer search (Result of step 2’s Clienti) to update the activity. However, this approach is not supported in Bubble backend workflows.
  • Using Custom States: We tried to use custom states to store the customer’s ID, but this solution is also not applicable to backend workflows.
  • Moving “Only when” conditions: We tried rearranging the conditions for customer creation and activity update,but the problem persisted.
1 Like