InfusionSoft API wrapper for Infusionsoft written in Python.
git+git://github.com/GearPlug/infusionsoft-python.git
from infusionsoft.client import Client
client = Client('CLIENT_ID', 'CLIENT_SECRET', 'OPTIONAL - access_token')
url = client.oauth_access("REDIRECT_URL")
token = client.exchange_code('REDIRECT_URL', 'CODE')
token = client.refresh_token('REFRESH TOKEN')
token = client.set_token('TOKEN')
here you list the contacts, can receive limit, order, order_direction and offset. for filter specific camps use this sintaxis: get_contacts(field="name", order_direction="descending")
list_contacts = client.get_contacts(order="id", order_direction="descending")
here you can retrieve a contact, send the ID and the optional_properties values
retrieve_contact = client.retrieve_contact(166, optional_properties="custom_fields,preferred_name,opt_in_reason,notes")
here you create a contact, you must to give a valid email or a phone number and that is send as a kwarg data = {'email_addresses': [{'email': '[email protected]', 'field': 'EMAIL1'}], 'given_name': 'NAME'}
create_contact = client.create_contact(**data)
here you delete a contact, is obligatory the id of the contact
delete_contact = client.delete_contact('ID')
data = {'email_addresses': [{'email': '[email protected]', 'field': 'EMAIL1'}], 'given_name': 'NAME'}
update_contact = client.update_contact('184', **data)
here you list the campaigns, can receive limit and offset
list_campaigns = client.get_campaigns()
here you can retrieve a specific campaign, obligatory the id of the campaign
retrieve_campaign = client.retrieve_campaign('ID')
here you can get all, can receive limit or offset
list_emails = client.get_emails()
here you can list the opportunities, can receive limit, order, and offset
list_opportunities = client.get_opportunities()
here you can list the pipeline opportunities
list_all_opportunities = client.get_opportunities_pipeline()
here you can retrieve a specific opportunity, obligatory send the id
retrieve_opportunity = client.retrieve_opportunity('ID')
here you can create an opportunity, obligatory opportunity_title, contact, and stage data = { 'contact': { 'id': '170' }, 'stage': { 'name': 'Stage Test', 'id': 10, 'details': { 'check_list_items': [ {'description': 'Test Opportunity'} ] } }, 'opportunity_title': 'OpportunityTitle' }
create_opportunity = client.create_opportunity(**data)
here you can update an opportunity, obligatory send the id of the opportunity and the data to update data = { 'contact': { 'id': '170' }, 'stage': { 'name': 'Stage Test', 'id': 10, 'details': { 'check_list_items': [ {'description': 'Test Opportunity'} ] } }, 'opportunity_title': 'OpportunityTitle' }
update_opportunity = client.update_opportunity('ID', **data)
here you can list the products
get_products = client.get_products()
here you can retrieve a specific product, just send the id of the product
retrieve_product = client.retrieve_product('ID')
here you can list the tasks, can receive limit, offset
get_tasks = client.get_tasks()
here you can list the tasks, can receive limit, offset data = {'title': 'TASK TITLE', "contact": {"id": 170}}
create_task = client.create_task(**data)
here you can delete a tasks, obligatory send the id of the task
delete_task = client.delete_task('ID')
here you can update a tasks, obligatory send the id of the task to update and the data data = {'title': 'TASK TITLE', "contact": {"id": 170}}
update_task = client.update_task('ID', **data)
here you can retrieve a tasks, obligatory send the id of the task
retrieve_task = client.retrieve_task('ID')
here you can replace a task, obligatory send the id of the task
replace_task = client.replace_task('ID')
here you can get orders, can receive limit, offset
get_orders = client.get_orders()
here you can retrieve an order, obligatory send the id of the order
retrieve_order = client.retrieve_order('ID')
here you can list the hooks events, just call the method
get_hook_events = client.get_hook_events()
here you can get all the hook subscriptions, just call the method
get_hook_subscriptions = client.get_hook_subscriptions()
here you can verify a hook subscription, send the id of the webhook to verify it
verify_hook = client.verify_hook_subscription('ID')
here you can create a hook subscription, send the hook event and the url callback
create_hook = client.create_hook_subscription("opportunity.add", "URL")
here you can update a hook, send the hook id, event and url
update_hook = petition.update_hook_subscription('ID', 'opportunity.delete', 'URL')
here you can delete a hook subscription, is obligatory to send the hook id
delete_hook = petition.delete_hook_subscription('ID')
- requests
infusionsoft/test.py
- All Appointments Section
- All File Section
- All Tag Section