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, or you can manually refresh it from the Wagtail admin menu ("Refresh DripDrop Cache").

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.0.tar.gz (14.6 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.0-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: wagtail_dripdrop-0.2.0.tar.gz
  • Upload date:
  • Size: 14.6 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.0.tar.gz
Algorithm Hash digest
SHA256 a95d4d133455fc6816241993c61eb8b907894311a684f0e243ebf8a19f453080
MD5 405cbfafe21f7766ce9ae97b598890d9
BLAKE2b-256 18ade531ac7c9c98b5797475379c3feb7f4d87de3425a1e3b6386e42c7eb854d

See more details on using hashes here.

Provenance

The following attestation bundles were made for wagtail_dripdrop-0.2.0.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.0-py3-none-any.whl.

File metadata

File hashes

Hashes for wagtail_dripdrop-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db51eaeccd0dc18e7d25887d398be9076370085743d8bcb7f0b69f4c0523f641
MD5 4de647c0c71ff45f43d9a23b0870ce73
BLAKE2b-256 ec2250818dd80da095a78848e1bd44864e2be4aae63388c97db619d3a66dd049

See more details on using hashes here.

Provenance

The following attestation bundles were made for wagtail_dripdrop-0.2.0-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