Skip to main content

Defining Notification Recipient Details

To establish the recipient details for notifications, including email addresses, phone numbers, names, etc., based on specific logic or conditions, you can override the get_recipient_details function within the AppointmentView class. This function allows customization for determining who receives notifications and how they are contacted.

class AppointmentView(AppointmentBaseView):
def get_recipient_details(self, instance):
# Override as per your logic
result = {}
for participant in instance.participants:
result.update({
str(participant): {
'email': ['rajat@zelthy.com', 'amishi2407@gmail.com'],
'sms': '+917021640519',
'name': "Rajat"
}
})
return result

Explanation:

  • In the get_recipient_details function of the AppointmentView class, customize the logic to determine the recipient details for notifications.
  • The function loops through the participants associated with the appointment instance and gathers recipient information such as email addresses, phone numbers, and names.
  • Update the logic within this function to define how recipient details are selected and structured for sending notifications, ensuring that the correct contact information is utilized for email and SMS notifications based on the participants involved.