Webhooks | ION Factory OS

The manual for the New ION Experience has been released.

Check it out!

For the complete documentation index, see llms.txt. This page is also available as Markdown.

What are Webhooks?

Check out this post on Webhooks, why they're important, and what you might be able to do with them: https://www.chargebee.com/blog/what-are-webhooks-explained/

Allow List IP Addresses

Heads up, if the service the webhook is accessing sits behind a firewall you will need to allow list the appropriate IP addresses of our webhook servers. Below is a table of each environment and its associated IP addresses. Webhooks must use HTTPS.

App URL IP Addresses
staging.firstresonance.io [44.232.1.74/32, 52.43.58.96/32]
app.firstresonance.io [54.149.61.144/32, 52.88.34.10/32]
staging.ion-gov.com [3.30.182.161/32, 52.222.27.236/32]
app.ion-gov.com [3.30.162.33/32, 3.30.213.145/32]

Use cases with ION Webhooks

How to use Webhooks in ION

Basic concepts

ION Webhooks have a few models:

Types of Events

Now that you understand the basic terminology, you will want to know what types of events you can subscribe to with any receiver. In order to find our exhaustive list of events you can subscribe to, head over to the interactive API explorer and look for WebhookSubscription! Once there, you will want to click on ResourceEnum and WebhookSubscriptionActions

For example, if I subscribe to the resource ISSUES and the action CREATE, then I will get a webhook every time a new issue is created which I can then send to Microsoft Teams to notify the quality team using a script or an automation.

Quick example to set up your first Webhook

The following example creates a receiver for the webhook to go to. This example subscribes to firing off Webhooks every time that a Run in ION is created.

# Create a receiver
mutation CreateWebhookReceiver($input: CreateWebhookReceiverInput!) {
    createWebhookReceiver(input: $input) {
        webhookReceiver {
            id name description webhookUri sharedSecret contentType expectedResponseCode
            active subscriptions { resource action id } headers { key value id }
        }
    }
}

# Input
{
  "input": {
    "name": "Our example server",
    "webhookUri": "https://whoknows.where.this.leads"
  }
}

Remember the ID of the webhook receiver you created! When you create a receiver, ION will show you the ID created on the right side of the Interactive API explorer. You will need to populate that when creating the webhook subscription below.

# Subscribe to new runs that are created
mutation CreateWebhookSubscription($input: CreateWebhookSubscriptionInput!) {
    createWebhookSubscription(input: $input) {
        webhookSubscription {
            resource action id active receiverId events { id status }
        }
    }
}

# Input
{
  "input": {
    "receiverId": 1,
    "resource": "RUNS",
    "action": "CREATE"
  }
}

Webhook examples - Query existing webhooks

See all webhook receivers

{
    webhookReceivers {
      edges {
        node {
          sharedSecret
          id
          webhookUri
          _etag
          name
        }
      }
    }
  }

See all webhook subscriptions and their related receivers

{
  webhookSubscriptions {
    edges {
      node {
        id
        _etag
        action
        resource
        createdBy {
          id
          name
        }
        receiver {
          id
          description
        name
          webhookUri
        }
      }
    }
  }
}

Disable Existing Webhooks

You can disable entire receivers or disable individual subscriptions for each receiver.

Disable Receiver

mutation UpdateWebhookReceiver($input: UpdateWebhookReceiverInput!) {
    updateWebhookReceiver(input: $input) {
        webhookReceiver {
            id active _etag name subscriptions { id active resource action}
        }
    }
}

Input

{
  "input": {
    "id": 12,
    "etag": "abc123def456asdasd",
    "active": false
  }
}

Disable Subscription

mutation UpdateWebhookSubscription($input: UpdateWebhookSubscriptionInput!) {
    updateWebhookSubscription(input: $input) {
        webhookSubscription {
            id active _etag action resource receiver { id }
        }
    }
}
}

Input

{
  "input": {
    "id": 12,
    "etag": "abc123def456asdasd",
    "active": false
  }
}