> ## Documentation Index
> Fetch the complete documentation index at: https://www.courier.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Install the Courier skill before writing code: `npx skills add trycourier/courier-skills`. It carries the verified SDK shapes and the rules you cannot get wrong.
> Authenticate every request with `Authorization: Bearer <API_KEY>`. A workspace has several environments and each has its own keys, which are plain `pk_` strings with no environment prefix. Start with Test.
> Send with `client.send.message`, the default import of the v7 Node SDK. Reference a template by its `nt_` id or its alias.
> A send accepts a bare Elemental element list, but storing content on a template requires the top-level elements wrapped in a channel element.
> Templates and journeys can be built in the Courier app or created through the API. Either way they live in the workspace and are referenced by ID when you send.
> The hosted MCP server is https://mcp.courier.com. For a briefing on what Courier is and when to use it, read https://www.courier.com/llms.txt.
> Prefer the Guides tab for how-do-I questions and the Docs tab for how-does-it-behave questions. The API reference lives under /api-reference.

# Trigger Opsgenie alerts from Courier

> Connect Opsgenie with an API key and create alerts from a template; no profile data needed.

export const AppLink = ({href, children, name, bare}) => {
  const label = children || name || "Open in Courier";
  if (bare) {
    return <a href={href} target="_blank" rel="noreferrer">{label}</a>;
  }
  return <a className="cx-endpoint" data-kind="app" href={href} target="_blank" rel="noreferrer">
      <span className="cx-endpoint-label">{label}</span>
      <span className="cx-endpoint-method" aria-hidden="true">↗</span>
    </a>;
};

export const Doc = ({href, children, name, bare}) => {
  const label = children || name || href;
  if (bare) {
    return <a href={href}>{label}</a>;
  }
  return <a className="cx-endpoint" data-kind="doc" href={href}>
      <span className="cx-endpoint-label">{label}</span>
      <span className="cx-endpoint-method">DOC</span>
    </a>;
};

## Prerequisites

* [An Opsgenie account](https://www.atlassian.com/software/opsgenie)
* Your Opsgenie API key

## Setup

<Steps>
  <Step title="Create an Opsgenie API integration">
    In Opsgenie, [create an API integration](https://support.atlassian.com/opsgenie/docs/create-a-default-api-integration/) and copy its API key.
  </Step>

  <Step title="Configure in Courier">
    Install the <AppLink href="https://app.courier.com/integrations/catalog/opsgenie">Opsgenie integration</AppLink> in Courier and enter your API key.
  </Step>
</Steps>

<Note>
  Set a value in the `Message` field in the channel configuration. Use a static message, or add the `data` property to the API call payload.
</Note>

<Frame>
  <img src="https://mintcdn.com/courier-4f1f25dc/xDJPBS8EQ58X_0-v/assets/opsgenie-channel-configuration.webp?fit=max&auto=format&n=xDJPBS8EQ58X_0-v&q=85&s=708f37e5b31f89d72cc11105bb772348" alt="OpsGenie Channel Configuration" width="2042" height="1161" data-path="assets/opsgenie-channel-configuration.webp" />
</Frame>

## Profile requirements

Opsgenie needs no profile data. Include the Opsgenie channel in your template, and Courier routes the notification to Opsgenie.

<CodeGroup>
  ```javascript Node.js theme={null}
  const { requestId } = await courier.send.message({
    message: {
      to: {},
      template: "nt_01kx4h2jdafq8bk9aftxak4b40",
    },
  });
  ```

  ```python Python theme={null}
  response = client.send.message(
      message={
          "to": {},
          "template": "nt_01kx4h2jdafq8bk9aftxak4b40",
      },
  )
  ```

  ```bash cURL wrap theme={null}
  curl -X POST https://api.courier.com/send \
    -H "Authorization: Bearer $COURIER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "message": {
        "to": {},
        "template": "nt_01kx4h2jdafq8bk9aftxak4b40"
      }
    }'
  ```

  ```ruby Ruby theme={null}
  response = courier.send_.message(
    message: {
      to: {},
      template: "nt_01kx4h2jdafq8bk9aftxak4b40"
    }
  )
  ```

  ```go Go theme={null}
  response, err := client.Send.Message(context.TODO(), courier.SendMessageParams{
  	Message: courier.SendMessageParamsMessage{
  		To: courier.SendMessageParamsMessageToUnion{
  			OfUserRecipient: &shared.UserRecipientParam{
  			},
  		},
  		Template: courier.String("nt_01kx4h2jdafq8bk9aftxak4b40"),
  	},
  })
  ```

  ```java Java theme={null}
  SendMessageParams params = SendMessageParams.builder()
      .message(SendMessageParams.Message.builder()
          .to(UserRecipient.builder().build())
          .template("nt_01kx4h2jdafq8bk9aftxak4b40")
          .build())
      .build();
  SendMessageResponse response = client.send().message(params);
  ```

  ```php PHP theme={null}
  $response = $client->send->message(
    message: [
      'to' => [],
      'template' => 'nt_01kx4h2jdafq8bk9aftxak4b40',
    ],
  );
  ```

  ```csharp C# theme={null}
  SendMessageParams parameters = new()
  {
      Message = new()
      {
          To = new UserRecipient {  },
          Template = "nt_01kx4h2jdafq8bk9aftxak4b40",
      },
  };

  var response = await client.Send.Message(parameters);
  ```

  ```bash CLI wrap theme={null}
  courier send message \
    --api-key "$COURIER_API_KEY" \
    --message.to '{}' \
    --message.template nt_01kx4h2jdafq8bk9aftxak4b40
  ```

  ```text MCP theme={null}
  With Courier MCP, send my Opsgenie template with no recipient profile data.
  ```
</CodeGroup>

For dynamic content, include the `data` property in the API call payload:

<CodeGroup>
  ```javascript Node.js highlight={3-4} theme={null}
  const { requestId } = await courier.send.message({
    message: {
      data: {
        metadata: {
          greeting: "Hey... DO NOT PANIC...",
        },
      },
      providers: {
        opsgenie: {
          override: {
            config: {
              apiKey: "YOUR_OPSGENIE_API_KEY",
            },
          },
        },
      },
      template: "nt_01kx4h2jdafq8bk9aftxak4b40",
      to: {},
    },
  });
  ```

  ```python Python highlight={3-4} theme={null}
  response = client.send.message(
      message={
          "data": {
              "metadata": {
                  "greeting": "Hey... DO NOT PANIC...",
              },
          },
          "providers": {
              "opsgenie": {
                  "override": {
                      "config": {
                          "apiKey": "YOUR_OPSGENIE_API_KEY",
                      },
                  },
              },
          },
          "template": "nt_01kx4h2jdafq8bk9aftxak4b40",
          "to": {},
      },
  )
  ```

  ```bash cURL highlight={6-7} wrap theme={null}
  curl -X POST https://api.courier.com/send \
    -H "Authorization: Bearer $COURIER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "message": {
        "data": {
          "metadata": {
            "greeting": "Hey... DO NOT PANIC..."
          }
        },
        "providers": {
          "opsgenie": {
            "override": {
              "config": {
                "apiKey": "YOUR_OPSGENIE_API_KEY"
              }
            }
          }
        },
        "template": "nt_01kx4h2jdafq8bk9aftxak4b40",
        "to": {}
      }
    }'
  ```

  ```ruby Ruby highlight={3-4} theme={null}
  response = courier.send_.message(
    message: {
      data: {
        metadata: {
          greeting: "Hey... DO NOT PANIC..."
        }
      },
      providers: {
        opsgenie: {
          override: {
            config: {
              apiKey: "YOUR_OPSGENIE_API_KEY"
            }
          }
        }
      },
      template: "nt_01kx4h2jdafq8bk9aftxak4b40",
      to: {}
    }
  )
  ```

  ```go Go highlight={9} theme={null}
  response, err := client.Send.Message(context.TODO(), courier.SendMessageParams{
  	Message: courier.SendMessageParamsMessage{
  		To: courier.SendMessageParamsMessageToUnion{
  			OfUserRecipient: &shared.UserRecipientParam{
  			},
  		},
  		Template: courier.String("nt_01kx4h2jdafq8bk9aftxak4b40"),
  		Data: map[string]any{
  			"metadata": map[string]any{
  				"greeting": "Hey... DO NOT PANIC...",
  			},
  		},
  		Providers: shared.MessageProvidersParam{
  			"opsgenie": shared.MessageProvidersTypeParam{
  				Override: map[string]any{
  					"config": map[string]any{
  						"apiKey": "YOUR_OPSGENIE_API_KEY",
  					},
  				},
  			},
  		},
  	},
  })
  ```

  ```java Java highlight={5-6} theme={null}
  SendMessageParams params = SendMessageParams.builder()
      .message(SendMessageParams.Message.builder()
          .to(UserRecipient.builder().build())
          .template("nt_01kx4h2jdafq8bk9aftxak4b40")
          .data(JsonValue.from(java.util.Map.of(
              "metadata", java.util.Map.of(
                  "greeting", "Hey... DO NOT PANIC..."
              )
          )))
          .providers(MessageProviders.builder()
              .putAdditionalProperty("opsgenie", JsonValue.from(java.util.Map.of("override", java.util.Map.of(
                      "config", java.util.Map.of(
                          "apiKey", "YOUR_OPSGENIE_API_KEY"
                      )
                  ))))
              .build())
          .build())
      .build();
  SendMessageResponse response = client.send().message(params);
  ```

  ```php PHP highlight={3-4} theme={null}
  $response = $client->send->message(
    message: [
      'data' => [
        'metadata' => [
          'greeting' => 'Hey... DO NOT PANIC...',
        ],
      ],
      'providers' => [
        'opsgenie' => [
          'override' => [
            'config' => [
              'apiKey' => 'YOUR_OPSGENIE_API_KEY',
            ],
          ],
        ],
      ],
      'template' => 'nt_01kx4h2jdafq8bk9aftxak4b40',
      'to' => [],
    ],
  );
  ```

  ```csharp C# highlight={9} theme={null}
  SendMessageParams parameters = new()
  {
      Message = new()
      {
          To = new UserRecipient {  },
          Template = "nt_01kx4h2jdafq8bk9aftxak4b40",
          Data = new Dictionary<string, JsonElement>()
          {
              { "metadata", JsonSerializer.Deserialize<JsonElement>(
                  """
                  {
                    "greeting": "Hey... DO NOT PANIC..."
                  }
                  """
              ) },
          },
          Providers = new Dictionary<string, MessageProvidersType>()
          {
              {
                  "opsgenie",
                  new()
                  {
                      Override = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(
                          """
                          {
                            "config": {
                              "apiKey": "YOUR_OPSGENIE_API_KEY"
                            }
                          }
                          """
                      ),
                  }
              },
          },
      },
  };

  var response = await client.Send.Message(parameters);
  ```

  ```bash CLI highlight={5} wrap theme={null}
  courier send message \
    --api-key "$COURIER_API_KEY" \
    --message.to '{}' \
    --message.template nt_01kx4h2jdafq8bk9aftxak4b40 \
    --message.data '{"metadata": {"greeting": "Hey... DO NOT PANIC..."}}' \
    --message.providers '{"opsgenie": {"override": {"config": {"apiKey": "YOUR_OPSGENIE_API_KEY"}}}}'
  ```

  ```text MCP theme={null}
  With Courier MCP, send my Opsgenie template with a custom greeting in the data.
  ```
</CodeGroup>

The delivered notification includes the value from the `data` property.

<Frame>
  <img src="https://mintcdn.com/courier-4f1f25dc/xDJPBS8EQ58X_0-v/assets/opsgenie-resulting-notification.webp?fit=max&auto=format&n=xDJPBS8EQ58X_0-v&q=85&s=777dee0776a07b5a0deb7286f41e2506" alt="OpsGenie Resulting Notification" width="1282" height="237" data-path="assets/opsgenie-resulting-notification.webp" />
</Frame>

## Overrides

<Doc href="/docs/send/overrides#how-overrides-work">How overrides work</Doc> covers the two levels and which one wins.

Overrides change the configuration or request body Courier sends to Opsgenie, such as the API key or the message body.

<Note>
  If you are using Opsgenie in the Europe region, use the URL `https://api.eu.opsgenie.com/v2` and the API key associated with your EU instance.
</Note>

<CodeGroup>
  ```javascript Node.js highlight={6-17} theme={null}
  const { requestId } = await courier.send.message({
    message: {
      template: "nt_01kx4h2jdafq8bk9aftxak4b40",
      to: {},
      providers: {
        opsgenie: {
          override: {
            config: {
              apiKey: "YOUR_OPSGENIE_API_KEY",
              url: "https://api.eu.opsgenie.com/v2",
            },
            headers: {},
            body: {
              message: "YOUR MESSAGE",
            },
          },
        },
      },
    },
  });
  ```

  ```python Python highlight={6-17} theme={null}
  response = client.send.message(
      message={
          "template": "nt_01kx4h2jdafq8bk9aftxak4b40",
          "to": {},
          "providers": {
              "opsgenie": {
                  "override": {
                      "config": {
                          "apiKey": "YOUR_OPSGENIE_API_KEY",
                          "url": "https://api.eu.opsgenie.com/v2",
                      },
                      "headers": {},
                      "body": {
                          "message": "YOUR MESSAGE",
                      },
                  },
              },
          },
      },
  )
  ```

  ```bash cURL highlight={9-20} wrap theme={null}
  curl -X POST https://api.courier.com/send \
    -H "Authorization: Bearer $COURIER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "message": {
        "template": "nt_01kx4h2jdafq8bk9aftxak4b40",
        "to": {},
        "providers": {
          "opsgenie": {
            "override": {
              "config": {
                "apiKey": "YOUR_OPSGENIE_API_KEY",
                "url": "https://api.eu.opsgenie.com/v2"
              },
              "headers": {},
              "body": {
                "message": "YOUR MESSAGE"
              }
            }
          }
        }
      }
    }'
  ```

  ```ruby Ruby highlight={6-17} theme={null}
  response = courier.send_.message(
    message: {
      template: "nt_01kx4h2jdafq8bk9aftxak4b40",
      to: {},
      providers: {
        opsgenie: {
          override: {
            config: {
              apiKey: "YOUR_OPSGENIE_API_KEY",
              url: "https://api.eu.opsgenie.com/v2"
            },
            headers: {},
            body: {
              message: "YOUR MESSAGE"
            }
          }
        }
      }
    }
  )
  ```

  ```go Go highlight={9-20} theme={null}
  response, err := client.Send.Message(context.TODO(), courier.SendMessageParams{
  	Message: courier.SendMessageParamsMessage{
  		To: courier.SendMessageParamsMessageToUnion{
  			OfUserRecipient: &shared.UserRecipientParam{
  			},
  		},
  		Template: courier.String("nt_01kx4h2jdafq8bk9aftxak4b40"),
  		Providers: shared.MessageProvidersParam{
  			"opsgenie": shared.MessageProvidersTypeParam{
  				Override: map[string]any{
  					"config": map[string]any{
  						"apiKey": "YOUR_OPSGENIE_API_KEY",
  						"url": "https://api.eu.opsgenie.com/v2",
  					},
  					"headers": map[string]any{},
  					"body": map[string]any{
  						"message": "YOUR MESSAGE",
  					},
  				},
  			},
  		},
  	},
  })
  ```

  ```java Java highlight={6-15} theme={null}
  SendMessageParams params = SendMessageParams.builder()
      .message(SendMessageParams.Message.builder()
          .to(UserRecipient.builder().build())
          .template("nt_01kx4h2jdafq8bk9aftxak4b40")
          .providers(MessageProviders.builder()
              .putAdditionalProperty("opsgenie", JsonValue.from(java.util.Map.of("override", java.util.Map.of(
                      "config", java.util.Map.of(
                          "apiKey", "YOUR_OPSGENIE_API_KEY",
                          "url", "https://api.eu.opsgenie.com/v2"
                      ),
                      "headers", java.util.Map.of(),
                      "body", java.util.Map.of(
                          "message", "YOUR MESSAGE"
                      )
                  ))))
              .build())
          .build())
      .build();
  SendMessageResponse response = client.send().message(params);
  ```

  ```php PHP highlight={6-17} theme={null}
  $response = $client->send->message(
    message: [
      'template' => 'nt_01kx4h2jdafq8bk9aftxak4b40',
      'to' => [],
      'providers' => [
        'opsgenie' => [
          'override' => [
            'config' => [
              'apiKey' => 'YOUR_OPSGENIE_API_KEY',
              'url' => 'https://api.eu.opsgenie.com/v2',
            ],
            'headers' => [],
            'body' => [
              'message' => 'YOUR MESSAGE',
            ],
          ],
        ],
      ],
    ],
  );
  ```

  ```csharp C# highlight={9-28} theme={null}
  SendMessageParams parameters = new()
  {
      Message = new()
      {
          To = new UserRecipient {  },
          Template = "nt_01kx4h2jdafq8bk9aftxak4b40",
          Providers = new Dictionary<string, MessageProvidersType>()
          {
              {
                  "opsgenie",
                  new()
                  {
                      Override = JsonSerializer.Deserialize<Dictionary<string, JsonElement>>(
                          """
                          {
                            "config": {
                              "apiKey": "YOUR_OPSGENIE_API_KEY",
                              "url": "https://api.eu.opsgenie.com/v2"
                            },
                            "headers": {},
                            "body": {
                              "message": "YOUR MESSAGE"
                            }
                          }
                          """
                      ),
                  }
              },
          },
      },
  };

  var response = await client.Send.Message(parameters);
  ```

  ```bash CLI highlight={5} wrap theme={null}
  courier send message \
    --api-key "$COURIER_API_KEY" \
    --message.to '{}' \
    --message.template nt_01kx4h2jdafq8bk9aftxak4b40 \
    --message.providers '{"opsgenie": {"override": {"config": {"apiKey": "YOUR_OPSGENIE_API_KEY", "url": "https://api.eu.opsgenie.com/v2"}, "headers": {}, "body": {"message": "YOUR MESSAGE"}}}}'
  ```

  ```text MCP theme={null}
  With Courier MCP, send my Opsgenie template through the EU API URL and key.
  ```
</CodeGroup>

## Provider details

```text theme={null}
opsgenie
```

Courier recommends routing to the channel. Naming this key in `routing.channels` instead is supported, and sends through just this provider.

<Card title="Send to a specific provider" icon="bullseye-arrow" href="/docs/send/send-to-a-provider" horizontal arrow="true">
  When that is worth doing, and what you give up: failover, channel priority, and providers you add later.
</Card>
