-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #77 from Nickm615/update-webhook-js-samples
updated webhook samples
- Loading branch information
Showing
12 changed files
with
141 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript | ||
// Using ES6 syntax | ||
import { ManagementClient } from '@kontent-ai/management-sdk'; | ||
|
||
const client = new ManagementClient({ | ||
environmentId: '<YOUR_ENVIRONMENT_ID>', | ||
apiKey: '<YOUR_API_KEY>' | ||
}); | ||
|
||
const response = await client.deleteWebhook() | ||
.byId("d53360f7-79e1-42f4-a524-1b53a417d03e") | ||
.toPromise(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript | ||
// Using ES6 syntax | ||
import { ManagementClient } from '@kontent-ai/management-sdk'; | ||
|
||
const client = new ManagementClient({ | ||
environmentId: '<YOUR_ENVIRONMENT_ID>', | ||
apiKey: '<YOUR_API_KEY>' | ||
}); | ||
|
||
const response = await client.getWebhook() | ||
.byId("5df74e27-1213-484e-b9ae-bcbe90bd5990") | ||
.toPromise(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript | ||
// Using ES6 syntax | ||
import { ManagementClient } from '@kontent-ai/management-sdk'; | ||
|
||
const client = new ManagementClient({ | ||
environmentId: '<YOUR_ENVIRONMENT_ID>', | ||
apiKey: '<YOUR_API_KEY>' | ||
}); | ||
|
||
const response = await client.listWebhooks() | ||
.toPromise(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript | ||
// Using ES6 syntax | ||
import { ManagementClient } from '@kontent-ai/management-sdk'; | ||
|
||
const client = new ManagementClient({ | ||
environmentId: '<YOUR_ENVIRONMENT_ID>', | ||
apiKey: '<YOUR_API_KEY>' | ||
}); | ||
|
||
const response = await client.addWebhook() | ||
.withData( | ||
{ | ||
name: "Example webhook", | ||
url: "https://example.com/webhook", | ||
secret: "secret_key", | ||
delivery_triggers: { | ||
slot: "preview", | ||
events: "specific", | ||
content_type: { | ||
enabled: "true", | ||
actions: [ | ||
{ | ||
action: "changed" | ||
} | ||
] | ||
}, | ||
asset: { | ||
enabled: "true", | ||
actions: [ | ||
{ | ||
action: "deleted" | ||
} | ||
] | ||
}, | ||
taxonomy: { | ||
enabled: "true", | ||
actions: [ | ||
{ | ||
action: "term_changed" | ||
} | ||
] | ||
}, | ||
language: { | ||
enabled: "true", | ||
actions: [ | ||
{ | ||
action: "changed" | ||
}, | ||
{ | ||
action: "created" | ||
} | ||
] | ||
}, | ||
content_item: { | ||
enabled: "true", | ||
actions: [ | ||
{ | ||
action: "workflow_step_changed", | ||
transition_to: [] | ||
} | ||
], | ||
filters: { | ||
collections: [ | ||
{} | ||
], | ||
content_types: [ | ||
{} | ||
], | ||
languages: [ | ||
{} | ||
] | ||
} | ||
} | ||
} | ||
}) | ||
.toPromise(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript | ||
// Using ES6 syntax | ||
import { ManagementClient } from '@kontent-ai/management-sdk'; | ||
|
||
const client = new ManagementClient({ | ||
environmentId: '<YOUR_ENVIRONMENT_ID>', | ||
apiKey: '<YOUR_API_KEY>' | ||
}); | ||
|
||
const response = await client.disableWebhook() | ||
.byId("5df74e27-1213-484e-b9ae-bcbe90bd5990") | ||
.toPromise(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Tip: Find more about JS/TS SDKs at https://kontent.ai/learn/javascript | ||
// Using ES6 syntax | ||
import { ManagementClient } from '@kontent-ai/management-sdk'; | ||
|
||
const client = new ManagementClient({ | ||
environmentId: '<YOUR_ENVIRONMENT_ID>', | ||
apiKey: '<YOUR_API_KEY>' | ||
}); | ||
|
||
const response = await client.enableWebhook() | ||
.byId("5df74e27-1213-484e-b9ae-bcbe90bd5990") | ||
.toPromise(); |