Create an alert

Creates a new alert that notifies you on Slack or via webhook when one of the subscribed events happens.

Body·
required
application/json

Create an alert

  • active
    Type: boolean
    required

    Whether the alert is active.

  • channel
    Type: stringenum
    required

    Delivery channel for the alert.

    values
    • SLACK
    • HOOK_URL
    • ALL
  • events
    Type: array string[]
    required

    List of events that trigger the alert.

  • automated_test_ids
    Type: array integer[]

    Optional list of automated test IDs this alert should be scoped to.

  • hook_url
    Type: string

    HTTPS URL that receives a JSON POST when an event fires. Required when channel is HOOK_URL or ALL.

  • slack_channel_id
    Type: integerFormat: int32

    ID of a Slack channel previously connected to your project. Required when channel is SLACK or ALL.

Responses
  • application/json
  • application/json
Request Example for post/v1/alerts
curl http://api.mailreach.co/api/v1/alerts \
  --request POST \
  --header 'Content-Type: application/json' \
  --header 'X-Api-Key: YOUR_SECRET_TOKEN' \
  --data '{
  "active": true,
  "slack_channel_id": 42,
  "channel": "SLACK",
  "hook_url": "https://example.com/hooks/mailreach",
  "automated_test_ids": [
    12,
    34
  ],
  "events": [
    "ACCOUNT_DISCONNECTED",
    "SPAMCHECK_COMPLETED"
  ]
}'
{
  "id": 42,
  "channel": "SLACK",
  "events": [
    "ACCOUNT_DISCONNECTED",
    "SPAMCHECK_COMPLETED"
  ],
  "active": true,
  "hook_url": "https://example.com/hooks/mailreach",
  "slack_channel_id": 42,
  "automated_test_ids": [
    12,
    34
  ]
}