@graph8/sdk 0.5.1 → 0.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -5
- package/dist/index.d.mts +605 -54
- package/dist/index.d.ts +605 -54
- package/dist/index.js +914 -898
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +904 -897
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +480 -38
- package/dist/react.d.ts +480 -38
- package/dist/react.js +884 -896
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +884 -896
- package/dist/react.mjs.map +1 -1
- package/package.json +24 -7
package/README.md
CHANGED
|
@@ -96,9 +96,17 @@ const analysis = await g8.voice.analysis(call.id);
|
|
|
96
96
|
const page = await g8.pages.clone('https://competitor.com/pricing');
|
|
97
97
|
const { url } = await g8.pages.publish(page.id);
|
|
98
98
|
|
|
99
|
-
// Webhook events
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
// Webhook events (push model — verify each delivery server-side)
|
|
100
|
+
app.post('/webhooks/graph8', (req, res) => {
|
|
101
|
+
const event = g8.webhooks.constructEvent(
|
|
102
|
+
req.rawBody, // raw body string (verify before JSON.parse)
|
|
103
|
+
req.header('X-Studio-Signature'),
|
|
104
|
+
req.header('X-Studio-Timestamp'),
|
|
105
|
+
process.env.G8_WEBHOOK_SECRET,
|
|
106
|
+
{ toleranceSeconds: 300 },
|
|
107
|
+
);
|
|
108
|
+
if (event.event === 'engagement.email_replied') slack.send(`${event.data.contact} replied!`);
|
|
109
|
+
res.sendStatus(200);
|
|
102
110
|
});
|
|
103
111
|
```
|
|
104
112
|
|
|
@@ -263,8 +271,8 @@ const { track, identify, visitors, copilot, calendar } = useG8();
|
|
|
263
271
|
|
|
264
272
|
| Method | Description |
|
|
265
273
|
|--------|-------------|
|
|
266
|
-
| `g8.webhooks.
|
|
267
|
-
| `g8.webhooks.
|
|
274
|
+
| `g8.webhooks.constructEvent(body, sig, ts, secret, opts?)` | Verify a delivery's HMAC signature and return the parsed event (throws `WebhookSignatureError`) |
|
|
275
|
+
| `g8.webhooks.knownEvents` | The known event-type catalog |
|
|
268
276
|
|
|
269
277
|
## Auth Modes
|
|
270
278
|
|