* zapier and webhook * instructions for zapier * Fix types * fix types * revert adding zap template * Update packages/app-store/zapier/README.md Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> * Update packages/app-store/zapier/README.md Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> * Update packages/app-store/zapier/README.md Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> * Update packages/features/webhooks/lib/scheduleTrigger.ts Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> * wip * Fixes from comments, no more sendPayloadNoBooking * fix subscriberOptions teamIds param type * types * Update packages/features/webhooks/lib/sendPayload.ts * Re add zapierPayload to don't break old zaps * instead of metadata use oooEntry inside webhookPayload * undo comment message * Types * reset changes on yarn.lock * review changes * fix types * fix types * tentative fix for types in webhook * type improvements * fix description + clean up * revert yarn.lock changes * allow custom template for ooo entry * type fixes * type fix * fix donwloadLinks in payload * simplify some types * allow array or number for teamId * same payload for test trigger * code clean up * fix no show e2e test * translate text for webhook payload and fix conditional * add test for ooo_created webhooks * reset files * merge fix * fix test data test id * remove unused variable * only trigger for accepted memberships * remove unused variable --------- Co-authored-by: Carina Wollendorfer <30310907+CarinaWolli@users.noreply.github.com> Co-authored-by: CarinaWolli <wollencarina@gmail.com> Co-authored-by: Udit Takkar <53316345+Udit-takkar@users.noreply.github.com> Co-authored-by: Keith Williams <keithwillcode@gmail.com> Co-authored-by: Omar López <zomars@me.com>
41 lines
1023 B
TypeScript
41 lines
1023 B
TypeScript
import type { EventPayloadType, EventTypeInfo } from "@calcom/features/webhooks/lib/sendPayload";
|
|
import type { CalendarEvent } from "@calcom/types/Calendar";
|
|
|
|
export const getWebhookPayloadForBooking = ({
|
|
booking,
|
|
evt,
|
|
}: {
|
|
booking: {
|
|
eventType: {
|
|
title: string;
|
|
description: string | null;
|
|
requiresConfirmation: boolean;
|
|
price: number;
|
|
currency: string;
|
|
length: number;
|
|
id: number;
|
|
} | null;
|
|
id: number;
|
|
eventTypeId: number | null;
|
|
userId: number | null;
|
|
};
|
|
evt: CalendarEvent;
|
|
}) => {
|
|
const eventTypeInfo: EventTypeInfo = {
|
|
eventTitle: booking.eventType?.title,
|
|
eventDescription: booking.eventType?.description,
|
|
requiresConfirmation: booking.eventType?.requiresConfirmation || null,
|
|
price: booking.eventType?.price,
|
|
currency: booking.eventType?.currency,
|
|
length: booking.eventType?.length,
|
|
};
|
|
|
|
const payload: EventPayloadType = {
|
|
...evt,
|
|
...eventTypeInfo,
|
|
bookingId: booking.id,
|
|
};
|
|
|
|
return payload;
|
|
};
|