diff --git a/projects/appointment-reminders-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt b/projects/appointment-reminders-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt index d80816dee..89230ef8e 100644 --- a/projects/appointment-reminders-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt +++ b/projects/appointment-reminders-and-delius/src/integrationTest/kotlin/uk/gov/justice/digital/hmpps/IntegrationTest.kt @@ -90,11 +90,11 @@ internal class IntegrationTest { "cd713c1b-1b27-45a0-b493-37a34666635a", "07000000001", mapOf("FirstName" to "Test", "NextWorkSession" to "01/01/2000"), - "A000001:01/01/2000:123, 456" + "A000001" ) verify(telemetryService).trackEvent( "UnpaidWorkAppointmentReminderSent", - mapOf("crn" to "A000001", "upwAppointmentIds" to "123, 456") + mapOf("crn" to "A000001", "upwAppointmentIds" to "123, 456", "notificationId" to "null") ) verify(telemetryService).trackEvent( "UnpaidWorkAppointmentReminderNotSent", diff --git a/projects/appointment-reminders-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/UnpaidWorkAppointmentsService.kt b/projects/appointment-reminders-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/UnpaidWorkAppointmentsService.kt index b2b41ca6c..4151c64ba 100644 --- a/projects/appointment-reminders-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/UnpaidWorkAppointmentsService.kt +++ b/projects/appointment-reminders-and-delius/src/main/kotlin/uk/gov/justice/digital/hmpps/service/UnpaidWorkAppointmentsService.kt @@ -20,15 +20,19 @@ class UnpaidWorkAppointmentsService( upwAppointmentRepository.getUnpaidWorkAppointments(LocalDate.now().plusDays(2), providerCode) .forEach { if (it.crn !in properties.excludedCrns) { - notificationClient.sendSms( + val response = notificationClient.sendSms( templateId, it.mobileNumber, mapOf("FirstName" to it.firstName, "NextWorkSession" to it.appointmentDate), - "${it.crn}:${it.appointmentDate}:${it.upwAppointmentIds}" + it.crn ) telemetryService.trackEvent( "UnpaidWorkAppointmentReminderSent", - mapOf("crn" to it.crn, "upwAppointmentIds" to it.upwAppointmentIds) + mapOf( + "crn" to it.crn, + "upwAppointmentIds" to it.upwAppointmentIds, + "notificationId" to response?.notificationId.toString() + ) ) } else telemetryService.trackEvent( "UnpaidWorkAppointmentReminderNotSent",