Using the Django Package

The django-notifiedby package provides a Python interface for the NotifiedBy API, including full support for email flows, recipients, and flags. This page covers how to set up the package and use it to manage email flows from your Django application.

Overview

The django-notifiedby package offers:

  • Email Backend: Drop-in replacement for Django’s email backend

  • Flow Management: Subscribe users to automated email sequences

  • Recipient Management: Create and manage recipients with metadata and flags

  • Email Querying: Check delivery status and query email history

  • Error Handling: Comprehensive exception handling for all operations

  • Custom Clients: Support for multi-tenant applications and testing

Quick Start

  1. Install the package

  2. Configure your Django settings with an API key

  3. Start sending emails or managing flows

# Install
pip install django-notifiedby

# Configure settings.py
EMAIL_BACKEND = "notifiedby.NotifiedByEmailBackend"
NOTIFIEDBY_API_KEY = "your-api-key-here"

# Send an email
from django.core.mail import send_mail
send_mail('Subject', 'Message', 'from@example.com', ['to@example.com'])

# Subscribe to a flow
from notifiedby import subscribe_to_flow
subscribe_to_flow('welcome', 'user@example.com')

For detailed instructions and examples, see the sections below.