How to use the intake.notifications function in intake

To help you get started, we’ve selected a few intake examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codeforamerica / intake / intake / services / transfers_service.py View on Github external
def send_application_transfer_notification(transfer_data):
    contact_info = transfer_data['form_submission'].get_usable_contact_info()
    if contact_info:
        intro, body = render_application_transfer_message(**transfer_data)
        base_message = "\n\n".join([intro, body])
        sent_message = "\n\n".join(
            [intro, transfer_data.get('sent_message', body)])
        notifications.send_applicant_notification(
            contact_info, sent_message, subject="Update from Clear My Record",
            sender_profile=transfer_data['author'].profile)
        return models.StatusNotification(
            contact_info=contact_info,
            base_message=base_message,
            sent_message=sent_message)
    return None
github codeforamerica / intake / intake / views.py View on Github external
def mark_viewed(self, request, submission):
        models.ApplicationLogEntry.log_opened([submission.id], request.user)
        notifications.slack_submissions_viewed.send(
            submissions=[submission], user=request.user,
            bundle_url=submission.get_external_url())
github codeforamerica / intake / intake / views / admin_views.py View on Github external
def get(self, request, submission_id):
        submission = get_object_or_404(
            models.FormSubmission, pk=int(submission_id))
        if not request.user.profile.should_have_access_to(submission):
            return self.not_allowed()
        pdf = submission.filled_pdfs.first()
        if not pdf:
            no_pdf_str = \
                "No prefilled pdf was made for submission: %s" % submission.pk
            notifications.slack_simple.send(no_pdf_str)
            fillables = models.FillablePDF.objects
            if not request.user.is_staff:
                org = request.user.profile.organization
                fillables = fillables.filter(
                    organization=org)
            fillable_pdf = fillables.first()
            pdf = fillable_pdf.fill_for_submission(submission)
        apps = AppsService.filter_to_org_if_not_staff(
            submission.applications.all(), request.user)
        AppsService.handle_apps_opened(self, apps)
        response = HttpResponse(pdf.pdf, content_type='application/pdf')
        return response
github codeforamerica / intake / intake / services / status_notifications.py View on Github external
next_steps=list(status_update.next_steps.all()))
    default_message = '\n\n'.join([
        notification_intro,
        get_base_message_from_status_update_data(request, status_update_data)
    ])
    edited_message = '\n\n'.join([
        notification_intro,
        notification_data['sent_message']])
    notification_data.update(
        base_message=default_message,
        sent_message=edited_message,
        status_update=status_update,
        contact_info=contact_info)
    status_notification = models.StatusNotification(**notification_data)
    status_notification.save()
    notifications.send_applicant_notification(
        contact_info, edited_message,
        subject="Update from Clear My Record",
        sender_profile=author_profile)
github codeforamerica / intake / intake / views.py View on Github external
def notify(self):
        notifications.slack_submissions_processed.send(
            **self.get_notification_context())
github codeforamerica / intake / intake / service_objects / applicant_notifications.py View on Github external
def get_notification_channel(self, method):
        if method == EMAIL:
            return notifications.email_followup
        elif method == SMS:
            return notifications.sms_followup
github codeforamerica / intake / intake / service_objects / applicant_notifications.py View on Github external
def get_notification_channel(self, method):
        if method == EMAIL:
            return notifications.email_followup
        elif method == SMS:
            return notifications.sms_followup
github codeforamerica / intake / intake / views.py View on Github external
def send_notifications(self, submission):
        number = models.FormSubmission.objects.count()
        # TODO: say which orgs this is going to in notification
        notifications.slack_new_submission.send(
            submission=submission, request=self.request,
            submission_count=number)
        self.create_confirmations_for_user(submission)
github codeforamerica / intake / intake / service_objects / applicant_notifications.py View on Github external
def get_notification_channel(self, method):
        if method == EMAIL:
            return notifications.email_confirmation
        elif method == SMS:
            return notifications.sms_confirmation
github codeforamerica / intake / intake / service_objects / applicant_notifications.py View on Github external
def get_notification_channel(self, method):
        if method == EMAIL:
            return notifications.email_confirmation
        elif method == SMS:
            return notifications.sms_confirmation