In this fifth post we will update the original flow that we created for when a new attendee is registered in Eventbrite. Your flow should have a couple of steps as the baseline. The steps include When a HTTP request is received, and the Initialize Variable action.
When the Webhook calls the flow, there are certain values that are being passed. One of those values is the action that is being performed (under the config section of the json file). We start by initializing the variables based on the data that is provided from the HTTP Request. The three variables that we are able to initialize are the Action Type, Event Number and Attendee Number (as shown below):
The following tables shows the values of the three variables that we initialized:
Variable Name |
Value |
Action Type |
first(split(triggerBody()?[‘config’]?[‘action’],’.’)) |
Event Number |
first(split(last(split(triggerBody()?[‘api_url’],’events/’)),’/’)) |
Attendee Number |
first(split(last(split(triggerBody()?[‘api_url’],’attendees/’)),’/’)) |
We next initialize the Event Id and Contact Id variables. These variables do not have a value at this point, and they are retrieved from the Common Data Service connector when looking for matching events and attendees.
The next step is to validate the action type and make sure that the action type is Attendee. Since this flow is only called from the webhook directly, we probably can bypass this, but this is still good practice.
The no condition will just terminate the flow, while the yes condition will go through the steps of retrieving the attendee information from Eventbrite, and retrieving any attendees that match the attendee number from CDS. We then call an additional condition action to check for the number of results from the retrieval of contact records from CDS. The flow looks like this:
The condition expression to check for the number of results is: length(body(‘Retrieve_contacts_matching_Attendee_Number’)?[‘value’])
The results of this condition will determine if we update the existing Contact record or create a new contact record. The yes condition result will call the Update Contact, while the no condition result will retrieve the eventid, and create a new attendee (contact) record.
1 – PREREQUISITES | 2 – EVENTBRITE SETTINGS | 3 – CUSTOM CONNECTOR | 4 – EVENT FLOW | 5 – ATTENDEE FLOW | 6 – TESTING