Issue with Control Flow - If Statement in User Onboarding Automation

I’m experiencing a problem with an if statement in an automation sequence for onboarding users to our app. Our process involves the following steps:

  1. Users are invited to our app via text message.
  2. Once they download and log in, our database updates their status to "onboarded: true".
  3. Our sequence includes four text messages, and before each message is sent, the system should check if the user’s onboarded status has changed.

Issue:

  • The if statement is supposed to retrieve the profile information of the user based on the recipient ID. However, it’s not fetching this data correctly.
  • Regardless of whether we trigger the automation via API or directly through the studio, the process fails. As soon as it hits the control flow node that contains the if statement, the user is kicked out of the sequence.

Error Message:

{
  "message": "Invalid step definition"
}

Here’s a screenshot of the problematic node for reference.

image

I’ve reviewed the following documentation (and more, but the forum only lets me add two links) but haven’t found anything specific about sourcing profile information in this context.

Questions:

  1. Is there a specific method or syntax required for fetching user profile data in control flow nodes?
  2. Could there be an issue with how the recipient ID is being passed or used in the sequence?
  3. Are there known issues or limitations with the if statement in Courier’s automation sequences that I should be aware of?

Any insights or suggestions would be greatly appreciated, as this issue is critical to our user onboarding process.

Thank you!

Unfortunately, the profile is not automatically loaded in an Automation. If you wanted to populate it, you’d need a Fetch Data step. We’ve seen customers hit the Courier REST API as part of that fetch data step using a JS String in the URL.
Assuming you are invoking the Automation with the user_id in profile.user_id, a Fetch Data step could be configured like:

Method: GET 
URL: ${`https://api.courier.com/profiles/${profile.user_id}`}
Headers: Authorization: Bearer <Your API Key>

Well, that is a creative solution I didn’t think of… :thinking: Interesting.

Seems very strange to have to go to the API to get this info… but we’ll try to work with it.

Thanks for the reply!

I thought the same thing when I first encountered this problem. However, an Automation can be triggered without context or with lists, audiences, webhooks, segments, etc. It doesn’t inherently know you are triggering for a user. We have on our medium-term roadmap for Shared Data Source; which can encompass an easier way to access metadata from Courier.

Got it, thanks for that follow up.

Maybe what I should be asking… am I doing this right? ha. Should I not be handling if statements based on single user profiles in the automation? What are others doing?

I just feel like maybe I’m headed down a difficult path and if I were to do it another way it might be easier.

Thanks @bryan!