{"id":19710494,"url":"https://github.com/rootstrap/django-drip-campaigns","last_synced_at":"2025-04-05T00:06:27.278Z","repository":{"id":37851816,"uuid":"263192462","full_name":"rootstrap/django-drip-campaigns","owner":"rootstrap","description":":droplet: Use Django admin to manage drip campaign emails using querysets on Django's User model.","archived":false,"fork":false,"pushed_at":"2025-01-13T17:34:03.000Z","size":1852,"stargazers_count":54,"open_issues_count":10,"forks_count":18,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-28T23:05:31.053Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rootstrap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS.md","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-12T00:38:41.000Z","updated_at":"2025-03-25T03:15:46.000Z","dependencies_parsed_at":"2024-11-11T22:07:38.689Z","dependency_job_id":"d656a8e4-b1c5-4da4-a3b3-256a0fd50945","html_url":"https://github.com/rootstrap/django-drip-campaigns","commit_stats":{"total_commits":340,"total_committers":31,"mean_commits":10.96774193548387,"dds":0.7617647058823529,"last_synced_commit":"bdd2d0d4f947bcda82683f3a9e5fee723b654b31"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootstrap%2Fdjango-drip-campaigns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootstrap%2Fdjango-drip-campaigns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootstrap%2Fdjango-drip-campaigns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rootstrap%2Fdjango-drip-campaigns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rootstrap","download_url":"https://codeload.github.com/rootstrap/django-drip-campaigns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247266563,"owners_count":20910836,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest"],"created_at":"2024-11-11T22:07:33.079Z","updated_at":"2025-04-05T00:06:27.257Z","avatar_url":"https://github.com/rootstrap.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Maintainability](https://api.codeclimate.com/v1/badges/5240f5a755d873846f8f/maintainability)](https://codeclimate.com/repos/5f0c9d52db4bad011400189e/maintainability)\n[![Test Coverage](https://api.codeclimate.com/v1/badges/5240f5a755d873846f8f/test_coverage)](https://codeclimate.com/repos/5f0c9d52db4bad011400189e/test_coverage)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n# Django Drip Campaigns\n\n![Build Status](https://github.com/rootstrap/django-drip-campaigns/actions/workflows/drip-django.yaml/badge.svg?branch=master)\n\nDrip campaigns are pre-written sets of emails sent to customers or prospects over time. Django Drips lets you use the admin to manage drip campaign emails using querysets on Django's User model.\n\nThis project is a fork of the one written by [Zapier](https://zapier.com/z/qO/).\n\n#### You can check out the docs [here](https://django-drip-campaigns.readthedocs.io/en/latest/).\n\n## Installation:\n\n1. Install django-drip-campaings using pip:\n\n```\npip install django-drip-campaigns\n```\n\n2. Add `'drip'` to your `INSTALLED_APPS` list on your settings.\n\n```python\nINSTALLED_APPS = [\n    'django.contrib.contenttypes',\n    'django.contrib.comments',\n    'django.contrib.sessions',\n    'django.contrib.sites',\n    'django.contrib.admin',\n\n    # ...\n\n    'drip',\n]\n```\n\n3. (Optional) Set `DRIP_FROM_EMAIL = '\u003cyour_app_from_email\u003e'` in your settings, where `\u003cyour_app_from_email\u003e` is the email account that is going to be shown in the sent emails. Otherwise `EMAIL_HOST_USER` value will be used.\n\n4. Finally, run `python manage.py migrate drip` to set up the necessary database tables.\n\n## Usage\n\nIf you haven't, create a superuser with the [Django createsuperuser command](https://docs.djangoproject.com/en/3.0/intro/tutorial02/#creating-an-admin-user). Login with the admin user, and select `Drips` to manage them. You will be able to:\n\n- View created drips.\n- Create a new drip.\n- Select and delete drips.\n\nNow you can also manage campaigns, select ``Campaigns`` to manage them. You will be able to:\n- View created campaigns.\n- Create a new campaign.\n- Select and delete campaign.\n\n### Create Campaign\n\nIn the Django admin, after select `Campaigns`, you can click on `ADD CAMPAIGN +` button to create a new one. You will see the `add campaign` page:\n\n![Add Campaign](https://raw.githubusercontent.com/rootstrap/django-drip-campaigns/master/docs/images/campaign_creation.png)\n\nWhen you create a campaign, you need to decide if the related drips will be deleted along with the campaign, using the `Delete drips` field.\n\nHere you will find an inline creation or edition for `Drips` this will not include the `QUERY SET RULES` section. It will only allow you to change the mail content in the Drip.\n\nCampaigns will allow you to manage many Drips that need to be related between them.\n\n### Create Drip\n\nIn the Django admin, after select `Drips`, you can click on `ADD DRIP +` button to create a new one. You will see the `add drip` page:\n\n![Add Drip](https://raw.githubusercontent.com/rootstrap/django-drip-campaigns/master/docs/images/add_drip_page.png)\n\nHere you can relate the Drip to the corresponding ``Campaign``. Grouping several drips under a campaign.\n\nOn the `FIELD NAME OF USER` input, when you click on it, you will be able to view:\n\n- The fields of your user's model.\n- The fields of your user's model in other models that are related with it.\n\nPlease take a look a this example:\n\n![Lookup fields](https://raw.githubusercontent.com/rootstrap/django-drip-campaigns/master/docs/images/users_lookup_fields.png)\n\nWith this, you can select one or more fields to create useful drips.\nAdditionally if you select a field name of user that has a date type, you can enter in the `FIELD VALUE` input, a date value written in natural language that combines operations on the current datetime.\nFor example, if you have selected the field `last_login` that has a date type, and you want to create a drip to send emails to the users who logged in exactly one week ago; you can enter:\n\n```\nnow-1 week\n```\n\nor\n\n```\nnow- 1 w\n```\n\nPossible operations and values:\n\n- Add (`+`) or subtract (`-`) dates.\n- On the left side of the operation, write the current datetime value: `now`.\n- On the right side of the operation:\n  - `seconds` or `s`.\n  - `minutes` or `m`.\n  - `hours` or `h`.\n  - `days` or `d`.\n  - `weeks` or `w`.\n  - If you enter the number `1`, you can write `second`, `minute`, etc.\n  - Don't enter a space between `now` and the operation symbol. Optionally you can add (or not) a space around the number value.\n\nLet's see some examples of the date values that you can enter:\n\n- `now-1 day`\n- `now+ 8days`\n- `now+ 1 h`\n- `now-4hours`\n- `now- 3 weeks`\n- `now-1 weeks`\n\n### View Timeline\n\nIn the Django admin, you can select a drip and then click on the `VIEW TIMELINE` button to view the mails expected to be sent with the corresponding receivers:\n\n![Timeline](https://raw.githubusercontent.com/rootstrap/django-drip-campaigns/master/docs/images/view_timeline.png)\n\n### Send drips\n\nTo send the created and enabled drips, run the command:\n\n```\npython manage.py send_drips\n```\n\nYou can use cron to schedule the drips.\n\n### The cron scheduler\n\nYou may want to have an easy way to send drips periodically. It's possible to set a couple of parameters in your settings to do that. First activate the scheduler by adding the `DRIP_SCHEDULE_SETTINGS` dictionary:\n\n```python\n# your settings file\nDRIP_SCHEDULE_SETTINGS = {\n   'DRIP_SCHEDULE': True,\n}\n\n```\n\nAfter that, choose:\n\n- A day of the week: An integer value between `0-6`, or a string: `'mon'`, `'tue'`, `'wed'`, `'thu'`, `'fri'`, `'sat'`, `'sun'`. The name in the settings is `DRIP_SCHEDULE_DAY_OF_WEEK` (default is set to `0`).\n- An hour: An integer value between `0-23`. The name in the settings is `DRIP_SCHEDULE_HOUR` (default is set to `0`).\n- A minute: An integer value between `0-59`. The name in the settings is `DRIP_SCHEDULE_MINUTE` (default is set to `0`).\n\nWith those values, a cron scheduler will execute the `send_drips` command every week in the specified day/hour/minute. The scheduler will use the timezone of your `TIME_ZONE` parameter in your settings (default is set to `'UTC'`). For example, if you have:\n\n```python\nDRIP_SCHEDULE_SETTINGS = {\n   'DRIP_SCHEDULE': True,\n   'DRIP_SCHEDULE_DAY_OF_WEEK': 'mon',\n   'DRIP_SCHEDULE_HOUR': 13,\n   'DRIP_SCHEDULE_MINUTE': 57,\n}\n```\n\nThen every Monday at 13:57 the `send_drips` command will be executed.\nLast but not least, add this line at the end of your main `urls.py` file to start the scheduler:\n\n```python\n# your main urls.py file\n...\nfrom drip.scheduler.cron_scheduler import cron_send_drips\n\n...\ncron_send_drips()\n```\n\nWe recommend you to do it there because we know for sure that it's a file that is executed once at the beginning.\n\nSome tips:\n\n- If you want to run the command every day in the week, hour, or minute, just set the corresponding parameter to `'*'`.\n- If you want to run the command more than a day in the week, just set the `DRIP_SCHEDULE_DAY_OF_WEEK` to more than one value. For example, if you set that to `'mon-fri'` the command will be executed from Monday to Friday.\n\n\n### Celery integration\nIMPORTANT: We use Celery 5.2.2 that supports Django 1.11 LTS or newer versions.\n\nIf you need to use celery it can be configured in the same way you just need to add the following key `SCHEDULER` setted as `\"CELERY\"`:\n```python\nDRIP_SCHEDULE_SETTINGS = {\n   'DRIP_SCHEDULE': True,\n   'DRIP_SCHEDULE_DAY_OF_WEEK': 'mon',\n   'DRIP_SCHEDULE_HOUR': 13,\n   'DRIP_SCHEDULE_MINUTE': 57,\n   'SCHEDULER': \"CELERY\",\n}\n```\nThe default value of this key is `\"CRON\"`, if you enable `DRIP_SCHEDULE` it will work with a Cron by default.\n\nIn order to make this happen, the project's `celery.py` setup shall invoke the\n[autodiscoverttasks](https://docs.celeryproject.org/en/latest/reference/celery.html#celery.Celery.autodiscover_tasks)\nfunction. This task is scheduled with a simple\n[Celery beat configuration](https://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html#entries).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootstrap%2Fdjango-drip-campaigns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frootstrap%2Fdjango-drip-campaigns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frootstrap%2Fdjango-drip-campaigns/lists"}