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

# Subscriptions listing

## Data Structure

### WebhookSubscription

An object that represents a submitted webhook subscription.
Each WebhookSubscription object defines what event should be monitored
and where the corresponding event payload should be delivered when the event occurs.

| Parameter      | Type                         | Description                                      |
| :------------- | :--------------------------- | :----------------------------------------------- |
| `id`           | `ID!`                        | The webhook subscription record ID.              |
| `label`        | `String!`                    | The webhook subscription record label.           |
| `triggerEvent` | `WebhookTriggerEvent!`       | An event ID that triggers this webhook.          |
| `targetUrl`    | `String!`                    | An endpoint URL where the webhook will be sent.  |
| `status`       | `WebhookSubscriptionStatus!` | A status of the webhook subscription.            |
| `createdAt`    | `Int!`                       | The timestamp when the subscription was created. |

### WebhookTriggerEvent

An enumeration that defines the set of available options to which webhook subscription can be bound.

Available options:

| Trigger event name                | Description                                                                 |
| :-------------------------------- | :-------------------------------------------------------------------------- |
| `USER_REGISTERED_TO_TRAINING`     | Triggers when user context have enrolled on LearningPath.                   |
| `USER_COMPLETED_TRAINING`         | Triggers when user context have complete LearningPath.                      |
| `USER_REGISTERED_TO_LIVE_SESSION` | Triggers when user context have registered to LiveSession.                  |
| `USER_ATTENDED_TO_LIVE_SESSION`   | Triggers when user context have been marked as attended at the LiveSession. |
| `LEARNING_PATH_NEW_REVISION`      | Triggers when LearningPath have receive a new published revision.           |
| `CERTIFICATE_EXPIRED`             | Triggers when earned user Certificate have been expired.                    |

In addition, the Opigno Enterprise API provides a time-based trigger definitions:

| Trigger event name             | Description                                                          |
| :----------------------------- | :------------------------------------------------------------------- |
| `*_BEFORE_LIVE_SESSION_STARTS` | Triggers when LiveSession is about to start in period of time.       |
| `*_BEFORE_CERTIFICATE_EXPIRE`  | Triggers when user Certificate is about to expire in period of time. |

## Queries

### listWebhookSubscriptions

<Info>
  * The API user context must have `AUTHENTICATED` scope to access webhook subscriptions. Anonymous users cannot retrieve this data.
  * The API user context must have permission to view webhook subscriptions.
  * The API user context must be present and valid - otherwise, access is denied.
</Info>

The following arguments can be used in the query:

| Argument   | Type                    | Description                       |
| :--------- | :---------------------- | :-------------------------------- |
| `triggers` | `[WebhookSubscription]` | Optional filter by trigger event. |

<CodeGroup>
  ```graphql GraphQL Query theme={null}
  query listWebhookSubscriptions {
    listWebhookSubscriptions(triggers: [USER_REGISTERED_TO_LIVE_SESSION, USER_ATTENDED_TO_LIVE_SESSION, LEARNING_PATH_NEW_REVISION, ONE_DAY_BEFORE_LIVE_SESSION_STARTS]) {
      response {
        id
        label
        triggerEvent
        targetUrl
        status
        createdAt
      }
      errors
    }
  }
  ```

  ```json Response theme={null}
  {
    "listWebhookSubscriptions": {
      "response": [
        {
          "id": "1",
          "label": "User registered to LS",
          "triggerEvent": "USER_REGISTERED_TO_LIVE_SESSION",
          "targetUrl": "https://hooks.zapier.com/*",
          "status": "SUBSCRIBED",
          "createdAt": 1759768236
        },
        {
          "id": "2",
          "label": "User attends LS",
          "triggerEvent": "ONE_DAY_BEFORE_LIVE_SESSION_STARTS",
          "targetUrl": "https://hooks.zapier.com/*",
          "status": "SUBSCRIBED",
          "createdAt": 1759770732
        },
        {
          "id": "3",
          "label": "LP released new revision",
          "triggerEvent": "LEARNING_PATH_NEW_REVISION",
          "targetUrl": "https://hooks.zapier.com/*",
          "status": "SUBSCRIBED",
          "createdAt": 1759837992
        },
        {
          "id": "4",
          "label": "A Day before LS starts",
          "triggerEvent": "ONE_DAY_BEFORE_LIVE_SESSION_STARTS",
          "targetUrl": "https://hooks.zapier.com/*",
          "status": "SUBSCRIBED",
          "createdAt": 1759838342
        }
      ],
      "errors": []
    }
  }
  ```
</CodeGroup>

## Related Features

The `listWebhookSubscriptions` query supports the same advanced features as other catalog queries:

<CardGroup cols={2}>
  <Card title="Authentication" icon="key" href="/OpignoEnterpriseAPI/ConsumerUserAuthentication">
    Understand the authentication requirements and how to properly authenticate your requests.
  </Card>
</CardGroup>

Common error scenarios and solutions:

<AccordionGroup>
  <Accordion title="Authentication Errors">
    * **401 Unauthorized**: Ensure you're using a valid authentication token with `AUTHENTICATED` scope
    * **403 Forbidden**: Verify your user account has the necessary permissions to access webhook subscription data
  </Accordion>
</AccordionGroup>
