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
async function testWebhookTarget(req: Request) {
let reqJson = await req.json();
console.log(reqJson);
const eventType = reqJson["event"];
let eventName = "calendly_event";
if (eventType === "invitee.created") {
eventName = "meeting_scheduled";
}
else if (eventType === "invitee.canceled") {
eventName = "meeting_cancelled";
}
const user = reqJson["payload"]["email"];
const name = reqJson["payload"]["name"];
const properties = {
email: user,
event_type: eventType,
name: name,
};
@ianvph.capturePostHogEvent(
@me.phProjectAPIKey,
user,
eventName,
properties,
);
return Response.json({ ok: true });
}
Only the latest version can be previewed
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.