Skip to content

Commit

Permalink
integrations: Add Linear webhook integration.
Browse files Browse the repository at this point in the history
Fixes part of zulip#23118.
  • Loading branch information
sbansal1999 authored and timabbott committed May 30, 2023
1 parent dcb163b commit 2d6e636
Show file tree
Hide file tree
Showing 20 changed files with 842 additions and 0 deletions.
Binary file added static/images/integrations/bot_avatars/linear.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/images/integrations/linear/001.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions static/images/integrations/logos/linear.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions zerver/lib/integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,7 @@ def __init__(self, name: str, *args: Any, **kwargs: Any) -> None:
WebhookIntegration("json", ["misc"], display_name="JSON formatter"),
WebhookIntegration("librato", ["monitoring"]),
WebhookIntegration("lidarr", ["entertainment"]),
WebhookIntegration("linear", ["project-management"], display_name="Linear"),
WebhookIntegration("mention", ["marketing"], display_name="Mention"),
WebhookIntegration("netlify", ["continuous-integration", "deployment"], display_name="Netlify"),
WebhookIntegration("newrelic", ["monitoring"], display_name="New Relic"),
Expand Down Expand Up @@ -774,6 +775,7 @@ def __init__(self, name: str, *args: Any, **kwargs: Any) -> None:
"json": [ScreenshotConfig("json_github_push__1_commit.json")],
"librato": [ScreenshotConfig("three_conditions_alert.json", payload_as_query_param=True)],
"lidarr": [ScreenshotConfig("lidarr_tracks_grabbed.json")],
"linear": [ScreenshotConfig("issue_create_complex.json")],
"mention": [ScreenshotConfig("webfeeds.json")],
"nagios": [BaseScreenshotConfig("service_notify.json")],
"netlify": [ScreenshotConfig("deploy_building.json")],
Expand Down
Empty file.
18 changes: 18 additions & 0 deletions zerver/webhooks/linear/doc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Get Linear notifications in Zulip!

1. {!create-stream.md!}

1. {!create-bot-construct-url.md!}

You can refer to Linear's documentation for [webhook events](https://developers.linear.app/docs/graphql/webhooks).

1. Go to your team on Linear and open **Settings**, select **API**,
and click on **New Webhook**.

1. Set **Webhook URL** to the URL constructed above. Select the data
change events for which you would like to receive notifications
for, and click **Create Webhook**.

{!congrats.md!}

![Linear Integration](/static/images/integrations/linear/001.png)
25 changes: 25 additions & 0 deletions zerver/webhooks/linear/fixtures/comment_create.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"action": "create",
"createdAt": "2023-04-11T10:21:34.858Z",
"data": {
"id": "c7cafc52-994d-4984-a217-bff9f9aa9473",
"createdAt": "2023-04-11T10:21:34.858Z",
"updatedAt": "2023-04-11T10:21:34.858Z",
"body": "Performing a thorough impact analysis and cost realization is a crucial step in responding to any system outage or incident. By examining the extent of the outage, the affected systems or services, the number of users impacted, and any error messages or logs generated during the incident, we can gain a comprehensive understanding of the scope of the incident.\n\nThis information can then be used to prioritize the resolution efforts and minimize the impact on our organization's operations. Additionally, cost realization allows us to evaluate the financial impact of the outage on our organization and make informed decisions regarding resource allocation for future incidents.\n\nOverall, conducting a thorough impact analysis and cost realization can help us effectively manage incidents and prevent similar issues from occurring in the future.",
"issueId": "f9a37fcf-eb52-44be-a52c-0477f70e9952",
"userId": "674c90c8-35ea-454d-8ca4-5548258fd795",
"reactionData": [],
"issue": {
"id": "f9a37fcf-eb52-44be-a52c-0477f70e9952",
"title": "Thorough Impact Analysis and Cost Realization"
},
"user": {
"id": "674c90c8-35ea-454d-8ca4-5548258fd795",
"name": "Satyam Bansal"
}
},
"url": "https://linear.app/webhooks/issue/WEB-46#comment-c7cafc52",
"type": "Comment",
"organizationId": "7a661544-df08-4cd1-a1e3-5ec611898806",
"webhookTimestamp": 1681208494995
}
25 changes: 25 additions & 0 deletions zerver/webhooks/linear/fixtures/comment_remove.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"action": "remove",
"createdAt": "2023-04-11T10:22:42.436Z",
"data": {
"id": "c7cafc52-994d-4984-a217-bff9f9aa9473",
"createdAt": "2023-04-11T10:21:34.858Z",
"updatedAt": "2023-04-11T10:22:24.895Z",
"body": "In responding to any system outage or incident, it is essential to perform a comprehensive impact analysis and cost evaluation. By examining factors such as the extent of the outage, the affected systems or services, the number of users affected, and any error messages or logs generated during the incident, we can gain a detailed understanding of the incident's scope.\n\nThis information is then critical in prioritizing resolution efforts and reducing the impact on our organization's operations. Additionally, conducting cost realization allows us to assess the financial implications of the outage and make informed decisions about allocating resources for future incidents.\n\nOverall, performing a thorough impact analysis and cost realization is an effective way to manage incidents and prevent similar issues from recurring.",
"issueId": "f9a37fcf-eb52-44be-a52c-0477f70e9952",
"userId": "674c90c8-35ea-454d-8ca4-5548258fd795",
"editedAt": "2023-04-11T10:22:24.895Z",
"reactionData": [],
"issue": {
"id": "f9a37fcf-eb52-44be-a52c-0477f70e9952",
"title": "Thorough Impact Analysis and Cost Realization"
},
"user": {
"id": "674c90c8-35ea-454d-8ca4-5548258fd795",
"name": "Satyam Bansal"
}
},
"type": "Comment",
"organizationId": "7a661544-df08-4cd1-a1e3-5ec611898806",
"webhookTimestamp": 1681208562499
}
31 changes: 31 additions & 0 deletions zerver/webhooks/linear/fixtures/comment_update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"action": "update",
"createdAt": "2023-04-11T10:22:24.895Z",
"data": {
"id": "c7cafc52-994d-4984-a217-bff9f9aa9473",
"createdAt": "2023-04-11T10:21:34.858Z",
"updatedAt": "2023-04-11T10:22:24.895Z",
"body": "Invalid response to any system outage or incident, it is essential to perform a comprehensive impact analysis and cost evaluation. By examining factors such as the extent of the outage, the affected systems or services, the number of users affected, and any error messages or logs generated during the incident, we can gain a detailed understanding of the incident's scope.\n\nThis information is then critical in prioritizing resolution efforts and reducing the impact on our organization's operations. Additionally, conducting cost realization allows us to assess the financial implications of the outage and make informed decisions about allocating resources for future incidents.\n\nOverall, performing a thorough impact analysis and cost realization is an effective way to manage incidents and prevent similar issues from recurring.",
"issueId": "f9a37fcf-eb52-44be-a52c-0477f70e9952",
"userId": "674c90c8-35ea-454d-8ca4-5548258fd795",
"editedAt": "2023-04-11T10:22:24.895Z",
"reactionData": [],
"issue": {
"id": "f9a37fcf-eb52-44be-a52c-0477f70e9952",
"title": "Thorough Impact Analysis and Cost Realization"
},
"user": {
"id": "674c90c8-35ea-454d-8ca4-5548258fd795",
"name": "Satyam Bansal"
}
},
"updatedFrom": {
"updatedAt": "2023-04-11T10:21:34.858Z",
"body": "Performing a thorough impact analysis and cost realization is a crucial step in responding to any system outage or incident. By examining the extent of the outage, the affected systems or services, the number of users impacted, and any error messages or logs generated during the incident, we can gain a comprehensive understanding of the scope of the incident.\n\nThis information can then be used to prioritize the resolution efforts and minimize the impact on our organization's operations. Additionally, cost realization allows us to evaluate the financial impact of the outage on our organization and make informed decisions regarding resource allocation for future incidents.\n\nOverall, conducting a thorough impact analysis and cost realization can help us effectively manage incidents and prevent similar issues from occurring in the future.",
"editedAt": null
},
"url": "https://linear.app/webhooks/issue/WEB-46#comment-c7cafc52",
"type": "Comment",
"organizationId": "7a661544-df08-4cd1-a1e3-5ec611898806",
"webhookTimestamp": 1681208545073
}
73 changes: 73 additions & 0 deletions zerver/webhooks/linear/fixtures/issue_create_complex.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"action": "create",
"createdAt": "2023-04-11T10:10:15.037Z",
"data": {
"id": "3443a709-f2b5-46f2-a136-a0445fd432be",
"createdAt": "2023-04-11T10:10:15.037Z",
"updatedAt": "2023-04-11T10:10:15.037Z",
"number": 44,
"title": "This is regarding the outage that we faced during 11/12/22 from 2000 to 2200.",
"priority": 1,
"boardOrder": 0,
"sortOrder": -2036,
"startedAt": "2023-04-11T10:10:15.093Z",
"teamId": "9e383f51-2629-4f19-97ff-451cc2f0a0ad",
"previousIdentifiers": [],
"creatorId": "674c90c8-35ea-454d-8ca4-5548258fd795",
"assigneeId": "674c90c8-35ea-454d-8ca4-5548258fd795",
"stateId": "a2530cac-36a0-4b6d-9af0-6357784035d4",
"priorityLabel": "Urgent",
"subscriberIds": [
"674c90c8-35ea-454d-8ca4-5548258fd795"
],
"labelIds": [
"6e4da2ed-ee8b-4b19-9cf8-40e5603e04c1",
"56111f1a-e733-49f2-856a-c42318bb8739",
"196379c2-287d-436d-962c-b2c0ce8281a1",
"926b0916-05e2-4e8b-a7c6-96bc2c763326"
],
"description": "The outage that occurred on the above-mentioned date is a cause for concern as it could have significant implications for the organization and its users. A prolonged outage can result in lost revenue, productivity, and customer confidence. Therefore, it is essential to conduct a detailed assessment and analysis to identify the root cause of the outage and take appropriate measures to prevent its recurrence.\n\nThe analysis process may involve the use of specialized tools and techniques to help pinpoint the exact cause of the outage. Once the root cause has been identified, the organization can take steps to implement effective solutions that can mitigate the risk of a similar outage happening in the future. The assessment and analysis process will help the organization to develop a more robust and reliable IT infrastructure that can provide uninterrupted services to its users.",
"descriptionData": "{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"content\":[{\"text\":\"The outage that occurred on the above-mentioned date is a cause for concern as it could have significant implications for the organization and its users. A prolonged outage can result in lost revenue, productivity, and customer confidence. Therefore, it is essential to conduct a detailed assessment and analysis to identify the root cause of the outage and take appropriate measures to prevent its recurrence.\",\"type\":\"text\"}]},{\"type\":\"paragraph\",\"content\":[{\"text\":\"The analysis process may involve the use of specialized tools and techniques to help pinpoint the exact cause of the outage. Once the root cause has been identified, the organization can take steps to implement effective solutions that can mitigate the risk of a similar outage happening in the future. The assessment and analysis process will help the organization to develop a more robust and reliable IT infrastructure that can provide uninterrupted services to its users.\",\"type\":\"text\"}]}]}",
"assignee": {
"id": "674c90c8-35ea-454d-8ca4-5548258fd795",
"name": "Satyam Bansal"
},
"state": {
"id": "a2530cac-36a0-4b6d-9af0-6357784035d4",
"color": "#f2c94c",
"name": "In Progress",
"type": "started"
},
"team": {
"id": "9e383f51-2629-4f19-97ff-451cc2f0a0ad",
"key": "WEB",
"name": "Webhooks"
},
"labels": [
{
"id": "56111f1a-e733-49f2-856a-c42318bb8739",
"color": "#4EA7FC",
"name": "Improvement"
},
{
"id": "196379c2-287d-436d-962c-b2c0ce8281a1",
"color": "#BB87FC",
"name": "Feature"
},
{
"id": "6e4da2ed-ee8b-4b19-9cf8-40e5603e04c1",
"color": "#EB5757",
"name": "Bug"
},
{
"id": "926b0916-05e2-4e8b-a7c6-96bc2c763326",
"color": "#26b5ce",
"name": "Custom Label"
}
]
},
"url": "https://linear.app/webhooks/issue/WEB-44/this-is-regarding-the-outage-that-we-faced-during-111222-from-2000-to",
"type": "Issue",
"organizationId": "7a661544-df08-4cd1-a1e3-5ec611898806",
"webhookTimestamp": 1681207816078
}
41 changes: 41 additions & 0 deletions zerver/webhooks/linear/fixtures/issue_create_simple.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"action": "create",
"createdAt": "2023-04-11T09:59:47.094Z",
"data": {
"id": "a4344dc7-7d8d-4b28-a93c-553ac9aba41a",
"createdAt": "2023-04-11T09:59:47.094Z",
"updatedAt": "2023-04-11T09:59:47.094Z",
"number": 43,
"title": "Very small font in tooltip",
"priority": 0,
"boardOrder": 0,
"sortOrder": -27663,
"teamId": "9e383f51-2629-4f19-97ff-451cc2f0a0ad",
"previousIdentifiers": [],
"creatorId": "674c90c8-35ea-454d-8ca4-5548258fd795",
"stateId": "a19a64b3-1d56-4ecb-b40e-d14aee5e9368",
"priorityLabel": "No priority",
"subscriberIds": [
"674c90c8-35ea-454d-8ca4-5548258fd795"
],
"labelIds": [],
"description": "The tooltips at the \"Select Drawing\" and \"Edit Drawing\" buttons have a very small font and therefore are not very legible. Apart from this, the wording of the text has to be changed to fit better with the overall design pattern.",
"descriptionData": "{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"content\":[{\"text\":\"The tooltips at the \\\"Select Drawing\\\" and \\\"Edit Drawing\\\" buttons have a very small font and therefore are not very legible. Apart from this, the wording of the text has to be changed to fit better with the overall design pattern.\",\"type\":\"text\"}]}]}",
"state": {
"id": "a19a64b3-1d56-4ecb-b40e-d14aee5e9368",
"color": "#e2e2e2",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "9e383f51-2629-4f19-97ff-451cc2f0a0ad",
"key": "WEB",
"name": "Webhooks"
},
"labels": []
},
"url": "https://linear.app/webhooks/issue/WEB-43/very-small-font-in-tooltip",
"type": "Issue",
"organizationId": "7a661544-df08-4cd1-a1e3-5ec611898806",
"webhookTimestamp": 1681207187330
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"action": "create",
"createdAt": "2023-04-11T09:47:53.218Z",
"data": {
"id": "21e12515-fe5e-4923-88a1-e9ace5056473",
"createdAt": "2023-04-11T09:47:53.218Z",
"updatedAt": "2023-04-11T09:47:53.218Z",
"number": 42,
"title": "Drop-down overflow in the select menu.",
"priority": 2,
"boardOrder": 0,
"sortOrder": -26718,
"teamId": "9e383f51-2629-4f19-97ff-451cc2f0a0ad",
"previousIdentifiers": [],
"creatorId": "674c90c8-35ea-454d-8ca4-5548258fd795",
"stateId": "a19a64b3-1d56-4ecb-b40e-d14aee5e9368",
"priorityLabel": "High",
"subscriberIds": [
"674c90c8-35ea-454d-8ca4-5548258fd795"
],
"labelIds": [],
"state": {
"id": "a19a64b3-1d56-4ecb-b40e-d14aee5e9368",
"color": "#e2e2e2",
"name": "Todo",
"type": "unstarted"
},
"team": {
"id": "9e383f51-2629-4f19-97ff-451cc2f0a0ad",
"key": "WEB",
"name": "Webhooks"
},
"labels": []
},
"url": "https://linear.app/webhooks/issue/WEB-42/drop-down-overflow-in-the-select-menu",
"type": "Issue",
"organizationId": "7a661544-df08-4cd1-a1e3-5ec611898806",
"webhookTimestamp": 1681206473447
}
Loading

0 comments on commit 2d6e636

Please sign in to comment.