# Workflows

## What are ClearFeed Workflows?

Workflows in ClearFeed are meant specifically to generate:

* **Pending response reminders**
* **Commitment reminders**
* **Simple automated responses** on new requests/tickets
* **Out of office messages** for after-hours requests

Workflows can deliver reminder messages to Slack channels and DMs, post automated responses in Slack threads and post notifications to external systems using Webhooks.

## Workflows versus Automations

[Automations](https://docs.clearfeed.ai/clearfeed-help-center/clearfeed-helpdesk/automations) are a more recent and powerful framework in ClearFeed. Here's how they compare:

* **Similarity:** Workflows and Automations are similar. They both trigger on specific conditions, can wait for a configurable delay, and then perform some actions.
* **Flexibility:** Automations are much more flexible. They have many more triggers, conditions, and actions, and also allow chaining actions.
* **Purpose:** Workflows exist primarily to generate reminders for pending responses/commitments and for OOO responses. Automations cover a much larger variety of use cases.
* **Roadmap:** The Automation framework is an active area of development in ClearFeed, whereas Workflows are less so.
* **Where Workflows shine:** A special property of workflows is that they keep track of the reminders delivered in Slack and automatically delete/update them when the conditions triggering those reminders is no longer applicable. This makes them particularly suitable as an alerting system, to reduce noise on Slack channels.

## How to setup Workflows

Workflows are configured at a Collection level. Go to your Collection -> Select `Workflows` from the navigation menu at the top. Click on **Add workflows to this collection** to start creating a workflow.

{% hint style="info" %}
If you already have workflows configured for your Collection - you should see a **New Workflow** button on the top-right corner.
{% endhint %}

<figure><img src="https://3455705434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2O2wTaNovd6fXpEuLKz%2Fuploads%2Fgit-blob-734f59df227334164608a56bcf425db693d0c149%2Fimage%20(2)%20(9).png?alt=media" alt="" width="563"><figcaption><p>Workflow section in a Collection when no workflows are configured</p></figcaption></figure>

### Parameters

Workflow consists of *Conditions* -> *Timer* -> *Actions*. For any request/ticket that satisfies the conditions, ClearFeed waits for the specified timer and then proceeds with the Action.

1. **Conditions**:
   * **Trigger for:**
     * All Requests - Workflow triggers on all requests
     * Only Tickets - Workflow triggers only on requests that are converted into a ticket
   * **Priority:** All, Urgent, High, Normal, Low
   * **Request Types:**
     * **All:** Workflow triggers on new requests and follow up comments
     * **New:** Workflow triggers only for new requests
     * **Follow Up:** Workflow triggers only for follow up comments
   * **Request created during:** Any Time or Outside Business Hours
2. **Set a Timer:** Workflow triggers after the amount of time specified.
3. **Actions:**
   * DM teammate on Slack
   * Post a channel message
   * Post a triage channel message
   * Webhook (Send an HTTP POST request to an external webhook)
   * Respond to the ticket with a message
   * DM the request assignee on Slack

You can ***Enable/Disable***, ***Edit***, and, ***Delete*** a workflow by hovering over the created workflow and accessing the toggle and buttons as shown below:

<figure><img src="https://3455705434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2O2wTaNovd6fXpEuLKz%2Fuploads%2Fgit-blob-bff1a0d0a7abf666a50e3cb7586fdd7a017c7897%2Fimage%20(1)%20(1)%20(5)%20(1)%20(1)%20(1)%20(1).png?alt=media" alt="" width="563"><figcaption><p>Enable/Disable, Edit, or Delete a workflow</p></figcaption></figure>

## Reminder Workflows

Alerts/notifications that can be configured to be sent on Slack. These are useful for tracking tickets/requests that are pending response from the support team.

{% hint style="info" %}
Primarily relevant when you are using ClearFeed as a stand-alone Helpdesk.
{% endhint %}

### **Use Cases**

1. SLA reminders
2. Escalation reminders
3. Managers can get these alerts to track open items

<figure><img src="https://3455705434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2O2wTaNovd6fXpEuLKz%2Fuploads%2Fgit-blob-8932c09ebab0c0f1571a99c01f3ee71b5b63cf7f%2Fimage%20(147).png?alt=media" alt="" width="563"><figcaption><p>Workflow showing the alert and details regarding the requester and request channel</p></figcaption></figure>

### Setup

Go to Collection -> Workflows -> click on **New Workflow**

1. Select your workflow conditions (learn more about the conditions [**here**](#workflow-parameters)).
2. Select a Timer value
   * If your SLA for first response is 60 mins - set a Timer value to < 60 mins to get an alert if a ticket is Open for that specific amount of time.
3. Select an Action:
   * ***DM a teammate on Slack:*** Choose this and select a person who would get the alert as a DM from the ClearFeed app.
   * ***Post a channel message:*** Post the alert in a dedicated Slack channel
   * ***Post a triage channel message:*** If you've configured a triage channel for the collection, the alert will be delivered to the triage channel.
   * ***DM Request Assignee:*** This would send the alert to the assignee
   * **Respond with a message:** Use this action if you want the reminder to be posted directly in the same Slack thread as the ticket, rather than being sent only as a DM or as a message in a separate channel.

{% hint style="info" %}
**Note:** If the Request Type is set to **Only Tickets**, then the workflow will be triggered only for tickets in the *Open* state and other states such as *Pending* or *On Hold*.
{% endhint %}

<figure><img src="https://3455705434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2O2wTaNovd6fXpEuLKz%2Fuploads%2Fgit-blob-cbb132b33af8784089d4e81b179907762584a80e%2FCreating%20a%20workflow%20reminder.gif?alt=media" alt="" width="563"><figcaption><p>Creating a reminder for open items</p></figcaption></figure>

## Automated Response Workflows

Automated responses that are sent back on Slack.

### Use Cases:

* Auto response on every new request/ticket
* Automated OOO replies for outside business hours

{% hint style="info" %}
Auto responses can be triggered on the creation of ClearFeed Requests, ClearFeed Tickets, or External Tickets (e.g., Zendesk, Intercom).
{% endhint %}

Here is what the reply looks like when it's sent to your customers.

<figure><img src="https://3455705434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2O2wTaNovd6fXpEuLKz%2Fuploads%2Fgit-blob-7884b9be7a8b3f8d9a9007c67015f6f7d186f63f%2Fimage%20(145).png?alt=media" alt="" width="490"><figcaption><p>Reply on a request created outside business hours</p></figcaption></figure>

If you have white-labeled ClearFeed, instead of the ClearFeed logo and bot name, your bot's logo and name will be visible to the customers.

{% hint style="info" %}
**Note:** If you plan to set up OOO messages, ensure the [business schedule](https://docs.clearfeed.ai/clearfeed-help-center/clearfeed-helpdesk/sla-management) for the collection is set.
{% endhint %}

### Setup

Go to Collection -> Workflows -> click on **New Workflow**

1. Select your workflow conditions (learn more about the conditions [**here**](#workflow-parameters))
2. If you plan to trigger the workflows for ClearFeed Tickets / External Tickets (eg. Zendesk)
   * Select Trigger For -> Tickets Only
3. Select a Timer value
   * Select 0 mins if you for immediate response
4. Select the Action -> Respond with a Message
5. Customize the message you want to send and publish the workflow.

<figure><img src="https://3455705434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2O2wTaNovd6fXpEuLKz%2Fuploads%2Fgit-blob-897c7bdc711ff25809137fbac87b2fb32468da54%2FCreating%20OOO%20responder.gif?alt=media" alt="" width="563"><figcaption></figcaption></figure>

## Webhook Action in Workflows

When ClearFeed triggers a webhook workflow, it sends an HTTP POST request with a JSON payload containing various details about the workflow and the associated request. The payload includes the following fields:

1. `version`: The version of the payload format. Currently set to `'1.0'`.
2. `workflow_delay`: The delay, in minutes, before the workflow was triggered.
3. `workflow_name`: The name of the workflow that was triggered.
4. `workflow_message_ts`: The id of the message that triggered the workflow.
5. `workflow_message_text`: The text of the message that triggered the workflow.
6. `workflow_message_url`: The URL of the message that triggered the workflow.
7. `workflow_message_author_id`: The ID of the author of the message that triggered the workflow.
8. `workflow_message_author_name`: The name of the author of the message that triggered the workflow.
9. `request_id`: The ID of the request associated with the workflow.
10. `request_state`: The state of the request associated with the workflow.
11. `request_title`: The title of the request associated with the workflow.
12. `request_priority`: The priority of the request associated with the workflow.
13. `request_thread_ts`: The ID of the thread where the request message was sent.
14. `request_thread_url`: The URL of the thread where the request message was sent.
15. `request_channel_id`: The ID of the channel where the request was received.
16. `request_channel_name`: The name of the channel where the request was received.
17. `request_collection_id`: The ID of the collection that contains the channel where the request was received.
18. `request_collection_name`: The name of the collection that contains the channel where the request was received.

**Example Payload:**

```json
{
  "version": "1.0",
  "workflow_delay": "15",
  "workflow_name": "Escalation Reminder",
  "workflow_message_ts": "1669086095.123456",
  "workflow_message_text": "This is the message that triggered the workflow.",
  "workflow_message_url": "https://clearfeed.slack.com/archives/C0ABCD123/p1669086095123456",
  "workflow_message_author_id": "U12345",
  "workflow_message_author_name": "John Doe",
  "request_id": 123,
  "request_state": "Open",
  "request_title": "Need assistance with XYZ",
  "request_priority": "high",
  "request_thread_ts": "1669086095.987654",
  "request_thread_url": "https://clearfeed.slack.com/archives/C0ABCD123/p1691040592308569?thread_ts=1669086095.987654",
  "request_channel_id": "C0ABCD123",
  "request_channel_name": "clearfeed_swiftcorp_solutions",
  "request_collection_id": 123,
  "request_collection_name": "Premium Customer Channels"
}
```

### Webhook Headers

To verify the authenticity of the request source, ClearFeed adds the following headers to the HTTP POST request:

1. `X-Cf-Signature`: A signature generated using a secret key known only to ClearFeed and the receiving server. You can use this signature to verify that the request has not been tampered with and originated from ClearFeed.
2. `X-Cf-Timestamp`: The timestamp indicates the exact time the request was sent. You can use this timestamp along with the signature to validate the request's freshness and prevent replay attacks.

To validate that webhook requests you receive originated from ClearFeed, read more details [here](#validating-requests).

### Testing Webhook Payload

If you want to send a test payload, you can do this by executing a cURL command such as the one shown below:

```bash
curl --location 'https://www.example.com'
--header 'Content-Type: application/json'
--data '{
    "version": "1.0",
    "workflow_delay": "15",
    "workflow_name": "Escalation Reminder",
    "workflow_message_ts": "1669086095.123456",
    "workflow_message_text": "This is the message that triggered the workflow.",
    "workflow_message_url": "https://clearfeed.slack.com/archives/C0ABCD123/p1669086095123456",
    "workflow_message_author_id": "U12345",
    "workflow_message_author_name": "John Doe",
    "request_id": 123,
    "request_state": "Open",
    "request_title": "Need assistance with XYZ",
    "request_priority": "high",
    "request_thread_ts": "1669086095.987654",
    "request_thread_url": "https://clearfeed.slack.com/archives/C0ABCD123/p1691040592308569?thread_ts=1669086095.987654",
    "request_channel_id": "C0ABCD123",
    "request_channel_name": "clearfeed_swiftcorp_solutions",
    "request_collection_id": 123,
    "request_collection_name": "Premium Customer Channels"
}'
```

{% hint style="info" %}
**Zapier** - To use webhook action workflow with Zapier, use the Zapier endpoint URL as the webhook URL. Verify the webhook action before establishing the Zapier connection. Use the provided payload for configuration.
{% endhint %}

## Commitments

A common problem in conversational systems is to post a reply promising future action and then forget to do so. It is also stressful to remember to set the status manually or use Slack features like "Save Later" to mark such replies. ClearFeed uses AI to automatically find commitments in responder messages and will generate reminders for the same (if any workflow sending reminders to Slack channels is set up).

### Example Messages

* *Let me check with the team and let you know*
* *Will update once there are finer notes on the implementation*
* *Suspecting a possible bug here, I'll have to check with the engineering team and confirm*
* *I will take a look at this by the end of day today*

### How it works?

1. AI automatically analyzes responder messages to identify commitments and update the request status to:
   * **In Progress**: Set when agents provide commitment-based replies indicating the issue is being actively worked on (e.g., "*We're working on it and will get back to you as soon as it's fixed*"). This status is visible externally to customers.
   * **Pending**: Set when the agent message suggests response is required from the customer (e.g., "*Could you provide us with more updates on the issue?*" or "*Is the new feature working for you?*" or "*Here's how you can disable this*").
2. If the commitment remains open (ie. the request continues in **In Progress** state), AI will also generate a reminder based on the time implied in the message, or 24 hours if no time was implied. For example:

   * "*... by end of day today*" - reminder would be queued at the end of the day (based on GMT).
   * "*Let me check with the team*" - no specific timeframe is implied and reminder is queued up for delivery after 24 hours.

   Note that reminders for commitments are canceled if the state moves out of **In Progress** state. Further responses by responders (which are not commitments themselves) are treated as fulfilling the commitment.

### Commitment Reminders and Workflows

Commitment Reminders are automatically sent if there are workflows configured against the corresponding Collection to deliver reminder messages to Slack channels or DMs. Here's what a commitment reminder on the triage channel looks like:

<figure><img src="https://3455705434-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FE2O2wTaNovd6fXpEuLKz%2Fuploads%2Fgit-blob-9d447405a79773f145752523f31847150776817d%2Fimage%20(2)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1)%20(1).png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

{% hint style="info" %}
**Note:** if multiple workflows are sending reminders to the same Slack channel, ClearFeed will **deduplicate commitment reminders**. Recipients only receive one reminder per commitment. This is a property specific to commitments. Pending response alerts themselves are not de-duplicated (if multiple of them are configured at different time thresholds for example).
{% endhint %}

#### Disabling/Enabling Commitment Reminders

Commitment Reminders are enabled by default. To disable (or re-enable) them:

1. Go to the **Settings** tab in the ClearFeed web app and navigate to [**Additional Settings**](https://web.clearfeed.app/settings/additional-settings)**.**
2. Locate the **Commitment Reminders** toggle.
3. Switch the toggle **off** to disable reminders across your account (and **on** to enable it)

{% hint style="danger" %}
This setting is applied at the account level. Disabling reminders will stop them in **all Slack channels and collections** configured in ClearFeed.
{% endhint %}

## FAQs

1. **Can I disable Commitment Reminders for just one channel or collection?**\
   **Answer:** No, this is currently an account-level setting. It applies to all Slack channels and collections.
2. **We’ve disabled reminders, but I’m still seeing Slack messages that look like reminders. Why?**\
   **Answer:** Some other workflows might still be active. You can review active workflows for each channel under the **Workflows** tab on the top-right for that collection.
3. **Should I use Workflows or Automations?**\
   **Answer:** Workflows are particularly suited for reminders on pending responses and for OOO responses. For all other use cases, and for triggers, conditions and actions beyond what Workflows provide - use Automations.
4. **I am getting automated alerts on the Triage Channel stating "Request ... has had no response ...". Why?**\
   **Answer:** If you have setup a new Account in ClearFeed or a new Slack Collection - ClearFeed creates a Reminder Workflow by default for such collections, delivering reminders to the Triage Channel. The alerts you see are being delivered because of that. To remove or modify these alerts - go to the ClearFeed WebApp, click on the corresponding Collection in the Inbox, click on Workflows tab on top right and edit or disable the Workflows from this view.
5. **Can I use Automations to generate reminder alerts instead?**\
   **Answer:** Yes, you can. Automations can also be triggered whenever requests are created or re-opened, can wait for a configurable period and deliver an alert if no response is made within the delay period. They can also be cancelled automatically if the status changes during the delay period (by setting status as the invariant). However - unlike Workflows - Automations cannot clear out stale alerts automatically.
6. **I am getting alerts that contain text like "... need followup on commitment ...". Why?**\
   **Answer:** These are commitment reminders and are automatically triggered if any workflow is setup in your Collection. To turn this off, [check instructions in the Disabling/Enabling Commitment Reminders section](#disabling-enabling-commitment-reminders).
