Integrations
Integrations (webhook and Slack notifications) can be managed pragmatically using the Node.js API.
Required API Permission: Create Integrations
1
2
3import { Integration } from 'calibre'
4
5const createIntegration = async () => {
6 const site = 'calibre'
7 const destination = 'webhook'
8 const events = ['new_snapshot']
9 const url = 'https://mydomain.com/webhook/'
10
11
12 const integration = await Integration.create({
13 site,
14 destination,
15 events,
16 url
17 })
18
19
20 console.log(JSON.stringify(integration, null, 2))
21}
22
23createIntegration()
| Parameter | Required | Description |
|---|
| site | Yes | Site slug, found in site settings |
| url | Yes | The URL of where the webhook will be delivered via HTTP POST as application/json |
| events | Yes | An array of events. Eg: ['new_snapshot'] |
| destination | Yes | The destination of this integration. Either 'slack' or 'webhook' |
Required API Permission: Read Sites
1
2
3import { Integration } from 'calibre'
4
5const listIntegrations = async () => {
6 const site = 'calibre'
7 const count = 20
8
9
10 const integrations = await Integration.list({
11 site,
12 count
13 })
14
15
16 console.log(JSON.stringify(integrations, null, 2))
17}
18
19listIntegrations()
| Parameter | Required | Description |
|---|
| site | Yes | Site slug, found in site settings |
Required API Permission: Update Integrations
1
2
3import { Integration } from 'calibre'
4
5const updateIntegration = async () => {
6 const site = 'calibre'
7 const uuid = '59e36fca-6307-44f2-8908-1379edf7dc60'
8 const destination = 'webhook'
9 const events = ['new_snapshot']
10 const url = 'https://new.domain.com/webhook/'
11 const isDisabled = false
12
13
14 const integration = await Integration.update({
15 site,
16 uuid,
17 destination,
18 events,
19 url,
20 isDisabled
21 })
22
23
24 console.log(JSON.stringify(integration, null, 2))
25}
26
27updateIntegration()
| Parameter | Required | Description |
|---|
| site | Yes | Site slug, found in site settings |
| uuid | Yes | The UUID of a given integration |
| url | Yes | The URL of where the webhook will be delivered via HTTP POST as application/json |
| events | Yes | An array of events. Eg: ['new_snapshot'] |
| destination | Yes | The destination of this integration. Either 'slack' or 'webhook' |
| isDisabled | No | A boolean. Is this integration enabled? |
Required API Permission: Delete Integrations
1
2
3import { Integration } from 'calibre'
4
5const deleteIntegration = async () => {
6 const site = 'calibre'
7 const uuid = '59e36fca-6307-44f2-8908-1379edf7dc60'
8
9
10 const integration = await Integration.destroy({
11 site,
12 uuid
13 })
14
15
16 console.log(JSON.stringify(integration, null, 2))
17}
18
19deleteIntegration()
| Parameter | Required | Description |
|---|
| site | Yes | Site slug, found in site settings |
| uuid | Yes | The UUID of a given integration |