Splitting the Workflow Depending on the Event Parameters

The Condition block allows you to split the workflow depending on the parameters of the event that launched the workflow. These can be the following parameters:

  • Category of the site visited by the contact
  • City of residence
  • Clothing size
  • Product preferences
  • Gender

For example, you need to send emails with selections of products for men and women, depending on gender, the value of which is passed in the event by the Generate event API method:

{  
    "eventTypeKey": "event_name",  
    "keyValue": "[email protected]",  
    "params":  
    [  
        {  
            "name": "EmailAddress",  
            "value": "[email protected]"  
        },  
        {  
            "name": "Name",  
            "value": "John"  
        },  
        {  
            "name": "lang",  
            "value": "EN"  
        },  
        {  
            "name": "gender",  
            "value": "M"  
        }  
    ]  
}

Workflow Settings

  1. Create a workflow with two Condition blocks that check the event parameters and send the contact to the appropriate branch. An example of such a workflow:
Workflow example
  1. Set up the first Condition block:
    1. Select Variable matches regular expression in the Task name field to check the contents of the gender parameter.
    2. Add the name of the validation parameter in the name field, in our case, it is gender.
    3. Specify the value of the request parameter in the pattern field in the following format (M - male):
    .*M.*
    
Block settings

๐Ÿ“˜

Important

The case of the letter in the pattern field must match the case of the letter in the event parameters.

  1. Add the second Condition block to the workflow with the same settings as the first one, but with the pattern field in the following format (F - Female):
.*F.*
Block settings

If the event parameters match the value specified in the first condition, contacts will go along the Yes branch; if not, they will go to the next checkpoint.

Contacts without gender specified in the request will go through the third workflow branch.

Similar article: