コード例 #1
0
def on_new_enrollment_handler(body, message):
    notification_data = EmailNotificationData.from_json(body['enrollment'])
    Notification.new(recipient_email=notification_data.to, subject=notification_data.subject,
                     content=notification_data.text, template_type="enrollment",
                     extra_data=notification_data.extra_data,
                     full_data=str(notification_data.to_json()),
                     template_id=CALL_TO_ACTION_SENDGRID_TEMPLATE_ID,
                     categories=json.dumps([
                         "lms",
                         "enrollment",
                         "new"
                     ]))
コード例 #2
0
def on_account_activation_email(body, message):
    notification_data = EmailNotificationData.from_json(body['data'])
    Notification.new(recipient_email=notification_data.to, subject=notification_data.subject,
                     content=notification_data.text, template_type="account",
                     extra_data=notification_data.extra_data,
                     full_data=str(notification_data.to_json()),
                     template_id=CALL_TO_ACTION_SENDGRID_TEMPLATE_ID,
                     categories=json.dumps([
                         "lms",
                         "account",
                         "activation",
                     ]))
コード例 #3
0
def on_certificate_ready_handler(body, message):
    print(body)
    notification_data = EmailNotificationData.from_json(body['certificate'])
    Notification.new(recipient_email=notification_data.to, subject=notification_data.subject,
                     content=notification_data.text, template_type="certificate",
                     extra_data=notification_data.extra_data,
                     full_data=str(notification_data.to_json()),
                     template_id=CALL_TO_ACTION_SENDGRID_TEMPLATE_ID,
                     categories=json.dumps([
                         "lms",
                         "certificate",
                         "issue",
                     ]
                     ))