1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "notifications": [
12 {
13 "text": "Deploy finished: {{service}} is live.",
14 "vars": {
15 "service": "api"
16 },
17 "channels": [
18 {
19 "type": "webhook",
20 "url": "https://example.com/notify"
21 },
22 {
23 "type": "slack",
24 "url": "https://hooks.slack.com/services/EXAMPLE/EXAMPLE/EXAMPLE"
25 }
26 ]
27 },
28 {
29 "text": "Daily digest ready.",
30 "channels": [
31 {
32 "type": "discord",
33 "url": "https://discord.com/api/webhooks/EXAMPLE/EXAMPLE"
34 }
35 ]
36 }
37 ]
38};
39
40
41const run = await client.actor("kopachelli/notifyhub").call(input);
42
43
44console.log('Results from dataset');
45console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
46const { items } = await client.dataset(run.defaultDatasetId).listItems();
47items.forEach((item) => {
48 console.dir(item);
49});
50
51