From c9fb82a7e694d30be1b54fbf97e2085b71dff2a1 Mon Sep 17 00:00:00 2001 From: Syed Ali Shahbaz <52925846+alishaz-polymath@users.noreply.github.com> Date: Mon, 14 Mar 2022 16:57:28 +0530 Subject: [PATCH] added event trigger to discord payload (#2109) Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com> --- apps/web/lib/webhooks/integrationTemplate.tsx | 2 +- apps/web/server/routers/viewer/webhook.tsx | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/web/lib/webhooks/integrationTemplate.tsx b/apps/web/lib/webhooks/integrationTemplate.tsx index 242c8dcc..6c9c9f9c 100644 --- a/apps/web/lib/webhooks/integrationTemplate.tsx +++ b/apps/web/lib/webhooks/integrationTemplate.tsx @@ -21,7 +21,7 @@ const customTemplate = (props: WebhookIntegrationProps) => { const integrationTemplate = (webhookIntegration: string) => { switch (webhookIntegration) { case "https://discord.com/api/webhooks/": - return '{"content": "A new event has been scheduled","embeds": [{"color": 2697513,"fields": [{"name": "What","value": "{{title}} ({{type}})"},{"name": "When","value": "Start: {{startTime}} \\n End: {{endTime}} \\n Timezone: ({{organizer.timeZone}})"},{"name": "Who","value": "Organizer: {{organizer.name}} ({{organizer.email}}) \\n Booker: {{attendees.0.name}} ({{attendees.0.email}})" },{"name":"Description", "value":": {{description}}"},{"name":"Where","value":": {{location}} "}]}]}'; + return '{"content": "An event has been scheduled/updated","embeds": [{"color": 2697513,"fields": [{"name": "Event Trigger","value": "{{triggerEvent}}"}, {"name": "What","value": "{{title}} ({{type}})"},{"name": "When","value": "Start: {{startTime}} \\n End: {{endTime}} \\n Timezone: ({{organizer.timeZone}})"},{"name": "Who","value": "Organizer: {{organizer.name}} ({{organizer.email}}) \\n Booker: {{attendees.0.name}} ({{attendees.0.email}})" },{"name":"Description", "value":": {{description}}"},{"name":"Where","value":": {{location}} "}]}]}'; } }; diff --git a/apps/web/server/routers/viewer/webhook.tsx b/apps/web/server/routers/viewer/webhook.tsx index 579e95c5..e69fee1a 100644 --- a/apps/web/server/routers/viewer/webhook.tsx +++ b/apps/web/server/routers/viewer/webhook.tsx @@ -146,6 +146,7 @@ export const webhookRouter = createProtectedRouter() }; const data = { + triggerEvent: "PING", type: "Test", title: "Test trigger event", description: "", @@ -161,7 +162,7 @@ export const webhookRouter = createProtectedRouter() ], organizer: { name: "Cal", - email: "", + email: "no-reply@cal.com", timeZone: "Europe/London", language, },