Project description

# django-crmifyA django app for quickly integrating a full-featured 3rd party CRM into an application

## PurposeTo begin, the purpose of crmify is **NOT** to be a full featured CRM. It's utility is as a bridge between a Django applicationand a 3rd party CRM. Some sample use cases below.

*Basic Lead Management*1. User comes to site and registers for account, this triggers a crmify event to create a lead in Insightly2. In Insightly, we have a pipeline set up to automatically email new leads3. When the user clicks a link in the email, it triggers a change in the status of the User in the backend.4. This status change is automatically synced by django-crmify to Insightly, which updates the Lead from a status of `NotContacted` to `Contacted`.

*Basic Sales Funnel*1. User comes to site and registers, triggers crmify to create a lead2. User makes a purchase, triggering a Conversion event which syncs to Insightly and updates the Lead from a status of `NotContacted` to `Converted`

## Installation```pip install django-crmify```

## Quick StartTo start using django-crmify, you need to setup some basic configuration parameters. While a number of the parameters will likely need tweaking, the most important settings to get started are: `BACKEND`, `LEAD_MODEL`, and `LEAD_MODEL_FIELDMAPPER`(each of these explained in more detail in the settings [section](#settings) below). Additionally, you will likely need to set the authentication parameters of the CRM backend via environment variables. Here is an example configuration for an integration with the Insightly CRM:`

After setting the `LEAD_MODEL`, it is necessary to run `makemigrations` and then `migrate` to finalize setup.

---

The next step is setting the value of the `LEAD_MODEL_FIELDMAPPER` to a dot-separated path of a `LeadModelFieldMapper` subclass, a simple class responsible for mapping fields from your Lead model onto the internal `crmify.models.Lead` model. For example, the default mapper looks as follows:

To break this down a bit, the `field_mapping` consists of our model's fields on the left and the internal crmify Lead models' fields on the right. The `fallbacks` field defines the mapping to use in the case that the primary `field_mapping` has no value for a specified Lead field.

```def sync_lead(self, lead): """ sync the given lead to the CRM :param lead: `Lead` object to sync to the CRM :return: `str` the ID of the lead in the CRM """ pass

def delete_lead(self, lead_id): """ delete the lead with the given ID from the CRM :param lead_id: `str` the ID of the lead in the external CRM :return: `bool` True if the lead was deleted, False otherwise """ pass```

After creating this class, you need only point the `BACKEND` setting to the dot separated path to your CRM backend.