Shopify Flow with custom triggers in Engage

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

  1. Login and go to to Administration > Configure Engage
  2. Go to the Custom Triggers page
  3. Create a new custom trigger
  4. Input the required values. Example:
    • Name: “Gender - Shopify tags”
    • TriggerId: “genderTags“ 
    • Description: “Set gender labels in Voyado Engage“
  5. Create a new field. Example:
    • Name: “gender"
    • Description: “Gender“
  6. Save the trigger
  7. Create a new automation
  8. Pick the custom trigger you just created from the list of triggers
  9. Add a value split in your automation workflow
  10. Input the expected values coming from Shopify Flow and select “Ok”
  11. Add a “Set label“ activity in each leg of the split
  12. Now activate the automation

custom-trigger-shopify-flow-01.png

Do this in Shopify

  1. Create a new flow in Shopify Flow
  2. Choose a trigger (Example: “Customer tags added”)
  3. Add the action “Flow” > “Send HTTP Request“
  4. Choose “POST“ as the HTTP method
  5. Input the Request URL below in the URL field. Remember to replace “[tenantId]“ with the actual name of your tenant
  6. 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
  7. 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
  8. Activate the workflow

custom-trigger-shopify-flow-02.png

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"
}

 

 

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.