-
Notifications
You must be signed in to change notification settings - Fork 3
Send email notification
mo-zag edited this page Feb 25, 2020
·
3 revisions
Specify template name each name is associated to a template id within the service
List of email template names
- RM3830_DA_generic_notification
- DA_offer_accepted
- DA_offer_accepted_signature_confirmation_reminder
- DA_offer_declined
- DA_offer_no_response
- DA_offer_accepted_not_signed
- DA_offer_sent
- DA_offer_sent_reminder
- DA_offer_signed_contract_live
- DA_offer_withdrawn
template_name = 'DA_offer_accepted'
Recipient's email address
email_to = '[email protected]'
Template variables built within Gov notify to get all variables specific to each template login to https://www.notifications.service.gov.uk This hash should contain each variable with relevant data from the application.
gov_notify_template_arg = {
'da-offer-1-supplier-1': 'Supplier data',
'da-offer-1-reference': 'offer reference',
}.to_json
Service is using sidekiq to queue the service requests so you can use two methods perform_async, perform_in
perform_async will add to the queue immediately.
notification = FacilitiesManagement::GovNotifyNotification.perform_async(template_name, email_to, gov_notify_template_arg)
perform_in will add to the scheduled queue the service request to a specified time in the future.
notification = FacilitiesManagement::GovNotifyNotification.perform_in(1.minute, template_name, email_to, gov_notify_template_arg)
To send email notification use full code bellow.
def send_da_offer_accepted
template_name = 'DA_offer_accepted'
email_to = '[email protected]'
gov_notify_template_arg = {
'da-offer-1-supplier-1': 'Supplier data',
'da-offer-1-reference': 'offer reference',
}.to_json
notification = FacilitiesManagement::GovNotifyNotification.perform_async(template_name, email_to, gov_notify_template_arg)
end