Step 1: Start creating the Workflow
Follow the steps in the documentation to create a Workflow and configure its basic settings.Step 2: Add blocks to the Workflow
The instructions on this page describe how to create this Workflow in the Cortex UI, but it is also possible to copy the Workflow YAML and add it to your workspace via the Cortex CLI. This allows you to quickly set up the example configuration then iterate on it for your own use case. Expand the tile below to learn more.Workflow YAML instructions
Workflow YAML instructions
To upload the Workflow example YAML into your workspace:
- Save the Workflow example YAML file below:
- Use the Cortex CLI to run this command, using the path to your Workflow YAML file:
cortex workflows create -f <path-to-your-workflow.yaml>
User input
User input
In this example, we add a User Input block to obtain the user’s GitHub username.
- Click + in the center of the page. In the block library modal, choose User input.
- In the block configuration side panel, enter a name and unique slug for this block.
- In this example, we use the name
Get GH Usernameand the slugget-gh-username.
- In this example, we use the name
- Click +Add user input. Add the following:
- Name: GitHub Username
- Key: github-username
- Description: Enter your personal GitHub username.
- Type: Text
- Click Add input.
- At the bottom of the side panel, click Save.
Add user to GitHub org
Add user to GitHub org
This block adds a user to a GitHub organization.
- Click + in the center of the page. In the block library modal, select the GitHub > Add user to org block.
- In the side panel, enter a name and unique slug for the block.
- In this example, we use the name
Add user to GH organd the slugadd-user-to-org.
- In this example, we use the name
- Configure the block:
- Alias: Choose which GitHub configuration to use.
- Organization: Enter your GitHub organization name.
- Username: Enter the handle for the user’s GitHub account.
- In our example, we use templating to take the output of the previous step and set it as the value for this field:
actions.get-gh-username.outputs.github-username
- In our example, we use templating to take the output of the previous step and set it as the value for this field:
- Role: Select the role of the user in the organization.
- At the bottom of the side panel, click Save.
HTTP requests
HTTP requests
There are two HTTP requests that perform the following actions: Adding the user to PagerDuty and adding the user to Jira.Add the user to PagerDuty
- Click + in the center of the page. In the block library modal, select the HTTP request block.
- In the side panel, enter a name and unique slug for the block.
- In this example, we use the name
Add user to PagerDutyand the slugadd-user-to-pd.
- In this example, we use the name
- Configure the block:
- HTTP method: POST
- URL: In our example, we set this to
https://api.pagerduty.com/users. - Headers: Set the following headers:
Accept:application/vnd.pagerduty+json;version=2Authorization:Bearer {{ context.secrets.pd_token }}
- Payload: In our example, we enter the following:
- Save the block.
- Click + in the center of the page. In the block library modal, select the HTTP request block.
- In the side panel, enter a name and unique slug for the block.
- In this example we use the name
Add user to Jiraand the slugadd-user-to-jira.
- In this example we use the name
- Configure the block:
- HTTP method: POST
- URL: In our example, we set this to:
https://cortex.atlassian.net/rest/api/3/user - Payload: In our example, we enter the following:
- Save the block.
Slack message
Slack message
In this step, we send a templated message via Slack informing the user that they have been added to GitHub, PageryDuty, and Jira.
- Click + in the center of the page. In the block library modal, select the Slack block.
- In the side panel, enter a name and unique slug for the block.
- In this example we use the name
Send messageand the slugsend-message.
- In this example we use the name
- Select a Slack channel name.
- Enter text for the message that will be sent via Slack. In our example, we use the following:
- Save the block.
Step 3: Run the Workflow
When you run the Workflow, the following events happen:- The Workflow pauses to collect a response from the user during the User Input block.
- The “Add user to org” block runs. It uses the output of the previous block as the username, then automatically adds to that user to the specified GitHub org.
- The first HTTP request runs. Using the name and email address of the user who initiated the Workflow, it creates a user in PagerDuty.
- The second HTTP request runs. Using the name and email address of the user who initiated the Workflow, it creates a user in Jira.
- The Slack block runs, which sends a Slack message to the user to let them know that their GitHub, PagerDuty, and Jira accounts are ready.