diff --git a/api.planx.uk/modules/webhooks/docs.yaml b/api.planx.uk/modules/webhooks/docs.yaml index b200378244..d80e7eef85 100644 --- a/api.planx.uk/modules/webhooks/docs.yaml +++ b/api.planx.uk/modules/webhooks/docs.yaml @@ -29,8 +29,8 @@ components: new: type: object properties: - payload: - $ref: "#/components/schemas/Payload" + session_id: + type: string bops_id: type: string destination_url: diff --git a/api.planx.uk/modules/webhooks/service/sendNotification/index.test.ts b/api.planx.uk/modules/webhooks/service/sendNotification/index.test.ts index d3a4d25a54..b7d274c741 100644 --- a/api.planx.uk/modules/webhooks/service/sendNotification/index.test.ts +++ b/api.planx.uk/modules/webhooks/service/sendNotification/index.test.ts @@ -112,7 +112,7 @@ describe("Send Slack notifications endpoint", () => { event: { data: { new: { - payload: { sessionId: "xyz123" }, + session_id: "xyz123", bops_id: "abc123", destination_url: "https://www.bops-production.com", }, diff --git a/api.planx.uk/modules/webhooks/service/sendNotification/index.ts b/api.planx.uk/modules/webhooks/service/sendNotification/index.ts index e0dfd36947..57ffcc6862 100644 --- a/api.planx.uk/modules/webhooks/service/sendNotification/index.ts +++ b/api.planx.uk/modules/webhooks/service/sendNotification/index.ts @@ -45,7 +45,7 @@ const getMessageForEventType = (data: EventData, type: EventType) => { const getSessionIdFromEvent = (data: EventData, type: EventType) => ({ - "bops-submission": (data as BOPSEventData).payload?.sessionId, + "bops-submission": (data as BOPSEventData).session_id, "uniform-submission": (data as UniformEventData).payload?.sessionId, "email-submission": (data as EmailEventData).session_id, })[type]; diff --git a/api.planx.uk/modules/webhooks/service/sendNotification/schema.ts b/api.planx.uk/modules/webhooks/service/sendNotification/schema.ts index e8cb1c4f74..545a4fb220 100644 --- a/api.planx.uk/modules/webhooks/service/sendNotification/schema.ts +++ b/api.planx.uk/modules/webhooks/service/sendNotification/schema.ts @@ -1,15 +1,11 @@ import { z } from "zod"; -const payload = z.object({ - sessionId: z.string(), -}); - export const bopsSubmissionSchema = z.object({ body: z.object({ event: z.object({ data: z.object({ new: z.object({ - payload, + session_id: z.string(), bops_id: z.string(), destination_url: z.string(), }), @@ -26,7 +22,9 @@ export const uniformSubmissionSchema = z.object({ event: z.object({ data: z.object({ new: z.object({ - payload, + payload: z.object({ + sessionId: z.string(), + }), submission_reference: z.string(), response: z.object({ organisation: z.string(),