{ "info": { "author": "Miguel Ferrer", "author_email": "ingferrermiguel@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# activecampaign-python\nActiveCampaign API wrapper written in python.\n\nThis library supports the latest API version 3. If you are looking for API version 1 which is also supported by ActiveCampaign then check below.\n\n## Installing (API v3)\n\n```\npip install activecampaign-python\n```\n\n## Requirements\n\n```\n- requests\n```\n\n## Usage\n\n#### Client instantiation\n```\nfrom activecampaign.client import Client\nclient = Client(URL, API_KEY)\n```\n\n### Automations\n#### List all automations\n```\nresponse = client.automations.list_all_automations()\n```\n\n### Contacts\n#### Create a contact\n```\ndata = {\n\t\"contact\": {\n\t\t\"email\": \"johndoe@example.com\",\n\t\t\"firstName\": \"John\",\n\t\t\"lastName\": \"Doe\",\n\t\t\"phone\": \"7223224241\"\n\t}\n}\nresponse = client.contacts.create_a_contact(data)\n```\n\n#### Create or update contact\n```\ndata = {\n\t\"contact\": {\n\t\t\"email\": \"johndoe@example.com\",\n\t\t\"firstName\": \"John\",\n\t\t\"lastName\": \"Doe\",\n\t\t\"phone\": \"7223224241\"\n\t}\n}\nresponse = client.contacts.create_or_update_contact(data)\n```\n\n#### Retrieve a contact\n```\nresponse = client.contacts.retrieve_a_contact(\"contact_id\")\n```\n\n#### Update list status for a contact\n```\ndata = {\n \"contactList\": {\n \"list\": 2,\n \"contact\": 1,\n \"status\": 1\n }\n}\nresponse = client.contacts.update_list_status_for_a_contact(data)\n```\n\n#### Update a contact\n```\ndata = {\n\t\"contact\": {\n\t\t\"email\": \"johndoe@example.com\",\n\t\t\"firstName\": \"John\",\n\t\t\"lastName\": \"Doe\"\n\t}\n}\nresponse = client.contacts.update_a_contact(\"contact_id\", data)\n```\n\n#### Delete a contact\n```\nresponse = client.contacts.delete_a_contact(\"contact_id\")\n```\n\n#### List all contacts\n```\nresponse = client.contacts.list_all_contacts()\n\nAdditionally, you can filter a contact:\nresponse = client.contacts.list_all_contacts(email=\"johndoe@example.com\")\n\nFor more query params: https://developers.activecampaign.com/reference#list-all-contacts\n```\n\n#### List all automations the contact is in\n```\nresponse = client.contacts.list_all_automations_the_contacts_is_in(\"contact_id\")\n```\n\n#### Retrieve a contacts score value\n```\nresponse = client.contacts.retrieve_a_contacts_score_value(\"contact_id\")\n```\n\n#### Add a contact to an automation\n```\ndata = {\n \"contactAutomation\": {\n \"contact\": 1,\n \"automation\": 1\n }\n}\nresponse = client.contacts.add_a_contact_to_an_automation(data)\n```\n\n#### Retrieve an automation a contact is in\n```\nresponse = client.contacts.retrieve_an_automation_a_contact_is_in(\"contact_automation_id\")\n```\n\n#### Remove a contact from an automation\n```\nresponse = client.contacts.remove_a_contact_from_an_automation(\"contact_automation_id\")\n```\n\n#### List all automations a contact is in\n```\nresponse = client.contacts.list_all_automations_a_contact_is_in()\n```\n\n#### Create a custom field\n```\ndata = {\n\t\"field\": {\n\t\t\"type\": \"textarea\",\n\t\t\"title\": \"Field Title\",\n\t\t\"descript\": \"Field description\",\n\t\t\"isrequired\": 1,\n\t\t\"perstag\": \"Personalized Tag\",\n\t\t\"defval\": \"Defaut Value\",\n\t\t\"visible\": 1,\n\t\t\"ordernum\": 1\n }\n}\nresponse = client.contacts.create_a_custom_field(data)\n```\n\n#### Retrieve a custom field\n```\nresponse = client.contacts.retrieve_a_custom_field(\"field_id\")\n```\n\n#### Update a custom field\n```\ndata = {\n\t\"field\": {\n\t\t\"type\": \"textarea\",\n\t\t\"title\": \"Field Title\",\n\t\t\"descript\": \"Field description\",\n\t\t\"isrequired\": 1,\n\t\t\"perstag\": \"Personalized Tag\",\n\t\t\"defval\": \"Defaut Value\",\n\t\t\"visible\": 1,\n\t\t\"ordernum\": 1\n }\n}\nresponse = client.contacts.create_a_custom_field(\"field_id\", data)\n```\n\n#### Delete a custom field\n```\nresponse = client.contacts.delete_a_custom_field(\"field_id\")\n```\n\n#### List all custom fields\n```\nresponse = client.contacts.list_all_custom_fields()\n```\n\n#### Create a custom field relationship to list(s)\n```\ndata = {\n\t\"fieldRel\": {\n\t\t\"field\": 8,\n\t\t\"relid\": 2\n\t}\n}\nresponse = client.contacts.create_a_custom_field_relationship_to_list(data)\n```\n\n#### Create custom field options\n```\ndata = {\n \"field\": 1,\n \"label\": \"my custom label\",\n \"value\": 1,\n \"orderid\": 1,\n \"isdefault\": True\n}\nresponse = client.contacts.create_custom_field_options(data)\n```\n\n#### Retrieve field options\n```\nresponse = client.contacts.retrieve_field_options(\"field_id\")\n```\n\n### Deals\n#### Create a deal\n```\ndata = {\n \"deal\": {\n \"contact\": \"51\",\n \"description\": \"This deal is an important deal\",\n \"currency\": \"usd\",\n \"group\": \"1\",\n \"owner\": \"1\",\n \"percent\": None,\n \"stage\": \"1\",\n \"status\": 0,\n \"title\": \"AC Deal\",\n \"value\": 45600\n }\n}\nresponse = client.deals.create_a_deal(data)\n```\n\n#### Retrieve a deal\n```\nresponse = client.deals.retrieve_a_deal(\"deal_id\")\n```\n\n#### Update a deal\n```\ndata = {\n \"deal\": {\n \"contact\": \"51\",\n \"description\": \"This deal is an important deal\",\n \"currency\": \"usd\",\n \"group\": \"1\",\n \"owner\": \"1\",\n \"percent\": None,\n \"stage\": \"1\",\n \"status\": 0,\n \"title\": \"AC Deal\",\n \"value\": 45600\n }\n}\nresponse = client.deals.update_a_deal(data)\n```\n\n#### Delete a deal\n```\nresponse = client.deals.delete_a_deal(\"deal_id\")\n```\n\n#### List all deals\n```\nresponse = client.deals.list_all_deals()\n\nAdditionally, you can filter a deal:\nquery = {\n \"filters[stage]\": 1\n}\nresponse = client.deals.list_all_deals(**query)\n\nFor more query params: https://developers.activecampaign.com/reference#list-all-deals\n```\n\n#### Create a deal note\n```\ndata = {\n \"note\": {\n \"note\": \"Note for the deal\"\n }\n}\nresponse = client.deals.create_a_deal_note(\"deal_id\", data)\n```\n\n#### Update a deal note\n```\ndata = {\n \"note\": {\n \"note\": \"Update with more info\"\n }\n}\nresponse = client.deals.update_a_deal_note(\"deal_id\", \"note_id\", data)\n```\n\n#### List all pipelines\n```\nresponse = client.deals.list_all_pipelines()\n\nAdditionally, you can filter a pipeline:\nquery = {\n \"filters[title]\": \"My pipeline\"\n}\nresponse = client.deals.list_all_pipelines(**query)\n\nFor more query params: https://developers.activecampaign.com/reference#list-all-pipelines\n```\n\n#### List all stages\n```\nresponse = client.deals.list_all_stages()\n\nAdditionally, you can filter a stage:\nquery = {\n \"filters[d_groupid]\": 1\n}\nresponse = client.deals.list_all_stages(**query)\n\nFor more query params: https://developers.activecampaign.com/reference#list-all-deal-stages\n```\n\n### Lists\n#### Create a list\n```\ndata = {\n\t\"list\": {\n\t\t\"name\": \"Name of List\",\n\t\t\"stringid\": \"Name-of-list\",\n\t\t\"sender_url\": \"http://activecampaign.com\",\n\t\t\"sender_reminder\": \"You are receiving this email as you subscribed to a newsletter when making an order on our site.\",\n\t\t\"send_last_broadcast\": 0,\n\t\t\"carboncopy\": \"\",\n\t\t\"subscription_notify\": \"\",\n\t\t\"unsubscription_notify\": \"\",\n\t\t\"user\": 1\n\t}\n}\nresponse = client.lists.create_a_list(data)\n```\n\n#### Retrieve a list\n```\nresponse = client.lists.retrieve_a_list(\"list_id\")\n```\n\n#### Delete a list\n```\nresponse = client.lists.delete_a_list(\"list_id\")\n```\n\n#### Retrieve all lists\n```\nresponse = client.lists.retrieve_all_lists()\n```\n\n#### Create a list group permission\n```\ndata = {\n\t\"listGroup\": {\n\t\t\"listid\": 19,\n\t\t\"groupid\": 1\n\t}\n}\nresponse = client.lists.create_a_list_group_permission(data)\n```\n\n### Notes\n#### Create a note\n```\ndata = {\n\t\"note\": {\n\t\t\"note\": \"This is the text of the note\",\n\t\t\"relid\": 2,\n\t\t\"reltype\": \"Subscriber\"\n\t}\n}\nresponse = client.notes.create_a_note(data)\n```\n\n#### Retrieve a note\n```\nresponse = client.notes.retrieve_a_note(\"note_id\")\n```\n\n#### Update a note\n```\ndata = {\n\t\"note\": {\n\t\t\"note\": \"This is the text of the note\",\n\t\t\"relid\": 2,\n\t\t\"reltype\": \"Subscriber\"\n\t}\n}\nresponse = client.notes.update_a_note(\"note_id\", data)\n```\n\n#### Delete a note\n```\nresponse = client.notes.delete_a_note(\"note_id\")\n```\n\n### Tasks\n#### Create a task\n```\ndata = {\n \"dealTask\": {\n \"title\":null,\n \"ownerType\":\"contact\",\n \"relid\":\"7\",\n \"status\":0,\n \"note\":\"Testing Task\",\n \"duedate\":\"2017-02-25T12:00:00-06:00\",\n \"edate\":\"2017-02-25T12:15:00-06:00\",\n \"dealTasktype\":\"1\"\n }\n}\nresponse = client.tasks.create_a_task(data)\n```\n\n#### Retrieve a task\n```\nresponse = client.tasks.retrieve_a_task(\"task_id\")\n```\n\n#### Update a task\n```\ndata = {\n \"dealTask\": {\n \"title\":null,\n \"ownerType\":\"contact\",\n \"relid\":\"7\",\n \"status\":0,\n \"note\":\"Testing Task\",\n \"duedate\":\"2017-02-25T12:00:00-06:00\",\n \"edate\":\"2017-02-25T12:15:00-06:00\",\n \"dealTasktype\":\"1\"\n }\n}\nresponse = client.tasks.update_a_task(\"task_id\", data)\n```\n\n#### Delete a task\n```\nresponse = client.tasks.delete_a_task(\"task_id\")\n```\n\n#### List all tasks\n```\nresponse = client.tasks.list_all_tasks()\n\nAdditionally, you can filter a task:\nquery = {\n \"filters[title]\": \"My task\"\n}\nresponse = client.deals.list_all_tasks(**query)\n\nFor more query params: https://developers.activecampaign.com/reference#list-all-tasks\n```\n\n### Users\n#### Create a user\n```\nresponse = client.users.create_a_user(data)\n```\n\n#### Retrieve a user\n```\nresponse = client.users.retrieve_a_user(\"user_id\")\n```\n\n#### Retrieve a user by email\n```\nresponse = client.users.retrieve_a_user_by_email(\"email\")\n```\n\n#### Retrieve a user by username\n```\nresponse = client.users.retrieve_a_user_by_username(\"username\")\n```\n\n#### Retrieve logged-in user\n```\nresponse = client.users.retrieve_logged_in_user()\n```\n\n#### Update a user\n```\nresponse = client.users.update_a_user(\"user_id\", data)\n```\n\n#### Delete a user\n```\nresponse = client.users.delete_a_user(\"user_id\")\n```\n\n#### List all users\n```\nresponse = client.users.list_all_users()\n```\n\n### Webhooks\n#### Create a webhook\n```\ndata = {\n \"webhook\": {\n \"name\": \"My Hook\",\n \"url\": \"http://example.com/my-hook\",\n \"events\": [\n \"subscribe\",\n \"unsubscribe\",\n \"sent\"\n ],\n \"sources\": [\n \"public\",\n \"system\"\n ]\n }\n}\nresponse = client.webhooks.create_a_webhook(data)\n```\n\n#### Retrieve a webhook\n```\nresponse = client.webhooks.retrieve_a_webhook(\"webhook_id\")\n```\n\n#### Delete a webhook\n```\nresponse = client.webhooks.delete_a_webhook(\"webhook_id\")\n```\n\n#### List all webhooks\n```\nresponse = client.webhooks.list_all_webhooks()\n\nAdditionally, you can filter a webhook:\nquery = {\n \"filters[name]\": \"My webhook\"\n}\nresponse = client.deals.list_all_webhooks(**query)\n\nFor more query params: https://developers.activecampaign.com/reference#get-a-list-of-webhooks\n```\n\n#### List all webhook events\n```\nresponse = client.webhooks.list_all_webhook_events()\n```\n\n## About API v1\n\nYou can clone and checkout our tag v0.1.1.\n\n```\n$ git clone https://github.com/GearPlug/activecampaign-python.git\n$ git checkout tags/v0.1.1 -b \n```\n\nAlso you can install this version in pip\n```\n$ pip install activecampaign-python=0.1.1\n```", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/GearPlug/activecampaign-python", "keywords": "activecampaign", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "activecampaign-python", "package_url": "https://pypi.org/project/activecampaign-python/", "platform": "", "project_url": "https://pypi.org/project/activecampaign-python/", "project_urls": { "Homepage": "https://github.com/GearPlug/activecampaign-python" }, "release_url": "https://pypi.org/project/activecampaign-python/1.0.0/", "requires_dist": null, "requires_python": "", "summary": "ActiveCampaign API written in python", "version": "1.0.0" }, "last_serial": 5640782, "releases": { "0.1.1": [ { "comment_text": "", "digests": { "md5": "5fc454dd68aca1ba99d205681fd8c5ca", "sha256": "2d99050a5e8da0512974b5365497b80743832d92f3559173adbd1785069c0926" }, "downloads": -1, "filename": "activecampaign-python-0.1.1.tar.gz", "has_sig": false, "md5_digest": "5fc454dd68aca1ba99d205681fd8c5ca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5591, "upload_time": "2018-09-20T17:33:19", "url": "https://files.pythonhosted.org/packages/61/5c/16973685325e664f509763c377effaab61a1cd5b174851dd1e875fb6794d/activecampaign-python-0.1.1.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "9e092ea1f18b3cb073c7cc6a52dbd08a", "sha256": "56136403fa37f63b3ed38c3724a5965b4fe0b27c0b6dcdfa07441a9f73a8e7da" }, "downloads": -1, "filename": "activecampaign-python-1.0.0.tar.gz", "has_sig": false, "md5_digest": "9e092ea1f18b3cb073c7cc6a52dbd08a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7393, "upload_time": "2019-08-06T16:56:30", "url": "https://files.pythonhosted.org/packages/d7/0d/d0c08f8b991b72854cbf28ad2acb875d76299b67f2ba2fd70fba30be00d0/activecampaign-python-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "9e092ea1f18b3cb073c7cc6a52dbd08a", "sha256": "56136403fa37f63b3ed38c3724a5965b4fe0b27c0b6dcdfa07441a9f73a8e7da" }, "downloads": -1, "filename": "activecampaign-python-1.0.0.tar.gz", "has_sig": false, "md5_digest": "9e092ea1f18b3cb073c7cc6a52dbd08a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7393, "upload_time": "2019-08-06T16:56:30", "url": "https://files.pythonhosted.org/packages/d7/0d/d0c08f8b991b72854cbf28ad2acb875d76299b67f2ba2fd70fba30be00d0/activecampaign-python-1.0.0.tar.gz" } ] }