There are two steps to publishing an announcement through Jira: first we must create the announcement, and once this is created, we can then publish the announcement. We're using a Task in this example, but you can change this to whatever type of issue you'd like.
In order to set this up, you'll need the following information from your LaunchNotes account:
We're going to create this rule in two stages, the first is creating the announcement:
Under Project Settings > Apps > Project Automation in Jira, Create new rule:
When: Issue transitioned
to: Done
Issue fields condition
Field: Issue Type
Condition: Equals
Value: Task (this can be whatever issue type you'd prefer)
New Action: Send web request
Webhook URL: https://app.launchnotes.io/graphql
Headers:
Authorization
Bearer (your_management_api_key)
HTTP Method: Post
Webhook body: Custom Data
Wait for response β "Delay execution of subsequent rule actions until we've received a response for this webhook"
Custom Data:
{
"query": "mutation createAnnouncement ($projectId: ID!,$headline: String!,$contentJira: String!){createAnnouncement(input: {announcement: {projectId: $projectId,headline: $headline,contentJira: $contentJira}}) {announcement {id}}}",
"variables": {
"projectId": "YOUR_PROJECT_ID",
"headline": "{{issue.key}} - {{issue.summary}}",
"contentJira": "{{issue.description.jsonEncode}}"
}
}
π‘ You can get creative with the headline - the example used in the snippet above
is an example of how we use this at LaunchNotes.
The above will create a draft announcement, and now we're going to add in the second stage to this rule; publishing the announcement:
To do this, we're going to call a second mutation to publish the announcement by pulling in the previous API request to make this request to publish.
Continue building out this rule by adding a component under the Web request action:
New Action: Send web request
Webhook URL: https://app.launchnotes.io/graphql
Headers:
Authorization
Bearer (your_management_api_key)
HTTP Method: Post
Webhook body: Custom Data
Custom Data:
{
"query": "mutation publishAnnnouncement ($id: ID!) {publishAnnouncement(input:{announcementId:$id}){announcement{id}}}",
"variables": {
"id": "{{webhookResponse.body.data.createAnnouncement.announcement.id}}"
}
}