---
updatedAt: 2026-07-25T13:00:23.000Z
agentTools:
  projectIndex: https://docs.esputnik.com/llms.txt
---

# Linking Workflow to the Button

<HTMLBlock>{`
<p align="right" style="color: gray;">
  <a href="https://docs-ua.esputnik.com/docs/yak-privyazati-scenarij-do-knopki" style="color: gray; text-decoration: none;"><em>
    Read this article in Ukrainian ⮕
  </em></a>
</p>
`}</HTMLBlock>

The algorithm for linking a workflow to the button is universal. We will illustrate it with the example of a campaign for segmenting contacts.

Let us suppose that you have a quite large contact database but you don’t know anything but email addresses about your subscribers. If you don’t want to annoy them with trifles but send only the relevant content you need to know their interests and expectations. For this purpose, we send subscriber a trigger email that contains request to tell more about himself/herself and a special workflow attached to it.

## Basic segmentation

The simplest example is an email with the question: **What kind of clothes are you interested in?** A contact could click on one of three buttons: **Men's**, **Women's**, or**All**. Your goal is to build a workflow to add contacts to segments when they click the buttons in the email.

Each workflow must be linked to a certain event. You can pass events via API or [create them in our system manually](https://docs.esputnik.com/docs/creating-events).

## 1. Creating an Event Type

1. Go to **Automation → Event types** and click **New event type**.

<Image src="https://files.readme.io/cc7c6711781154aa075fcd0b5278c3050d4fbdb9394a0c8695162c76e2bd68cd-image.png" align="center" width="80%"  alt="Event types page with the New event type button highlighted" />

2. In the **New event type** window add an event name and select a category.

<Image src="https://files.readme.io/d85b7893773ebd7d2944b2c48e88ca5d9cb1e6dd9f93e8d30bdf2593dfe24473-image.png" align="center" width="80%"  alt="New event type window with Name set to Click_men and Key set to Click_men001" />

<Callout icon="📘" theme="info">
  ### Note

  For the  **Click** category be sure to specify the key in the corresponding field. The key is any value/word, preferably written without using numbers. For example: action, click, etc.
</Callout>

3. Click **Add**.

## 2. Linking Event to the Button

1. Open the email with a questionnaire in the editor.
2. Click on each button with the answer option and link an event to it. Select the corresponding one from the dropdown list.

<Image src="https://files.readme.io/00221b7bb82f8904acabbcca528ebc7c5425be61330769790f47721c8c621157-image01.png" align="center" width="80% "  alt="Email editor with the Men's button selected and its Button block panel showing Event type set to Click_Men" />

## 3. Setting Up Workflow

1. Go to **Automation** → **Workflows** and click **New workflow**.

<Image src="https://files.readme.io/b011c2b2444402e38c8ed314819d467f1146ba0276adcc0cd22ed99210f76d6a-image.png" align="center" width="79%"  alt="Workflows list with the New workflow button highlighted" />

2. Enter the title and add tags (optionally) of the workflow.
3. Build a chain of actions:

* Start
* Add to segment
* End

In the **Add to segment** block, select the group to add contacts to.

<Image src="https://files.readme.io/32e523c47621808e7bf3b86e4dea6e6596270e6bc0d606dd342234a02bfb25f6-image.png" align="center" width="80%"  alt="Workflow builder with the Add to segment block open showing the segment set to Click Men's" />

You can add more actions to such a workflow, for example — send a message after adding to the segment.

<Image src="https://files.readme.io/d88aa01bde447988021805d1a281cdb22021ca7bcb08b7820c015dca31497c6c-image.png" align="center" width="80%"  alt="Workflow builder with an Email block open showing the Welcome for men #1 message preview" />

4. Click **Save and exit**.
5. Go to **Start/Stop configuration**.

<Image src="https://files.readme.io/b93cfab9545bec1f42668cb377988707606882564ebf469752f7143459660a55-image.png" align="center" width="80%"  alt="Workflows list with the Start/Stop configuration icon highlighted for the Click Men's workflow" />

6. In **Start configuration**, select **Event-based** and select the event in **Event** field. Set up processing unique events (in this case, we recommend you the once option).
7. Click **Apply**.

<Image src="https://files.readme.io/29701eefe617b25aa5fc6eaa35495264181096e6d389e383cacaa37a4a41edf7-image.png" align="center" width="80%"  alt="Start/Stop configuration dialog with Event-based option and the Click_men event selected" />

<Callout icon="📘" theme="info">
  ### Important

  If you want the contact to receive an email with recommendations immediately after the workflow is executed, set the **Once in every\_\_**  parameter in the **Process unique events** field. If this parameter is not specified, and a subscriber accidentally clicks the button several times, the scenario will run anyway, sending several identical messages to one person.
</Callout>

8. Click the **Activate** button.

<Image src="https://files.readme.io/76915105347dfd74bcfa6fcaf1784de0d796b88b8197eec29ae200cb6478a167-image.png" align="center" width="80%"  alt="Workflows list with the Activate icon highlighted for the Click Men's workflow" />

Each contact who clicks on the button will be added to the segment specified in the workflow. This way, you will get the target audience segments for emailing campaigns with relevant content. Using the same principles you can generate new events arranging much more complex workflows and adding them to buttons, pics, and even text links in your messages.