The following documentation explains how to use an API call with Opsera’s new API endpoint to trigger a pipeline start with an Approval Gate step. The Approval Gate must be set up with a Step Notification configured to a MS Teams tool. This way you can approve the pipeline start through MS Teams.
Prerequisites: To make an external API request to start a pipeline and approve through MS Teams, you must have a configured MS Teams tool. You must also generate a Personal Access Token with Scope = API Access. For instructions on generating a Personal Access Token, view the https://opsera.atlassian.net/l/c/fSKfvcec documentation.
Pipeline Step Setup
Approval Gate Step
You must use an Approval Gate step for this step. This step must be the FIRST step in the pipeline workflow. Use the following instructions to set up an Approval Gate Step.
In pipeline workflow, create a new step.
In Step Setup, select Approval Gate from the Tool dropdown.
Click the ‘Save' button and exit Step Setup.
Select the gear icon to configure the Approval Gate step.
In the Step Configuration form, enable the Send Custom Message toggle. Provide a Custom Step Message and Point of Contact.
Note: The Custom Step Message will be overwritten by the API call Notification Message.Click the ‘Save’ button and close out of the step.
Step Notification Setup
Once the Approval Gate step has been configured, click the mail icon on the step to open the Pipeline Step Notification Configuration.
Select Microsoft Teams.
Enable the Teams Notification toggle.
Select Notification Level from dropdown.
Select the configured Teams Tool from the dropdown.
Click the ‘Save’ button and exit.
Retrieving Pipeline ID and Step ID for API Request
Your Pipeline ID can be found in various locations, such as in the URL of your pipeline or the Summary panel.
The Step ID from the Approval Gate Step can be found directly on the pipeline step.
Now that you have a Personal Access Token, Approval Gate Step, Pipeline ID and Step ID, you can make the API call.
API Request
Use the following information for method, URL, endpoint and body. Verify that the user making the API call has RBAC to the specific pipeline.
METHOD | URL | Endpoint | Access | Body |
---|---|---|---|---|
POST | your custom API URL |
| Item RBAC | { "pipelineId":"[insert pipeline id]", "stepId": "[insert step id]", "notificationMessage":"here is the custom message" } |
Approve Pipeline Start in MS Teams
Once you receive the Pipeline Notification via MS Teams, verify the information and click the ‘Approve’ button.
Once you approve the Pipeline Notification, the pipeline will start.