• Products
  • Get started
  • Documentation
  • Resources

Integrate Opsgenie with CircleCI

CircleCI logo

What does Opsgenie offer CircleCI users?

Opsgenie has a specific API integration with CircleCI. CircleCI sends build results to Opsgenie API, with detailed information. Opsgenie is a dispatcher for CircleCI build failures; determines the right people to notify based on on-call schedules– notifies via email, text messages (SMS), phone calls and iPhone & Android push notifications, and escalates alerts until the alert is acknowledged or closed.

Functionality of the integration

  • When the outcome does not equal success in CircleCI, an alert is created in Opsgenie automatically through the integration.

  • When the outcome equals success in CircleCI, the corresponding alert in Opsgenie, if one exists, is closed automatically through the integration.

Add CircleCI integration in Opsgenie

  1. Go to Opsgenie CircleCI Integration page.

Under the Free and Essentials plans, the tabs under the Team dashboard are limited to Main, Integrations, Members, and Activity Stream.

2. Specify who is notified of CircleCI alerts using the Teams field. Auto-complete suggestions are provided as you type.

An alternative for Step 1) and Step 2) is to add the integration from the Team Dashboard of the team which will own the integration. To add an integration directly to a team, navigate to the Team Dashboard and open Integrations tab. Click Add Integration and select the integration that you would like to add.

3. Copy the integration API key to use in CircleCI configuration.

4. Click Save Integration.

CircleCI integration

Configuration in CircleCI

  1. Add the following configuration to your circle.yml file:

Text

1 2 3 notify: webhooks: - url: https://api.opsgenie.com/v1/json/circleci?apiKey=${API_KEY}

where ${API_KEY} is the integration API key you copied earlier.

Sample payload sent from CircleCI

Create Alert payload:

JSON

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 { "payload": { "compare": "https://github.com/kr-project/experimental/compare/8484cc4a96cf...a760ee54f155", "previous_successful_build": { "build_num": 27233, "status": "success", "build_time_millis": 246809 }, "build_parameters": null, "oss": false, "committer_date": "2015-12-10T13:55:35-08:00", "body": "", "usage_queued_at": "2015-12-10T21:55:52.543Z", "retry_of": null, "reponame": "experimental", "ssh_users": [], "build_url": "https://circleci.com/gh/kr-project/experimental/27237", "parallel": 2, "failed": null, "branch": "lbj-circle", "username": "kr-project", "author_date": "2015-12-10T13:55:35-08:00", "why": "github", "user": { "is_user": true, "login": "lukebayes", "name": "Luke Bayes", "email": "luke@krypton.io", "avatar_url": "https://avatars.githubusercontent.com/u/4817?v=3" }, "vcs_revision": "a760ee54f1551d606f3a0803ed64963a900a6a0a", "owners": [ "lukebayes" ], "vcs_tag": null, "build_num": 27237, "infrastructure_fail": false, "ssh_enabled": false, "committer_email": "lukebayes@gmail.com", "previous": { "build_num": 27234, "status": "failed", "build_time_millis": 256466 }, "status": "fixed", "committer_name": "Luke Bayes", "pull_request_urls": [ "https://github.com/kr-project/experimental/pull/3175" ], "retries": null, "subject": "Test integration with OpsGenie support", "timedout": false, "dont_build": null, "lifecycle": "finished", "no_dependency_cache": null, "stop_time": "2015-12-10T22:04:11.461Z", "build_time_millis": 382714, "messages": [ { "type": "warning", "message": "Warning: CircleCI has located an Xcode project or workspace in this repository. CircleCI is currently offering limited release to our iOS build system. Please contact support if you would like access." } ], "is_first_green_build": false, "job_name": null, "start_time": "2015-12-10T21:57:48.747Z", "canceler": "talcami", "outcome": "success", "vcs_url": "https://github.com/kr-project/experimental", "author_name": "Luke Bayes", "queued_at": "2015-12-10T21:57:48.711Z", "canceled": false, "author_email": "lukebayes@gmail.com" } }

This payload is parsed by Opsgenie as:

JSON

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 { "repo_name": "experimental", "build_url": "https://circleci.com/gh/kr-project/experimental/27237", "branch": "lbj-circle", "subject": "Test integration with Opsgenie support", "build_number": 27233, "build_time_millis": 246809, "canceled": false, "canceler": "talcami", "committer_email": "lukebayes@gmail.com", "committer_name": "Luke Bayes", "committer_date": "2015-12-10T13:55:35-08:00", "start_time": "2015-12-10T21:57:48.747Z", "stop_time": "2015-12-10T22:04:11.461Z", "ssh_enabled": false, "why": "github" }

Sample alert

CircleCI sample alert
Last modified on Jan 7, 2021
Cached at 8:54 PM on Apr 10, 2021 |

Additional Help

Ask the Community