With Shopify Flow’s “Send HTTP request“ action, you can trigger a marketing automation in Engage and build user journeys based on the various customer activities in Shopify.
This example looks at how to synchronize selected customer tags from Shopify to Engage and link them to a contact. By configuring a custom trigger in Engage and invoking that trigger within Shopify Flow, you will be able to associate tags as labels in Engage.
To make this happen, follow the steps in both sections below.
Do this in Engage
- Login and go to to Administration > Configure Engage
- Go to the Custom Triggers page
- Create a new custom trigger
- Input the required values. Example:
- Name: “Gender - Shopify tags”
- TriggerId: “genderTags“
- Description: “Set gender labels in Voyado Engage“
- Create a new field. Example:
- Name: “gender"
- Description: “Gender“
- Save the trigger
- Create a new automation
- Pick the custom trigger you just created from the list of triggers
- Add a value split in your automation workflow
- Input the expected values coming from Shopify Flow and select “Ok”
- Add a “Set label“ activity in each leg of the split
- Now activate the automation
Do this in Shopify
- Create a new flow in Shopify Flow
- Choose a trigger (Example: “Customer tags added”)
- Add the action “Flow” > “Send HTTP Request“
- Choose “POST“ as the HTTP method
- Input the Request URL below in the URL field. Remember to replace “[tenantId]“ with the actual name of your tenant
- Add the request headers as shown in the section "Request headers" below. Remember to replace the value of apikey with the API key provided to you by the Voyado team
- Add the body and loop through the tags you want to send over to Engage. Remember to change the name of the “gender“ field to something more relevant if you are syncing tags that are not related to this specific use-case
- Activate the workflow
Request headers
apikey: 00000000-0000-000-000000000000
Content-Type: application/json
Request URL
This URL triggers the custom trigger endpoint by using the Shopify ID which is linked to the externalId field in Voyado Engage.
https://[tenantId].voyado.com/api/v2/automation/customTriggers/[TriggerId]/triggerByExternalContactId/{{customer.id | remove_first: "gid://shopify/Customer/"}}
Remember to replace the [tenantId] and [TriggerId] in the URL with your values.
Payload body in Shopify Flow
The request payload loops through all the tags of a customer in Shopify and checks for a matching tag defined in the payload.
The for-loop code example below checks if a customer has any of the tags: “Male“, “Female“ or “Other“ and sends it through to Engage as "gender":
{
"gender" : "{%- for tags_item in customer.tags -%}
{%- if tags_item contains "Male" -%}
{{tags_item}}
{%- elsif tags_item contains "Female" -%}
{{tags_item}}
{%- elsif tags_item contains "Other" -%}
{{tags_item}}
{%-endif -%}
{%- endfor -%}"
}
The code example above results in a request payload to Engage that looks like this:
{
"gender" : "Female"
}
Comments
0 comments