The built-in Bitbucket Issues trigger initiates a flow when it receives a signal from a Bitbucket webhook.
- Go to the Triggers panel in the palette, expand the App Triggers section and drag the trigger onto the canvas.
- Double-click the trigger (or click the pencil icon).
- Set the authenticating user, and then copy the URL — you'll use this to set up the webhook in Bitbucket. Alternatively, you can create an integration user to use as the authenticating user.
- Click the Flood Control tab to edit the trigger's default flood control settings. For more information about these settings, see Trigger Flood Control.
- Click Done.
- On the flow canvas, connect the steps you want to run when xMatters receives a request to that URL.
You're now ready to configure Bitbucket to target the trigger.
Configure Bitbucket to send requests to the trigger URL
To have Bitbucket send alerts to the flow trigger, you need to configure a webhook and set it to use the trigger URL.
- In Bitbucket, select your repository.
- From the project menu, select Repository settings.
- From the Workflow menu, select Webhooks.
- Click Add webhook to create a new webhook.
- On the Add new webhook page, give the webhook a Title.
- In the URL field, add the trigger URL you copied from Flow Designer.
- Add the target names of any recipients you want to notify when the monitor creates an alert.
- For URL authentication, use an ampersand to attach recipients. For example, if you want to notify Emma Pearson and the on-call members in the group responsible for the Antares service, you'd add &recipients=epearson,antares to the end of the URL.
- For other authentication types, use a question mark to attach recipients. For example, if you want to notify Barry Gull and the on-call members in the group responsible for the Cassiopeia service, you'd add ?recipients=bgull,cassiopeia to the end of the URL.
- You must URL-encode any special characters or spaces in the target names.
- In the Status section, select Active.
- In the Triggers section, go to the Issue column and select Created and Updated.
- Click Save.
The new webhook is saved and listed under the Repository hooks section of the page.
You're ready to use the webhook to trigger automated flows, including steps such as sending alerts and initiating incidents, though we always recommend testing before putting things into use.
The trigger has the following outputs you can use as inputs to steps further along the flow.
|List of targeted recipients.|
|Assignee||Name of the user assigned to the Bitbucket issue.|
|Changes||Summary of issue updates, in JSON format. For new issues, this field is empty.|
|Content||Description of the issue as provided by Bitbucket.|
|Issue ID||Unique identifier of the Bitbucket issue.|
Kind of Bitbucket issue. Available values are:
|Issue Event Type||
Type of Bitbucket issue. Available values are:
|Link||Direct link to the Bitbucket issue.|
|Priority||Priority level of the Bitbucket issue, as set in Bitbucket.|
|Project Link||Direct link to the Bitbucket project that contains the issue.|
|Project Name||Name of the Bitbucket project that contains the issue.|
|Reporter Display Name||Display name of the user that reported the issue.|
|Reporter Type||Account type of Bitbucket user that reported the issue.|
|Repository Link||Direct link to the repository that contains the issue.|
|Repository Name||Name of the repository that contains the issue.|
|State||State of the Bitbucket issue.|
|Timestamp||Timestamp of when the issue was last updated (in ISO format).|
|Title||Title of the issue.|
|Raw Request||JSON representation of the request that can be parsed separately to get additional context on outputs.|