add smsReminderNumber to webhook payload (#5823)
Co-authored-by: CarinaWolli <wollencarina@gmail.com>pull/5808/head^2
parent
8f1d3fbc50
commit
571176102e
|
@ -178,6 +178,7 @@ async function handler(req: NextApiRequest & { userId?: number }) {
|
||||||
...evt,
|
...evt,
|
||||||
...eventTypeInfo,
|
...eventTypeInfo,
|
||||||
status: "CANCELLED",
|
status: "CANCELLED",
|
||||||
|
smsReminderNumber: bookingToDelete.smsReminderNumber || undefined,
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.error(`Error executing webhook for event: ${eventTrigger}, URL: ${webhook.subscriberUrl}`, e);
|
console.error(`Error executing webhook for event: ${eventTrigger}, URL: ${webhook.subscriberUrl}`, e);
|
||||||
})
|
})
|
||||||
|
|
|
@ -984,6 +984,7 @@ async function handler(req: NextApiRequest & { userId?: number | undefined }) {
|
||||||
metadata: reqBody.metadata,
|
metadata: reqBody.metadata,
|
||||||
eventTypeId,
|
eventTypeId,
|
||||||
status: "ACCEPTED",
|
status: "ACCEPTED",
|
||||||
|
smsReminderNumber: booking?.smsReminderNumber || undefined,
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.error(`Error executing webhook for event: ${eventTrigger}, URL: ${sub.subscriberUrl}`, e);
|
console.error(`Error executing webhook for event: ${eventTrigger}, URL: ${sub.subscriberUrl}`, e);
|
||||||
})
|
})
|
||||||
|
|
|
@ -85,6 +85,7 @@ const sendPayload = async (
|
||||||
rescheduleUid?: string;
|
rescheduleUid?: string;
|
||||||
bookingId?: number;
|
bookingId?: number;
|
||||||
status?: string;
|
status?: string;
|
||||||
|
smsReminderNumber?: string;
|
||||||
}
|
}
|
||||||
) => {
|
) => {
|
||||||
const { appId, payloadTemplate: template } = webhook;
|
const { appId, payloadTemplate: template } = webhook;
|
||||||
|
|
|
@ -356,6 +356,7 @@ export const bookingsRouter = router({
|
||||||
dynamicEventSlugRef: true,
|
dynamicEventSlugRef: true,
|
||||||
dynamicGroupSlugRef: true,
|
dynamicGroupSlugRef: true,
|
||||||
destinationCalendar: true,
|
destinationCalendar: true,
|
||||||
|
smsReminderNumber: true,
|
||||||
},
|
},
|
||||||
where: {
|
where: {
|
||||||
uid: bookingId,
|
uid: bookingId,
|
||||||
|
@ -528,7 +529,10 @@ export const bookingsRouter = router({
|
||||||
};
|
};
|
||||||
const webhooks = await getWebhooks(subscriberOptions);
|
const webhooks = await getWebhooks(subscriberOptions);
|
||||||
const promises = webhooks.map((webhook) =>
|
const promises = webhooks.map((webhook) =>
|
||||||
sendPayload(webhook.secret, eventTrigger, new Date().toISOString(), webhook, evt).catch((e) => {
|
sendPayload(webhook.secret, eventTrigger, new Date().toISOString(), webhook, {
|
||||||
|
...evt,
|
||||||
|
smsReminderNumber: bookingToReschedule.smsReminderNumber || undefined,
|
||||||
|
}).catch((e) => {
|
||||||
console.error(
|
console.error(
|
||||||
`Error executing webhook for event: ${eventTrigger}, URL: ${webhook.subscriberUrl}`,
|
`Error executing webhook for event: ${eventTrigger}, URL: ${webhook.subscriberUrl}`,
|
||||||
e
|
e
|
||||||
|
@ -982,6 +986,7 @@ export const bookingsRouter = router({
|
||||||
bookingId,
|
bookingId,
|
||||||
eventTypeId: booking.eventType?.id,
|
eventTypeId: booking.eventType?.id,
|
||||||
status: "ACCEPTED",
|
status: "ACCEPTED",
|
||||||
|
smsReminderNumber: booking.smsReminderNumber || undefined,
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
console.error(
|
console.error(
|
||||||
`Error executing webhook for event: ${WebhookTriggerEvents.BOOKING_CREATED}, URL: ${sub.subscriberUrl}`,
|
`Error executing webhook for event: ${WebhookTriggerEvents.BOOKING_CREATED}, URL: ${sub.subscriberUrl}`,
|
||||||
|
|
Loading…
Reference in New Issue