> For the complete documentation index, see [llms.txt](https://docs.cloudtruth.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.cloudtruth.com/configuration-management/events-notifications-webhooks.md).

# Events, Notifications, Webhooks

Get notified when a change is made.

CloudTruth allows you to subscribe to events.&#x20;

Use the example code below to configure sending a notification to a Slack channel.&#x20;

POST to `/api/v1/webhooks/` with a payload

```
{
  "name": "MyNewWebhook",
  "event_types": [
    "parameter_created"
  ],
  "type": "slack",
  "configuration": {
    "token": "string",
    "channel": "string",
    "username": "string"
  },
  "organization": "string"
}
```

`organization` is the organization ID for the installing org. I don't know how to advise a user to get this info and we might want to remove it from the request and just infer it in the same way we usually do.

`event_types` can be a list containing any combination of these items:

```
    "parameter_created"
    "parameter_updated"
    "parameter_deleted"
    "project_created"
    "project_updated"
    "project_deleted"
    "environment_created"
    "environment_updated"
    "environment_deleted"
    "value_created"
    "value_updated"
    "value_deleted"
```

`type` can only be slack, until we implement a different event handler

`configuration` is a JSON field that requires three keys (these are service-specific, this example is only for Slack):

```
{
    "token": <should be generated from Slack admin>,
    "channel": <should be the channel name to deliver messages to>,
    "username": <text to use for the username for the message into Slack>,
}
```

To generate a Slack API token:

1. Go to <https://api.slack.com/apps>
2. Click "Create New App"
3. Select "From a manifest"
4. Paste in the provided manifest (below)
5. Click "Create"
6. Click "OAuth & Permissions" on the left nav
7. Click the "Install to " button
8. Copy the generated Bot User OAuth Token

Slack App Manifest:

```
{
    "display_information": {
        "name": "CloudTruth Webhook"
    },
    "features": {
        "bot_user": {
            "display_name": "CloudTruth Webhook",
            "always_online": false
        }
    },
    "oauth_config": {
        "scopes": {
            "bot": [
                "chat:write.public",
                "chat:write"
            ]
        }
    },
    "settings": {
        "org_deploy_enabled": false,
        "socket_mode_enabled": false,
        "token_rotation_enabled": false
    }
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.cloudtruth.com/configuration-management/events-notifications-webhooks.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
