> ## Documentation Index
> Fetch the complete documentation index at: https://algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Shopify Flow

> Track top searches and get notified with the Algolia triggers for Shopify Flow.

[Shopify Flow](https://help.shopify.com/en/manual/shopify-flow/) is an automation platform for your Shopify store.
It has two main parts:

* **Triggers** are events that start workflows.
* **Actions** are tasks, such as sending Slack messages or emails.

## Algolia triggers for Shopify Flow

The Algolia AI Search & Discovery app includes these triggers:

* **Top searches.**
  Track the most popular searches and the most viewed results.
  This trigger runs every day at 1 PM UTC.

* **Top searches with no results.**
  Track queries that returned no results.
  This trigger runs every day at 1 PM UTC.

* **Indexing paused.**
  This trigger runs when your Algolia indexing pauses.

## Set up workflows with Algolia

The following workflow notifies you through Slack messages and emails about your top searches.
For more information, see [Creating workflows in Shopify Flow](https://help.shopify.com/en/manual/shopify-flow/create-workflow/).

### Before you begin

Install the [Shopify Flow](https://apps.shopify.com/flow) app.
If you want to send Slack messages to channels, install the Flowbot app in your Slack workspace.

### Activate the trigger

To activate the trigger in the Algolia AI Search & Discovery app:

1. In your Shopify admin, go to the Algolia AI Search & Discovery app.
2. Open the **Shopify Flow** tab.
3. Activate the **Top Searches** trigger.

   <img src="https://mintcdn.com/algolia/aEHwQtyVTByx4c7q/doc/integration/shopify/going-further/13-shopify-flow-tab.jpeg?fit=max&auto=format&n=aEHwQtyVTByx4c7q&q=85&s=71882b390836b8e8c9583d085d0648d9" alt="Select the Top searches trigger in the Shopify Flow app" width="1382" height="582" data-path="doc/integration/shopify/going-further/13-shopify-flow-tab.jpeg" />

<Note>
  If you skip this step, you can still select the Algolia triggers in Shopify Flow,
  but no action will be performed unless you activate the trigger in the Algolia AI Search & Discovery app.
</Note>

### Configure the trigger

After [activating the trigger](#activate-the-trigger), you can use it in your workflows.

1. In your Shopify admin, select **Flow** in the **Apps** section of the sidebar.

2. Click **Create workflow**.

   <img src="https://mintcdn.com/algolia/TTlnKswkCK2YkCpC/doc/integration/shopify/going-further/shopify-flow.png?fit=max&auto=format&n=TTlnKswkCK2YkCpC&q=85&s=847c73048b741105fa82831249970f40" alt="Screenshot of the Shopify Flow page showing the 'Workflows' section with a highlighted 'Create workflow' button in the top right corner." width="2316" height="1060" data-path="doc/integration/shopify/going-further/shopify-flow.png" />

3. Click **Select trigger**, find the **Algolia AI Search & Discovery** app,
   and select the **Top Searches** trigger.

   <img src="https://mintcdn.com/algolia/TTlnKswkCK2YkCpC/doc/integration/shopify/going-further/select-trigger.png?fit=max&auto=format&n=TTlnKswkCK2YkCpC&q=85&s=9476bced8d68a06967c1e131024869cb" alt="Select the Top searches trigger for your workflow in the Shopify Flow app" width="2306" height="902" data-path="doc/integration/shopify/going-further/select-trigger.png" />

<Note>
  If you didn't [activate the trigger](#activate-the-trigger) yet,
  you can set up the workflow,
  but you won't receive any notifications.
</Note>

### Configure action: send Slack messages

When the trigger event is fired, you can perform one or more *actions*,
such as, sending a Slack message.

1. In the Shopify Flow app, click **Add action**.

   <img src="https://mintcdn.com/algolia/TTlnKswkCK2YkCpC/doc/integration/shopify/going-further/add-action.png?fit=max&auto=format&n=TTlnKswkCK2YkCpC&q=85&s=7d675378458881cf00f1cc68fd96da4b" alt="Connect your Slack workspace with your Shopify store" width="1006" height="454" data-path="doc/integration/shopify/going-further/add-action.png" />

2. Find the **Slack** app.

3. If it's your first time using the Slack action in Shopify, click **Connect**.

   <img src="https://mintcdn.com/algolia/TTlnKswkCK2YkCpC/doc/integration/shopify/going-further/slack-action.png?fit=max&auto=format&n=TTlnKswkCK2YkCpC&q=85&s=9c49e780c9af4d71d1fe1be41e963151" alt="Connect your Slack workspace with your Shopify store" width="2270" height="566" data-path="doc/integration/shopify/going-further/slack-action.png" />

4. Select the **Send Slack message** action.

   <img src="https://mintcdn.com/algolia/TTlnKswkCK2YkCpC/doc/integration/shopify/going-further/slack-action-connected.png?fit=max&auto=format&n=TTlnKswkCK2YkCpC&q=85&s=d9b5657b2d75a65a5dc1f9a337463c24" alt="Select the Send Slack message action in the Shopify Flow app" width="2304" height="682" data-path="doc/integration/shopify/going-further/slack-action-connected.png" />

5. Enter the details for your Slack message:

   <img src="https://mintcdn.com/algolia/TTlnKswkCK2YkCpC/doc/integration/shopify/going-further/slack-message.png?fit=max&auto=format&n=TTlnKswkCK2YkCpC&q=85&s=b9118e0c4d791963947f747bee4ef923" alt="Screenshot of the 'Send Slack message' action configuration with fields for 'Channel, or member id' and 'Message' and an 'Add a variable' button." width="1258" height="882" data-path="doc/integration/shopify/going-further/slack-message.png" />

   1. Optional: add a description for this Slack notification.

   2. Select a Slack member ID or enter a channel name which should receive the Slack message.

      <Tip>
        To find your Slack member ID, visit your profile,
        click the <Icon icon="ellipsis-vertical" color="var(--tw-prose-body)" /> icon and select **Copy member ID**.
      </Tip>

   3. Under the **Message** field, click **Add a variable** and select the `topSearchesMarkdown` variable.
      When the Slack message is sent, this variable will be replaced with the message body.

6. Click **Turn on workflow**.

   <img src="https://mintcdn.com/algolia/TTlnKswkCK2YkCpC/doc/integration/shopify/going-further/turn-on-workflow.png?fit=max&auto=format&n=TTlnKswkCK2YkCpC&q=85&s=c2ccd0fbafcd2229641418e60a7161b4" alt="Screenshot of a Shopify Flow workflow editor with a 'Turn on workflow' button highlighted in the top right corner." width="1362" height="556" data-path="doc/integration/shopify/going-further/turn-on-workflow.png" />

Now, you'll receive a Slack message every day at 1 PM UTC with your top searches.

### Configure action: send emails

1. In the Shopify Flow app, select your workflow and add another action.

   <img src="https://mintcdn.com/algolia/TTlnKswkCK2YkCpC/doc/integration/shopify/going-further/add-more-action.png?fit=max&auto=format&n=TTlnKswkCK2YkCpC&q=85&s=d390e5e5fbc5fc175b43665d7d3bb535" alt="Screenshot of a workflow diagram showing a 'Send Slack message' action with a highlighted 'Action' button." width="1298" height="328" data-path="doc/integration/shopify/going-further/add-more-action.png" />

2. From the Shopify app, select the **Send internal email** action.

   <img src="https://mintcdn.com/algolia/TTlnKswkCK2YkCpC/doc/integration/shopify/going-further/send-internal-email.png?fit=max&auto=format&n=TTlnKswkCK2YkCpC&q=85&s=1c3725649035aa9388833124c4b1d76b" alt="Screenshot of the Shopify Flow interface showing the 'Send internal email' action option highlighted in a blue box." width="1264" height="540" data-path="doc/integration/shopify/going-further/send-internal-email.png" />

3. Enter the details for your email.

   <img src="https://mintcdn.com/algolia/TTlnKswkCK2YkCpC/doc/integration/shopify/going-further/email.png?fit=max&auto=format&n=TTlnKswkCK2YkCpC&q=85&s=c092c59c2097b673a98cc0c062318679" alt="Screenshot of the 'Send internal email' action with fields for 'email address,' 'Subject,' and 'Message' containing a template variable." width="1256" height="1116" data-path="doc/integration/shopify/going-further/email.png" />

   1. Optional: add a description for this email notification.
   2. Enter one or more email addresses and a subject.
   3. Under the **Message** field, click **Add a variable** and select the `topSearchesHtml` variable.
      When the email is sent, this variable will be replaced with the email body.

4. Click **Apply Changes**.

Now, in addition to a Slack message, you'll receive an email with your top searches.
