Python library for Agile CRM based on the rest-api documentation.
We use this in production for Screenly, and it works fine. Still a bit rough around the corners, but it does indeed work.
Clone the repo as a sub-module inside your project.
Install the Python requirements.
$ pip install -r /path/to/module/requirements.txt
This script depends on the variables provided in settings.py
. These can be overridden in site_settings.py
.
First, you need to import the module. This may vary depending on your paths etc, but something like:
import agilecrm
Simply create a new user. Despite what is claimed in the documentation, all variables appear to be optional.
agilecrm.create_contact(
first_name='John',
last_name='Doe',
email='[email protected]',
tags=['signed_up'],
company='Foobar Inc')
You can also use custom fields (must be created in Agile CRM first):
agilecrm.create_contact(
first_name='John',
custom = {
'SomeField': 'Foobar'
}
Update a user object.
agilecrm.update_contact(
first_name='Steve',
last_name='Smith',
email='[email protected]',
tags=['name_updated'],
company='Foobar2 Inc')
This will get the user by email and return the user object as JSON.
agilecrm.get_contact_by_email('[email protected]')
This will get the user by UUID and return the user object as JSON.
agilecrm.get_contact_by_uuid(1234)
This will add the tag 'awesome_user' to the user '[email protected]'. Both variables are required.
agilecrm.add_tag('[email protected]', 'awesome_user')