Search results for "{{ search.query }}"

No results found for "{{search.query}}". 
View All Results

Integration API

List Integrations

Optional Parameters

Parameter

type

Type of the integration. If type parameter is given, the result will be filtered by type

teamId

The ID of the team. If the team ID parameter is given, the result will be filtered by teamId

teamName

The name of the team. If the team name parameter is given, the result will be filtered by teamName

If the apiKey belongs to a team integration, only that team's integrations will be listed. In that case teamId and teamName parameters are not allowed

Sample Request

curl -X GET 'https://api.opsgenie.com/v2/integrations?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889'

Response:

{
  "code": 200,
  "data": [
    {
      "id": "055082dc-9427-48dd-85e0-f93a76e5f4a2",
      "name": "Signal Sciences",
      "enabled": true,
      "type": "SignalSciences"
    },
    {
      "id": "073e8e6a-a481-4b9b-8619-5c31d9a6e5da",
      "name": "Default API",
      "enabled": true,
      "type": "API"
    },
    {
      "id": "3163a9f9-5950-4e73-b99f-92562956e39c",
      "name": "Datadog",
      "enabled": false,
      "type": "Datadog"
    },
    {
      "id": "55e405e3-a130-4c7a-9866-664e498f39a9",
      "name": "Observium2",
      "enabled": false,
      "type": "ObserviumV2"
    },
    {
      "id": "72f6f51b-1ea9-4efd-be1b-4f29d1f593c6",
      "name": "Solarwinds",
      "enabled": false,
      "type": "Solarwinds"
    },
    {
      "id": "733388de-2ac1-4d70-8a2e-82834cb679d6",
      "name": "Webhook",
      "enabled": false,
      "type": "Webhook"
    },
    {
      "id": "8418d193-2dab-4490-b331-8c02cdd196b7",
      "name": "Marid",
      "enabled": false,
      "type": "Marid"
    }
  ],
  "took": 0,
  "requestId": "9ceeb66b-9890-4687-9dbb-a38abc71eda3"
}

Get Integration

If the apiKey belongs to a team integration, only that team's integrations can be retrieved.

Sample Request

curl -X GET 'https://api.opsgenie.com/v2/integrations/8418d193-2dab-4490-b331-8c02cdd196b7?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889'

Response:

{
  "code": 200,
  "data": {
    "_readOnly": [
      "isAdvanced",
      "isGlobal"
    ],
    "alertActions": [
      "Create",
      "Acknowledge",
      "UnAcknowledge",
      "Snooze",
      "EscalateToNext",
      "AddNote",
      "AddRecipient",
      "AddTeam",
      "AddTags",
      "RemoveTags",
      "Close",
      "Delete",
      "CustomAction",
      "AssignOwnership",
      "TakeOwnership"
    ],
    "alertFilter": {
      "conditionMatchType": "Match All",
      "conditions": []
    },
    "sendAlertActions": true,
    "enabled": false,
    "allowConfigurationAccess": false,
    "allowWriteAccess": true,
    "ignoreRecipientsFromPayload": false,
    "ignoreTeamsFromPayload": false,
    "isAdvanced": false,
    "recipients": [],
    "suppressNotifications": false,
    "isGlobal": true,
    "name": "Marid",
    "type": "Marid"
  },
  "took": 0,
  "requestId": "d6e1300e-6ec8-4eeb-9c8e-096799424c1b"
}

Create API Based Integration

Mandatory Parameters

Parameter
Description

type

Type of the integration. (For instance, "API" for API Integration.

name

Name of the integration. Name must be unique for each integration.

Optional Parameters

Parameter
Description

enabled

This parameter is for specifying whether the integration will be enabled or not. Defaults to true

allowConfigurationAccess

This parameter is for allowing or restricting the configuration access. If configuration access is restricted, the integration will be limited to Alert API requests and sending heartbeats. Defaults to false.

allowWriteAccess

This parameter is for configuring the read-only access of integration. If the integration is limited to read-only access, the integration will not be authorized to perform any create, update or delete action within any domain. Defaults to true.

ignoreRecipientsFromPayload

If enabled, the integration will ignore recipients sent in request payloads. Defaults to false.

ignoreTeamsFromPayload

If enabled, the integration will ignore teams sent in request payloads. Defaults to false.

recipients

Optional user, schedule, teams or escalation names to calculate which users will receive the notifications of the alert. Recipients which are exceeding the limit are ignored. The possible values for recipients are:

  • user
  • escalation
  • schedule
  • team
  • all
  • none

For example: "recipients": [{"type": "team","name": "team1"},{"type": "user","username": "abc@opsgenie.com"}]

suppressNotifications

If enabled, notifications that come from alerts will be suppressed. Defaults to false.

Sample Requests

 curl -X POST 'https://api.opsgenie.com/v2/integrations'
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
  --header 'Content-Type: application/json'
  --data '{
  "type": "API",
  "name": "API Integration",
  "allowWriteAccess": true,
  "ignoreRecipientsFromPayload": false,
  "ignoreTeamsFromPayload": false,
  "recipients": [
    {
      "type": "team",
      "name": "team1"
    },
    {
      "type": "user",
      "username": "abc@opsgenie.com"
    },
    {
      "type": "escalation",
      "name": "team1_escalation"
    },
    {
      "type": "schedule",
      "name": "weekdaySchedule"
    }
  ],
  "suppressNotifications": false
}'

Response:

{
  "code": 201,
  "data": {
    "id": "6683487a-f06e-4b2e-b52c-3cbc30f9a59e",
    "name": "API Integration",
    "enabled": true,
    "type": "API",
    "apiKey": "24393670-fff1-45ed-913e-8d6aeebebc30"
  },
  "took": 0,
  "requestId": "b3578948-55b3-4acc-9bf1-2ce2db3e15a2"
}

Create Email Based Integration

Mandatory Parameters

Parameter
Description

type

Type of the integration. It should be set as "Email" for Email integrations.

name

Name of the integration. Name must be unique for each integration.

emailUsername

The username part of the email address. It must be unique for each integration.

Optional Parameters

Parameter
Description

enabled

This parameter is for specifying whether the integration will be enabled or not. Defaults to true.

ignoreRecipientsFromPayload

If enabled, the integration will ignore recipients sent in request payloads. Defaults to false.

ignoreTeamsFromPayload

If enabled, the integration will ignore teams sent in request payloads. Defaults to false.

recipients

Optional user, schedule, teams or escalation names to calculate which users will receive the notifications of the alert. Recipients which are exceeding the limit are ignored. The possible values for recipients are:

  • user
  • escalation
  • schedule
  • team
  • all
  • none

For example: "recipients": [{"type": "team","name": "team1"},{"type": "user","username": "abc@opsgenie.com"}]

suppressNotifications

If enabled, notifications that come from alerts will be suppressed. Defaults to false.

Sample Request

 curl -X POST https://api.opsgenie.com/v2/integrations
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
  --header 'Content-Type: application/json'
  --data '{
  "type": "Email",
  "name": "Email Integration",
  "emailUsername": "xyz",
  "ignoreRecipientsFromPayload": false,
  "ignoreTeamsFromPayload": false,
  "recipients": [{"type": "all"}],
  "suppressNotifications": false
}'

Response:

{
  "code": 201,
  "data": {
    "id": "9bb2a0bb-6b39-4578-8dd9-768df103aad6",
    "name": "Email Integration",
    "enabled": true,
    "type": "Email",
    "emailAddress": "xyz@opsgenieabc.opsgenie.net"
  },
  "took": 0,
  "requestId": "117c0352-bc80-4960-8298-fdd59bf27d02"
}

Update Integration

This call updates all information of the integration. If a parameter is not given in the payload, those parameters will be updated to their default values. We recommend you to use GET actions first, then modify the necessary parts and PUT the whole payload back again.

Mandatory Parameters

Parameter
Description

type

Type of the integration. It should be set as "Email" for generic Email integrations.

name

Name of the integration. Name must be unique for each integration.

emailUsername (only for email integrations)

Name of the integration. Name must be unique for each integration.

Optional Parameters

Parameter
Description

enabled

This parameter is for specifying whether the integration will be enabled or not. Defaults to true.

ignoreRecipientsFromPayload

If enabled, the integration will ignore recipients sent in request payloads. Defaults to false.

ignoreTeamsFromPayload

If enabled, the integration will ignore teams sent in request payloads. Defaults to false.

recipients

Optional user, schedule, teams or escalation names to calculate which users will receive the notifications of the alert. Recipients which are exceeding the limit are ignored. The possible values for recipients are:

  • user
  • escalation
  • schedule
  • team
  • all
  • none

For example: "recipients": [{"type": "team","name": "team1"},{"type": "user","username": "abc@opsgenie.com"}]

suppressNotifications

If enabled, notifications that come from alerts will be suppressed. Defaults to false.

If the apiKey belongs to a team integration, only that team's integrations can be updated.

Sample Request

 curl -X PUT 'https://api.opsgenie.com/v2/integrations/bb2a0bb-6b39-4578-8dd9-768df103aad6'
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
  --header 'Content-Type: application/json'
  --data '{
  "type": "Email",
  "name": "Email Integration-1",
  "emailUsername": "xyz",
  "ignoreRecipientsFromPayload": false,
  "ignoreTeamsFromPayload": false,
  "recipients": [{"type": "all"}],
  "suppressNotifications": false
}

Response

{
  "code": 200,
  "data": {
    "id": "ff2e93b1-7e0c-460d-9093-10b6ad897133",
    "name": "Email Integration-1",
    "enabled": true,
    "type": "Email",
    "emailAddress": "xyz2@opsgeniecaglatest.opsgenie.net"
  },
  "took": 0,
  "requestId": "9ae63dd7-ed00-4c81-86f0-c4ffd33142c9"
}

Delete Integration

If the apiKey belongs to a team integration, only that team's integrations can be deleted.

Sample Request

curl -X DELETE 'https://api.opsgenie.com/v2/integrations/8418d193-2dab-4490-b331-8c02cdd196b7?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889'

Response

{
  "result": "Deleted successful",
  "took": 0,
  "requestId": "d1aace7d-18c6-4aec-888d-d2b1308f9cd1"
}

Enable Integration

If the apiKey belongs to a team integration, only that team's integrations can be enabled.

Sample Request

curl -X POST 'https://api.opsgenie.com/v2/integrations/8418d193-2dab-4490-b331-8c02cdd196b7/enable'
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'

Response

{
  "code": 200,
  "data": {
    "id": "74410a0a-f57e-4f0a-bc87-cf6c96bbb2b9",
    "name": "API Integration76",
    "enabled": true,
    "type": "API"
  },
  "took": 0,
  "requestId": "cc32c4e5-de24-4fa3-a9d5-aa4883d11f8e"
}

Disable Integration

If the apiKey belongs to a team integration, only that team's integrations can be disabled.

Sample Request

curl -X POST 'https://api.opsgenie.com/v2/integrations/8418d193-2dab-4490-b331-8c02cdd196b7/disable'
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'

Response

{
  "code": 200,
  "data": {
    "id": "74410a0a-f57e-4f0a-bc87-cf6c96bbb2b9",
    "name": "API Integration",
    "enabled": false,
    "type": "API"
  },
  "took": 0,
  "requestId": "bb51d27a-b763-4ae5-9a7f-b575578e703d"
}

Authenticate Integration

JSON Body Fields

Fields
Mandatory
Description

type

true

Type of the integration. Possible values are;

Sample Request

curl -X POST 'https://api.opsgenie.com/v2/integrations/authenticate'
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
  --header 'Content-Type: application/json'
  --data '{ "type":"api" }'

Response

{
  "result": "Integration [api] is valid",
  "took": 0.093,
  "requestId": "a0199601-0245-4ed9-b7d7-0752e2f4824b"
}

Get Integration Actions

If the apiKey belongs to a team integration, only that the actions of that team's integrations can be retrieved.

Sample Request

curl -X GET 'https://api.opsgenie.com/v2/integrations/bcb4856b-8823-48c8-9f7c-c75a9e8b1c66/actions
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'

Response:

{
  "code": 200,
  "data": {
    "_parent": {
      "id": "bcb4856b-8823-48c8-9f7c-c75a9e8b1c66",
      "name": "API",
      "enabled": true,
      "type": "API"
    },
    "ignore": [],
    "create": [
      {
        "type": "create",
        "name": "Create Alert",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": [
            {
              "field": "alias",
              "isNot": false,
              "operation": "Contains",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}",
        "source": "{{source}}",
        "message": "{{message}}",
        "description": "{{description}}",
        "entity": "{{entity}}",
        "appendAttachments": true,
        "alertActions": [],
        "ignoreAlertActionsFromPayload": false,
        "recipients": [],
        "ignoreRecipientsFromPayload": false,
        "ignoreTeamsFromPayload": false,
        "tags": [],
        "ignoreTagsFromPayload": false,
        "extraProperties": {},
        "ignoreExtraPropertiesFromPayload": false
      }
    ],
    "close": [
      {
        "type": "close",
        "name": "Close Alert",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": [
            {
              "field": "alias",
              "isNot": false,
              "operation": "Contains",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ],
    "acknowledge": [
      {
        "type": "acknowledge",
        "name": "Acknowledge Alert",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ],
    "addNote": [
      {
        "type": "addNote",
        "name": "Add Note",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ]
  },
  "took": 0,
  "requestId": "85e0cf9a-599b-496b-b03d-f0d1b515b411"
}

Create a New Integration Action

Available Methods

Mandatory Parameters

Parameter
Description

type

The type of the action. Type can be:

  • create
  • close
  • acknowledge
  • addNote

name

Name of the action.

alias

Used for alert deduplication. Alias is a user defined identifier for alerts. There can be only one open alert with the same alias. Alias field provides the ability to assign a known ID and later this ID can be used to perform additional actions such as log, close, attach for the same alert.

Optional Parameters

Parameter
Description

order

It is an integer value that defines in which order the action will be performed.

user

Owner of the execution for integration action.

note

Additional alert action note.

filter

It is a map which takes conditionMatchType and conditions list as parameters. For example: "filter": {"conditionMatchType": "Match All Conditions","conditions": [{"field": "alias","isNot": false,"operation": "Is Empty","expectedValue": ""}}

conditionMatchType

It specifies which condition match type will be used for filtering. The options are:

  • Match All for Match all data option
  • Match Any Condition for Match one or more conditions below option
  • Match All Conditions for Match all conditions below option

conditions

A comma separated list of conditions which are set for filtering.For example: "conditions": [{"field": "alias","isNot": false,"operation": "Is Empty","expectedValue": ""}, {"field": "message","isNot": true,"operation": "Contains","expectedValue": "testAlert"}]

field

It specifies which field will be checked for filtering.

For API Based Integration the fields are given below:

  • Alias
  • Actions
  • Description
  • Entity
  • Extra Properties
  • Message
  • Recipients
  • Source
  • Tags
  • Teams

For Email Based Integration the fields are given below:

  • Conversation Subject
  • From Address
  • From Name
  • Messages
  • Subject

isNot

It is a boolean parameter whose default value is false.

operation

It specifies which operation should be satisfied to perform the actions. The conditions are listed below:

  • Contains
  • Equals
  • Matches
  • Starts With
  • Ends With
  • Is Empty
  • Equals Ignore Whitespace

expectedValue

It specifies what is the expected value of the field for filtering condition.

source (Only for create action)

User defined field to specify source of action.

message (Only for create action)

Alert text limited to 130 characters.

description (Only for create action)

This field can be used to provide a detailed description of the alert, anything that may not have fit in the Message field.

entity (Only for create action)

The entity the alert is related to.

tags (Only for create action)

A comma separated list of labels attached to the alert.

extraProperties (Only for create action)

Set of user defined properties. This will be specified as a nested JSON map such as: "extraProperties" : {"prop1":"prop1Value", "prop2":"prop2Value"}

ignoreRecipientsFromPayload (Only for create action)

If enabled, the integration will ignore recipients sent in request payloads. Defaults to false.

ignoreTeamsFromPayload (Only for create action)

If enabled, the integration will ignore teams sent in request payloads. Defaults to false.

recipients (Only for create action)

Optional user, schedule, teams or escalation names to calculate which users will receive the notifications of the alert. Recipients which are exceeding the limit are ignored. The possible values for recipients are:

  • user
  • escalation
  • schedule
  • team
  • all
  • none

For example: "recipients": [{"type": "team","name": "team1"},{"type": "user","username": "abc@opsgenie.com"}]

Sample Request for Create Integration Action

curl -X POST 'https://api.opsgenie.com/v2/integrations/bcb4856b-8823-48c8-9f7c-c75a9e8b1c66/actions
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
  --header 'Content-Type: application/json'
  --data '{
  "type": "create",
  "name": "Create Alert 2",
  "order": 1,
  "filter": {
    "conditionMatchType": "Match Any Condition",
    "conditions": [
      {
        "field": "tags",
        "isNot": false,
        "operation": "Is Empty",
        "expectedValue": ""
      }
    ]
  },
  "user": "{{user}}",
  "note": "{{note}}",
  "alias": "{{alias}}",
  "source": "{{source}}",
  "message": "{{message}}",
  "description": "{{description}}",
  "entity": "{{entity}}",
  "appendAttachments": true,
  "alertActions": [],
  "ignoreAlertActionsFromPayload": false,
  "recipients": [],
  "ignoreRecipientsFromPayload": false,
  "ignoreTeamsFromPayload": false,
  "tags": [],
  "ignoreTagsFromPayload": false,
  "extraProperties": {},
  "ignoreExtraPropertiesFromPayload": false
}'

Response

{
  "code": 201,
  "data": {
    "_parent": {
      "id": "bcb4856b-8823-48c8-9f7c-c75a9e8b1c66",
      "name": "API",
      "enabled": true,
      "type": "API"
    },
    "ignore": [],
    "create": [
      {
        "type": "create",
        "name": "Create Alert 2",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match Any Condition",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Is Empty",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}",
        "source": "{{source}}",
        "message": "{{message}}",
        "description": "{{description}}",
        "entity": "{{entity}}",
        "appendAttachments": true,
        "alertActions": [],
        "ignoreAlertActionsFromPayload": false,
        "recipients": [],
        "ignoreRecipientsFromPayload": false,
        "ignoreTeamsFromPayload": false,
        "tags": [],
        "ignoreTagsFromPayload": false,
        "extraProperties": {},
        "ignoreExtraPropertiesFromPayload": false
      },
      {
        "type": "create",
        "name": "Create Alert",
        "order": 2,
        "filter": {
          "conditionMatchType": "Match Any Condition",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Is Empty",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}",
        "source": "{{source}}",
        "message": "{{message}}",
        "description": "{{description}}",
        "entity": "{{entity}}",
        "appendAttachments": true,
        "alertActions": [],
        "ignoreAlertActionsFromPayload": false,
        "recipients": [],
        "ignoreRecipientsFromPayload": false,
        "ignoreTeamsFromPayload": false,
        "tags": [],
        "ignoreTagsFromPayload": false,
        "extraProperties": {},
        "ignoreExtraPropertiesFromPayload": false
      }
    ],
    "close": [
      {
        "type": "close",
        "name": "Close Alert",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All Conditions",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Equals",
              "expectedValue": "closeAlert"
            }
          ]
        },
        "user": "API",
        "note": "",
        "alias": "{{alias}}"
      }
    ],
    "acknowledge": [
      {
        "type": "acknowledge",
        "name": "Acknowledge Alert",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ],
    "addNote": [
      {
        "type": "addNote",
        "name": "Add Note",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ]
  },
  "took": 0,
  "requestId": "789d5080-9d06-4820-a258-18aa879d4201"
}'

Sample Request for Creating Close Alert Action

curl -X POST 'https://api.opsgenie.com/v2/integrations/bcb4856b-8823-48c8-9f7c-c75a9e8b1c66/actions'
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
  --header 'Content-Type: application/json'
  --data '{
  "type": "close",
  "name": "Close Alert 3",
  "order": 1,
  "filter": {
    "conditionMatchType": "Match All Conditions",
    "conditions": [
      {
        "field": "tags",
        "isNot": false,
        "operation": "Equals",
        "expectedValue": "closeAlert"
      }
    ]
  },
  "user": "API",
  "note": "",
  "alias": "{{alias}}"
}'

Response

{
  "code": 201,
  "data": {
    "_parent": {
      "id": "bcb4856b-8823-48c8-9f7c-c75a9e8b1c66",
      "name": "API",
      "enabled": true,
      "type": "API"
    },
    "ignore": [],
    "create": [
      {
        "type": "create",
        "name": "Create Alert",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match Any Condition",
          "conditions": [
            {
              "field": "alias",
              "isNot": false,
              "operation": "Contains",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}",
        "source": "{{source}}",
        "message": "{{message}}",
        "description": "{{description}}",
        "entity": "{{entity}}",
        "appendAttachments": true,
        "alertActions": [],
        "ignoreAlertActionsFromPayload": false,
        "recipients": [],
        "ignoreRecipientsFromPayload": false,
        "ignoreTeamsFromPayload": false,
        "tags": [],
        "ignoreTagsFromPayload": false,
        "extraProperties": {},
        "ignoreExtraPropertiesFromPayload": false
      },
          {
        "type": "create",
        "name": "Create Alert",
        "order": 2,
        "filter": {
          "conditionMatchType": "Match Any Condition",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Is Empty",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}",
        "source": "{{source}}",
        "message": "{{message}}",
        "description": "{{description}}",
        "entity": "{{entity}}",
        "appendAttachments": true,
        "alertActions": [],
        "ignoreAlertActionsFromPayload": false,
        "recipients": [],
        "ignoreRecipientsFromPayload": false,
        "ignoreTeamsFromPayload": false,
        "tags": [],
        "ignoreTagsFromPayload": false,
        "extraProperties": {},
        "ignoreExtraPropertiesFromPayload": false
      }
    ],
    "close": [
      {
        "type": "close",
        "name": "Close Alert 3",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All Conditions",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Equals",
              "expectedValue": "closeAlert"
            }
          ]
        },
        "user": "API",
        "note": "",
        "alias": "{{alias}}"
      },
      {
        "type": "close",
        "name": "Close Alert 2",
        "order": 2,
        "filter": {
          "conditionMatchType": "Match All Conditions",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Contains",
              "expectedValue": "closeAlert"
            }
          ]
        },
        "user": "API",
        "note": "",
        "alias": "{{alias}}"
      },
      {
        "type": "close",
        "name": "Close Alert",
        "order": 3,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": [
            {
              "field": "alias",
              "isNot": false,
              "operation": "Contains",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ],
    "acknowledge": [
      {
        "type": "acknowledge",
        "name": "Acknowledge Alert",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ],
    "addNote": [
      {
        "type": "addNote",
        "name": "Add Note",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ]
  },
  "took": 0,
  "requestId": "ca3c9c5d-f71e-4c7d-9df4-322d497af13c"
}

Sample Request for Creating Acknowledge Alert Action

curl -X POST 'https://api.opsgenie.com/v2/integrations/bcb4856b-8823-48c8-9f7c-c75a9e8b1c66/actions'
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
  --header 'Content-Type: application/json'
  --data '{
  "type": "acknowledge",
  "name": "Acknowledge Alert 2",
  "order": 1,
  "filter": {
    "conditionMatchType": "Match All Conditions",
    "conditions": [
      {
        "field": "actions",
        "isNot": false,
        "operation": "Contains",
        "expectedValue": "Acknowledge"
      }
    ]
  },
  "user": "{{user}}",
  "note": "{{note}}",
  "alias": "{{alias}}"
}'

Response

{
  "code": 201,
  "data": {
    "_parent": {
      "id": "bcb4856b-8823-48c8-9f7c-c75a9e8b1c66",
      "name": "API",
      "enabled": true,
      "type": "API"
    },
    "ignore": [],
    "create": [
      {
        "type": "create",
        "name": "Create Alert 2",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match Any Condition",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Is Empty",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}",
        "source": "{{source}}",
        "message": "{{message}}",
        "description": "{{description}}",
        "entity": "{{entity}}",
        "appendAttachments": true,
        "alertActions": [],
        "ignoreAlertActionsFromPayload": false,
        "recipients": [],
        "ignoreRecipientsFromPayload": false,
        "ignoreTeamsFromPayload": false,
        "tags": [],
        "ignoreTagsFromPayload": false,
        "extraProperties": {},
        "ignoreExtraPropertiesFromPayload": false
      },
      {
        "type": "create",
        "name": "Create Alert",
        "order": 2,
        "filter": {
          "conditionMatchType": "Match Any Condition",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Is Empty",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}",
        "source": "{{source}}",
        "message": "{{message}}",
        "description": "{{description}}",
        "entity": "{{entity}}",
        "appendAttachments": true,
        "alertActions": [],
        "ignoreAlertActionsFromPayload": false,
        "recipients": [],
        "ignoreRecipientsFromPayload": false,
        "ignoreTeamsFromPayload": false,
        "tags": [],
        "ignoreTagsFromPayload": false,
        "extraProperties": {},
        "ignoreExtraPropertiesFromPayload": false
      }
    ],
    "close": [
      {
        "type": "close",
        "name": "Close Alert 3",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All Conditions",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Equals",
              "expectedValue": "closeAlert"
            }
          ]
        },
        "user": "API",
        "note": "",
        "alias": "{{alias}}"
      },
      {
        "type": "close",
        "name": "Close Alert",
        "order": 3,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": [
            {
              "field": "alias",
              "isNot": false,
              "operation": "Contains",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ],
    "acknowledge": [
      {
        "type": "acknowledge",
        "name": "Acknowledge Alert 2",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All Conditions",
          "conditions": [
            {
              "field": "actions",
              "isNot": false,
              "operation": "Contains",
              "expectedValue": "Acknowledge"
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      },
      {
        "type": "acknowledge",
        "name": "Acknowledge Alert",
        "order": 2,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ],
    "addNote": [
      {
        "type": "addNote",
        "name": "Add Note",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ]
  },
  "took": 0,
  "requestId": "a7809462-b1d9-4fb5-a10a-620986bb45b6"
}

Sample Request for Creating Add Note Action

curl -X POST 'https://api.opsgenie.com/v2/integrations/bcb4856b-8823-48c8-9f7c-c75a9e8b1c66/actions'
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
  --header 'Content-Type: application/json'
  --data '{
  "type": "addNote",
  "name": "Add Note 2",
  "order": 1,
  "filter": {
    "conditionMatchType": "Match All",
    "conditions": []
  },
  "user": "{{user}}",
  "note": "{{note}}",
  "alias": "{{alias}}"
}'

Response

{
  "code": 201,
  "data": {
    "_parent": {
      "id": "bcb4856b-8823-48c8-9f7c-c75a9e8b1c66",
      "name": "API",
      "enabled": true,
      "type": "API"
    },
    "ignore": [],
    "create": [
      {
        "type": "create",
        "name": "Create Alert 2",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match Any Condition",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Is Empty",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}",
        "source": "{{source}}",
        "message": "{{message}}",
        "description": "{{description}}",
        "entity": "{{entity}}",
        "appendAttachments": true,
        "alertActions": [],
        "ignoreAlertActionsFromPayload": false,
        "recipients": [],
        "ignoreRecipientsFromPayload": false,
        "ignoreTeamsFromPayload": false,
        "tags": [],
        "ignoreTagsFromPayload": false,
        "extraProperties": {},
        "ignoreExtraPropertiesFromPayload": false
      },
      {
        "type": "create",
        "name": "Create Alert",
        "order": 2,
        "filter": {
          "conditionMatchType": "Match Any Condition",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Is Empty",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}",
        "source": "{{source}}",
        "message": "{{message}}",
        "description": "{{description}}",
        "entity": "{{entity}}",
        "appendAttachments": true,
        "alertActions": [],
        "ignoreAlertActionsFromPayload": false,
        "recipients": [],
        "ignoreRecipientsFromPayload": false,
        "ignoreTeamsFromPayload": false,
        "tags": [],
        "ignoreTagsFromPayload": false,
        "extraProperties": {},
        "ignoreExtraPropertiesFromPayload": false
      }
    ],
    "close": [
      {
        "type": "close",
        "name": "Close Alert 3",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All Conditions",
          "conditions": [
            {
              "field": "tags",
              "isNot": false,
              "operation": "Equals",
              "expectedValue": "closeAlert"
            }
          ]
        },
        "user": "API",
        "note": "",
        "alias": "{{alias}}"
      },
      {
        "type": "close",
        "name": "Close Alert",
        "order": 3,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": [
            {
              "field": "alias",
              "isNot": false,
              "operation": "Contains",
              "expectedValue": ""
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ],
    "acknowledge": [
      {
        "type": "acknowledge",
        "name": "Acknowledge Alert 2",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All Conditions",
          "conditions": [
            {
              "field": "actions",
              "isNot": false,
              "operation": "Contains",
              "expectedValue": "Acknowledge"
            }
          ]
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      },
      {
        "type": "acknowledge",
        "name": "Acknowledge Alert",
        "order": 2,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ],
    "addNote": [
      {
        "type": "addNote",
        "name": "Add Note",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      },
      {
        "type": "addNote",
        "name": "Add Note 2",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ]
  },
  "took": 0,
  "requestId": "a7809462-b1d9-4fb5-a10a-620986bb45b6"
}

Update All Integration Actions

This method updates all of the actions of the integration. If an action is not put on the payload, that action will be deleted. We recommend you to use GET actions first, then modify the necessary parts and PUT the whole payload back again.

Available Methods

Mandatory Parameters

type

The type of the action. Type can be:

  • create
  • close
  • acknowledge
  • addNote

name

Name of the action.

alias

Used for alert deduplication. Alias is a user defined identifier for alerts. There can be only one open alert with the same alias. Alias field provides the ability to assign a known ID and later this ID can be used to perform additional actions such as log, close, attach for the same alert.

Optional Parameters

order

It is an integer value that defines in which order the action will be performed.

user

Owner of the execution for integration action.

note

Additional alert action note.

filter

It is a map which takes conditionMatchType and conditions list as parameters. For example: "filter": {"conditionMatchType": "Match All Conditions","conditions": [{"field": "alias","isNot":false,"operation": "Is Empty","expectedValue": ""}}

conditionMatchType

It specifies which condition match type will be used for filtering. The options are:

  • Match All for Match all data option
  • Match Any Condition for Match one or more conditions below option
  • Match All Conditions for Match all conditions below option

conditions

A comma separated list of conditions which are set for filtering.For example: "conditions": [{"field": "alias","isNot": false,"operation": "Is Empty","expectedValue": ""}, {"field": "message","isNot": true,"operation": "Contains","expectedValue": "testAlert"}]

field

It specifies which field will be checked for filtering.

For API Based Integration the fields are given below:

  • Alias
  • Actions
  • Description
  • Entity
  • Extra Properties
  • Message
  • Recipients
  • Source
  • Tags
  • Teams

For Email Based Integration the fields are given below:

  • Conversation Subject
  • From Address
  • From Name
  • Messages
  • Subject

isNot

It is a boolean parameter whose default value is false.

operation

It specifies which operation should be satisfied to perform the actions. The conditions are listed below:

  • Contains
  • Equals
  • Matches
  • Starts With
  • Ends With
  • Is Empty
  • Equals Ignore Whitespace

expectedValue

It specifies what is the expected value of the field for filtering condition.

source (Only for create action)

User defined field to specify source of action.

message (Only for create action)

Alert text limited to 130 characters.

description (Only for create action)

This field can be used to provide a detailed description of the alert, anything that may not have fit in the Message field.

entity (Only for create action)

The entity the alert is related to.

tags (Only for create action)

A comma separated list of labels attached to the alert.

extraProperties (Only for create action)

Set of user defined properties. This will be specified as a nested JSON map such as: "extraProperties" : {"prop1":"prop1Value", "prop2":"prop2Value"}

ignoreRecipientsFromPayload (Only for create action)

If enabled, the integration will ignore recipients sent in request payloads. Defaults to false.

ignoreTeamsFromPayload (Only for create action)

If enabled, the integration will ignore teams sent in request payloads. Defaults to false.

recipients (Only for create action)

Optional user, schedule, teams or escalation names to calculate which users will receive the notifications of the alert. Recipients which are exceeding the limit are ignored. The possible values for recipients are:

  • user
  • escalation
  • schedule
  • team
  • all
  • none

For example: "recipients": [{"type": "team","name": "team1"},{"type":"user","username": "abc@opsgenie.com"}]

Sample Request for Create Integration Action

curl -X PUT  'https://api.opsgenie.com/v2/integrations/bcb4856b-8823-48c8-9f7c-c75a9e8b1c66/actions'
  --header 'Authorization: GenieKey eb243592-faa2-4ba2-a551q-1alpf565c889'
  --header 'Content-Type: application/json'
  --data '{
  "ignore": [],
  "create": [
    {
      "type": "create",
      "name": "Creating Alert",
      "order": 1,
      "filter": {
        "conditionMatchType": "Match All",
        "conditions": []
      },
      "user": "{{user}}",
      "note": "{{note}}",
      "alias": "{{alias}}",
      "source": "{{source}}",
      "message": "{{message}}",
      "description": "{{description}}",
      "entity": "{{entity}}",
      "appendAttachments": true,
      "alertActions": [],
      "ignoreAlertActionsFromPayload": false,
      "recipients": [],
      "ignoreRecipientsFromPayload": false,
      "ignoreTeamsFromPayload": false,
      "tags": [],
      "ignoreTagsFromPayload": false,
      "extraProperties": {},
      "ignoreExtraPropertiesFromPayload": false
    }
  ],
  "close": [
    {
      "type": "close",
      "name": "Close Alert",
      "order": 1,
      "filter": {
        "conditionMatchType": "Match All",
        "conditions": []
      },
      "user": "{{user}}",
      "note": "{{note}}",
      "alias": "{{alias}}"
    }
  ],
  "acknowledge": [
    {
      "type": "acknowledge",
      "name": "Acknowledge Alert",
      "order": 1,
      "filter": {
        "conditionMatchType": "Match All",
        "conditions": []
      },
      "user": "{{user}}",
      "note": "{{note}}",
      "alias": "{{alias}}"
    }
  ],
  "addNote": [
    {
      "type": "addNote",
      "name": "Add Note",
      "order": 1,
      "filter": {
        "conditionMatchType": "Match All",
        "conditions": []
      },
      "user": "{{user}}",
      "note": "{{note}}",
        "alias": "{{alias}}"
    }
  ]
}'

Response

{
  "code": 200,
  "data": {
    "_parent": {
      "id": "bcb4856b-8823-48c8-9f7c-c75a9e8b1c66",
      "name": "API",
      "enabled": true,
      "type": "API"
    },
    "ignore": [],
    "create": [
      {
        "type": "create",
        "name": "Creating Alert",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}",
        "source": "{{source}}",
        "message": "{{message}}",
        "description": "{{description}}",
        "entity": "{{entity}}",
        "appendAttachments": true,
        "alertActions": [],
        "ignoreAlertActionsFromPayload": false,
        "recipients": [],
        "ignoreRecipientsFromPayload": false,
        "ignoreTeamsFromPayload": false,
        "tags": [],
        "ignoreTagsFromPayload": false,
        "extraProperties": {},
        "ignoreExtraPropertiesFromPayload": false
      }
    ],
    "close": [
      {
        "type": "close",
        "name": "Close Alert",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ],
    "acknowledge": [
      {
        "type": "acknowledge",
        "name": "Acknowledge Alert",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ],
    "addNote": [
      {
        "type": "addNote",
        "name": "Add Note",
        "order": 1,
        "filter": {
          "conditionMatchType": "Match All",
          "conditions": []
        },
        "user": "{{user}}",
        "note": "{{note}}",
        "alias": "{{alias}}"
      }
    ]
  },
  "took": 0,
  "requestId": "1dc984f2-49a3-4582-a077-31a5ea6a33ee"
}

Integration API