Skip to main content

Connect Wagtail form pages to DripDrop flows.

Project description

wagtail-dripdrop

Connect Wagtail form pages to DripDrop flows. When a form is submitted, wagtail-dripdrop creates or enrolls a contact in the selected flow using the DripDrop public API.

Installation

pip install wagtail-dripdrop

Add to your Django settings:

INSTALLED_APPS = [
    # ...
    "wagtail_dripdrop",
    # ...
]

Configure your DripDrop API key:

DRIPDROP_API_KEY = "your-api-key"

Usage

Create a form page that enrolls submissions into a DripDrop flow:

from wagtail.contrib.forms.models import AbstractForm, AbstractFormField
from modelcluster.fields import ParentalKey

from wagtail_dripdrop import (
    DripDropFieldMappingPanels,
    DripDropFormFieldMixin,
    DripDropFormMixin,
    FlowChooserPanel,
)


class FormField(DripDropFormFieldMixin, AbstractFormField):
    page = ParentalKey("ContactPage", related_name="form_fields", on_delete=models.CASCADE)
    panels = AbstractFormField.panels + DripDropFieldMappingPanels()


class ContactPage(DripDropFormMixin, AbstractForm):
    content_panels = AbstractForm.content_panels + [FlowChooserPanel()]

Field mapping

Each form field can be mapped to a DripDrop contact property via the DripDrop mapping dropdown in the Wagtail admin. The available contact mappings (First Name, Last Name, Email, Phone) are derived from the DripDrop SDK.

Selecting Custom Field maps the form field to a DripDrop custom field. A second dropdown appears to select the custom field key. Custom field keys are validated against the DripDrop API on save — if a key does not exist, a validation error is raised.

When a flow is selected, the form requires:

  • At least one field mapped to First Name
  • At least one field mapped to Email or Phone

On submission, the contact is created and enrolled in the selected flow. If the contact already exists (409 response), they are automatically enrolled via the enrollments endpoint.

Cache

Flow and custom field choices are cached using Django's cache framework. The cache refreshes automatically on a miss. You can inspect the cached flows and custom fields, or refresh both caches manually, from Settings → DripDrop cache in the Wagtail admin.

Settings

Setting Required Default Description
DRIPDROP_API_KEY Yes Your DripDrop API key
DRIPDROP_API_BASE_URL No https://api.dripdrop.dev Base URL for the DripDrop API
DRIPDROP_FLOW_CACHE_TIMEOUT No 3600 Flow list cache timeout in seconds
DRIPDROP_CUSTOM_FIELD_CACHE_TIMEOUT No 3600 Custom field list cache timeout in seconds

Development

git clone https://github.com/layline-dev/wagtail-dripdrop.git
cd wagtail-dripdrop
pip install -e .[dev]
ruff check .
pytest

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wagtail_dripdrop-0.2.1.tar.gz (16.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

wagtail_dripdrop-0.2.1-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file wagtail_dripdrop-0.2.1.tar.gz.

File metadata

  • Download URL: wagtail_dripdrop-0.2.1.tar.gz
  • Upload date:
  • Size: 16.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for wagtail_dripdrop-0.2.1.tar.gz
Algorithm Hash digest
SHA256 cea8d179f1981ad765662be9c8f5f209d9a5b7262a4ea651d166c801d8b4a7e1
MD5 96d5a182cd9b94d7a95cf14ca7307fae
BLAKE2b-256 59e5471e0cd1956ad32467187d2ef9b203e74a978ce163649031a652159f6c6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for wagtail_dripdrop-0.2.1.tar.gz:

Publisher: publish.yml on layline-dev/wagtail-dripdrop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file wagtail_dripdrop-0.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_dripdrop-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e11159c815245739d0b3e6149c471d71134fc3a7bec910e230cd92d60f75b158
MD5 9bcba2311a4000b5e59ee6f04d371aca
BLAKE2b-256 2d92832f11f20641d1031fbf68c49cda280a86e8cbc88d99ac7e1db3d0ced286

See more details on using hashes here.

Provenance

The following attestation bundles were made for wagtail_dripdrop-0.2.1-py3-none-any.whl:

Publisher: publish.yml on layline-dev/wagtail-dripdrop

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page