-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebhook-example.ts
More file actions
28 lines (23 loc) · 866 Bytes
/
webhook-example.ts
File metadata and controls
28 lines (23 loc) · 866 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import { Poke } from "poke";
const poke = new Poke(); // uses POKE_API_KEY env var or poke login credentials
// Send a direct message to your agent
await poke.sendMessage("Remind me when the Closing Ceremony starts on Sunday");
// Create a webhook — your agent will act on incoming data
const webhook = await poke.createWebhook({
condition: "When a teammate pushes code",
action: "Send me a summary of what changed",
});
console.log("Webhook URL:", webhook.webhookUrl);
console.log("Webhook Token:", webhook.webhookToken);
// Fire the webhook (e.g. from a CI/CD pipeline, GitHub Action, etc.)
await poke.sendWebhook({
webhookUrl: webhook.webhookUrl,
webhookToken: webhook.webhookToken,
data: {
event: "push",
repo: "treehacks-project",
author: "alice",
message: "Add real-time collaboration feature",
files_changed: 12,
},
});