# Building Command Workflows

In this section, we see step by step how to create a command workflow on YellowAnt. Following which, we will also cover a very common scenario as the example.

1. In your YellowAnt Dashboard, either from the Overview Panel or Command Workflows Panel, select "Add New" or "Create a Workflow" option respectively.&#x20;

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCC9nWzAlHxn7Oi72zZ%2Fimage.png?alt=media\&token=644f0b11-7181-4592-8203-a55b455fee4f)

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCC9qZ5c3N20DQonN-b%2Fimage.png?alt=media\&token=85ae7a58-8c35-42b4-9a1e-710f754fd7a5)

2\. This will take you to the "Workflow Builder" page. Select "Create Command Workflow" from the two choices.<br>

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCC9tdXaCRweIZ0fB_0%2Fimage.png?alt=media\&token=3287e770-dbdc-4e1d-a82f-8955c7f70cd7)

3\. Choose a "Collection" in which you want to add the workflow to, Then, give a command name to the workflow. This will be useful in executing the command later from your chat window. Example, we are naming it "startmyday" and in order to execute it later, we would be using the command "workflow startmyday".

Note: A collection is a way of segregating workflows into sets in order to keep them more organized for every individual. This is totally up to the user and can be treated as having different set of workflows where each set forms a collection with some specific set of tasks. Watch out for custom collections for different domains which will soon launch on YellowAnt.<br>

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCC9wN25Kdy4ites2Nw%2Fimage.png?alt=media\&token=4395fd47-d22f-4095-b8a8-f37201d27294)

4\. Click on "Add Action in the left panel.

5\. Choose the application from which you want to use as your first "Action". Here, we select "GMail".

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCC9zibClDsHeHO2uQL%2Fimage.png?alt=media\&token=a4373b88-e6b7-4134-aa1e-c67e5a162da0)

6\. Choose the action you want from to use from the application. Here, we select "fetch mails from a label".<br>

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCCA1JSxfA4Z3r7Gqki%2Fimage.png?alt=media\&token=b9f91920-31ad-477f-940d-6b1e889d04a8)

7\. Fill in the required parameter field with the values you need. Here, we want mails fetched with the label "UNREAD".<br>

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCCABEB_w-DQje0jqwe%2Fimage.png?alt=media\&token=aa70b509-44ac-407a-8e18-94988b40dabb)

8\. Click on "Add Action" in the left panel to add the second application.

9\. Choose the application from which you want to use as your second "Action". Here, we select "Asana".<br>

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCCAEnKKAn_8BUlmSYa%2Fimage.png?alt=media\&token=56e1999f-7d89-48ea-8f05-968418047649)

10\. Choose the action you want from to use from the application. Here, we select "List user tasks".<br>

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCCAHDcfh4Qfvjw_jO3%2Fimage.png?alt=media\&token=ce6d9006-99f4-4a83-866a-6d2bd95e2689)

11\. Fill in the required parameter field with the values you need. Here, we want tasks fetched from a workspace "yellowant.com".<br>

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCCAKbbKhBCnBzmWokY%2Fimage.png?alt=media\&token=7e32051a-94bb-4347-99d8-8e3f7debec87)

12\. You can continue to create a chain of events across many apps. We will save it here. Click the button "Save" in the top panel.<br>

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCCANB6K_Bp1986sChM%2Fimage.png?alt=media\&token=7066c697-5494-4834-99a8-f1da2115797d)

13\. You will get a notification in your chat window about the creation of this new workflow. You can execute it right from there as well.<br>

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCCAPhDSOz2NrLf6PUK%2Fimage.png?alt=media\&token=d7950de8-624a-4881-b1ea-5fded512453d)

14\. To execute it at any point, just type "collectionname workflowname" and it executes. Example, "demo-collection startmyname".<br>

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCCAShawq_stKU8YBKp%2Fimage.png?alt=media\&token=e2683657-098e-465f-a5bc-a6fdc63936ae)

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCCAe9C_2-Ew5v5Nm-A%2Fimage.png?alt=media\&token=093da340-bcf7-4bc4-970b-da8cd2483b69)

## Another Example (more comprehensive):

Let’s create one Slack command that gets a high-priority PagerDuty incident, creates a JIRA issue, sends an email to the Test team, and creates a calendar event for a war room meeting. Normally, this process would take atleast 5 minutes. With this command, it will take 5 seconds.

![](https://351543775-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LC8ka5nvI3WmivYwQ6i%2F-LCC9J9lHpUr4t22pB4j%2F-LCCAi3kdesfJo3dZjr5%2Fimage.png?alt=media\&token=d2564fe3-9ebe-43e2-a9c3-e9bc92055563)

1. In the YellowAnt console, click on “Create a Workflow”.&#x20;

![](https://cdn-images-1.medium.com/max/1000/1*iaOEnh0lfUVcxzP8wTLocQ.png)

2\. Click on **Create New**

![](https://cdn-images-1.medium.com/max/1000/1*D27svJzpWz6C6_U9GTt8JA.png)

3\. Select **Command-based Workflow**

![](https://cdn-images-1.medium.com/max/750/1*U1jpqAETtDjOH0QVnr5t7Q.png)

In the Trigger area, select your custom command name. In this case, we have given ***war-room.*** Our custom command will now start with **war-room**

![](https://cdn-images-1.medium.com/max/750/1*n-H1Q_KADHesi9NyJhnKEw.png)

In the **Input arguments** section, define the arguments(or variables) that this command will take.&#x20;

4\. Click on **Add a new input argument.** In this case, the arguments will be **id**(Id of the PagerDuty incident).

It is now time to add some actions.

Our first action will be to search for the PagerDuty incident with Id **‘id**’. Our second action will be to create a JIRA ticket from the data that PagerDuty incident command returns.

5\. Click on **Add Action.**

![](https://cdn-images-1.medium.com/max/1000/1*UwKCFpASlm2hsrNNGqLMMQ.png)

6\. Select **PagerDuty**.

![](https://cdn-images-1.medium.com/max/1000/1*yY9FoYGb4NXUKDwkk_Ejhw.png)

*Fetching incident details*

7\. In the actions, select **get\_incident**

![](https://cdn-images-1.medium.com/max/1000/1*Rnoiz46RsZGgamgsI_u2sA.png)

*Fetching the incident details from PagerDuty*

The get\_incident command takes one argument, i.e the **incident\_number.** This corresponds to the **id** that we will pass in the argument.&#x20;

8\. Click on the **incident\_number** textbox and type **@ .**&#x54;his will bring a dropdown of all the available variable that we will pass in our command. Select **id**.

The next action is to create a JIRA ticket.&#x20;

9\. Click on **Add Action** and select **JIRA.** In the actions dropdown, select **createissue.**

The PagerDuty **get\_incident** command gives us a bunch of data to use to create a new JIRA ticket. Use the **@** symbol to select the variable in the inputs. You can use multiple variables within one input box — YellowAnt automatically concatenates them into one string.

![](https://cdn-images-1.medium.com/max/1000/1*b9YyRYB4vpRRLDqD7Ow25g.png)

*Creating a JIRA ticket from Pagerduty data*

It’s time to send a mail to the testing team

10\. Click on **Add Action.** Select **GMail.** In the function list, select **send.**

![](https://cdn-images-1.medium.com/max/1000/1*osfade5aH7T6Xn1Olt0_tw.png)

*Creating an Email from Pagerduty data*

11\. Format your **subject** and **message** using the **@** symbol to get data from the PagerDuty command.

It’s now time to call a war room meeting using Google Calendar.

12\. Click on **Add Action.** Select **Google Calendar.** In the function list, select **create.**

Describe the event name — you can add some data from the previous steps using the **@** symbol. The **event** variable takes the event description in natural language. So you can say something like — **war room meeting for PD escalation @incident\_number in the next 5 minutes.**

![](https://cdn-images-1.medium.com/max/1000/1*f8k3ZrYVlIE3wOS2_5s4qA.png)

*Creating a Google Calendar event*

13\. Click on **Save.**
