# Workflow

A workflow can be considered as a backend flow where you can automate tasks such as adding or removing tags, set custom field variables, do external API calls.

This way the conversation you have with the subscriber will not be affected by needing to wait to apply all those actions and the experience is as smooth as possible for that end-user.

### Create Workflow <a href="#create-workflow" id="create-workflow"></a>

<figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2F9DSrLbuKPU2MaRPqlEQ2%2FCapture.PNG?alt=media&#x26;token=1f8db37f-437c-4d47-bef3-8b15692addaf" alt=""><figcaption></figcaption></figure>

To create a workflow just go to the flow overview by selecting **Flows** from the left-hand menu.

Then press the button **+ New Sub Flow**

Select the workflow flow type then give it a name. Once done press the button Create to start creating your workflow.

Once you create your flow and you end up in the flow builder you will notice that you will have access to fewer blocks than when selecting a regular or function flow.

Available blocks are:

* Action
* Condition
* Split
* Send Email

As mentioned this flow is meant to create a backend flow that you can trigger from any other flow inside your chatbot to handle system tasks like adding tags, set custom fields, but also sending emails.

<figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2FoRaqVgZ6KXQFH1JP7QBh%2Fworkflow2.deebfc26.png?alt=media&#x26;token=6100c824-dd8c-4c1d-96c6-b90c02ef307c" alt=""><figcaption></figcaption></figure>

### Workflow Example <a href="#workflow-example" id="workflow-example"></a>

Let’s take an example of how a workflow can be used.

A user signs up with an email and or phone number and you want to sync this information with your CRM platform of choice.

So soon as you grabbed the credentials from the user you can make an API call using the external request block inside of the action module.

You would also want to tag the user inside the chatbot for completing the onboarding step. After done we send an email notification to an admin that a new lead has been created to follow up on.

A workflow can then look something like this;

<figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2FXitD1tIe0Y25Iph6EfC0%2Fworkflow3.7ac2b256.png?alt=media&#x26;token=1df79973-4ba2-4d66-a944-1807f82e4e51" alt=""><figcaption></figcaption></figure>

If you were to incorporate this into the flow that has the actual conversation it might become an issue as the conversation could be on hold for several seconds or more to finish all these system processes. And you might lose the user as he or she thinks the conversation is done.

### Trigger Workflow <a href="#trigger-workflow" id="trigger-workflow"></a>

It is very simple to trigger the above workflow inside of any other flow that you build.

Just insert an action block, go to _advanced actions_, then choose _trigger workflow_ at the bottom

<figure><img src="https://2836971782-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FRaLazqQDW4JMiGe2iyKg%2Fuploads%2FcZZCz4KPr8W1ypMOr1ES%2Fworkflow4.6a951507.png?alt=media&#x26;token=bf6db7a9-fe99-42f4-87be-d0ee3b8ebc0e" alt=""><figcaption></figcaption></figure>

You can then select any workflow you created. This workflow will then be processed in the backend while the conversation with the user will not be affected and continue without any delay.
