This app contains a list of resources classes that ease the interaction with Active Campaign API.
- django
- pytest
- requests
from active_campaign_api import Contact, ContactList, ContactTag, Tag, MarketingList
contact = Contact(email)
try:
contact.save()
except Exception:
pass
contact = Contact.find(email)
try:
Tag.find("Tag name")
except Exception:
# pass
tag = Tag('Tag name', 'contact', "Short description of the tag")
tag.save()
marketing_list = MarketingList.find('SD: Marketing List')
ContactTag(tag.id, contact.id).save()
ContactTag.all_in_contact(contact.id)
status = 1 # 1 to subscribe, 2 to unsubscribe
ContactList(marketing_list.id, contact.id, status).save()
The plugin looks for the MARKETING_CAMPAIGN_KEY in django settings. It raises a RuntimeError if it's not correctly defined