Example #1
0
 def leftronic(self):
     return Leftronic(settings.LEFTRONIC_ACCESS_KEY)
Example #2
0
## Put together by @nickpersico, Sales Ops at Krossover.com
## Closetronic - Close.io to Leftronic Python Script Example - Going through a list of leads via search query

import requests
import json
from leftronic import Leftronic
import datetime

#Your Close.io & Leftronic API Credentials
closeio_key = 'YOUR_API_KEY'
update = Leftronic("YOUR_LEFTRONIC_ACCESS_KEY")

#Use the datetime library to retrieve the current day's report
today = datetime.date.today()
tomorrow = datetime.date.today() + datetime.timedelta(days=1)

#Sample URL for all new "active" opportunities created today
url = 'https://app.close.io/api/v1/lead/?query=opportunity_status%3Aactive%20opportunity_created%3Atoday%20'
response = requests.get(url,
                        auth=(closeio_key, ''),
                        headers={'Content-Type': 'application/json'})

#Loop to go through the list of opportunities to retrieve all values, and then add them up
opportunities = []
for lead in response.json['data']:
    opportunities.extend(lead['opportunities'])

total_value = 0

for opportunity in opportunities:
    if opportunity['value']:
## Put together by @nickpersico, Sales Ops at Krossover.com
## Closetronic - Close.io to Leftronic Python Script Example - Going through a list of leads via search query

import requests
import json
from leftronic import Leftronic
import datetime

#Your Close.io & Leftronic API Credentials
closeio_key = 'YOUR_API_KEY'
update = Leftronic("YOUR_LEFTRONIC_ACCESS_KEY")

#Use the datetime library to retrieve the current day's report
today = datetime.date.today()
tomorrow = datetime.date.today() + datetime.timedelta(days=1)

#Sample URL for all new "active" opportunities created today
url = 'https://app.close.io/api/v1/lead/?query=opportunity_status%3Aactive%20opportunity_created%3Atoday%20'
response = requests.get(url, auth=(closeio_key, ''), headers={'Content-Type': 'application/json'})

#Loop to go through the list of opportunities to retrieve all values, and then add them up
opportunities = []
for lead in response.json['data']:
    opportunities.extend(lead['opportunities'])

total_value = 0

for opportunity in opportunities:
    if opportunity['value']:
        total_value += opportunity['value']
    if opportunity['value'] is None :
Example #4
0
## Put together by @nickpersico, Sales Ops at Krossover.com
## Closetronic - Close.io to Leftronic Python Script Examples

import requests
import json
from leftronic import Leftronic
import datetime

#Your Close.io & Leftronic API Credentials
closeio_key = 'YOUR_API_KEY'
update = Leftronic("YOUR_LEFTRONIC_ACCESS_KEY")

#Use the datetime library to retrieve the current day's report
today = datetime.date.today()
tomorrow = datetime.date.today() + datetime.timedelta(days=1)

## SAMPLE CLOSE.IO REPORTING URLS ##

#Today's activity report URL & JSON response, using strings to always display the current day's report
today_report = 'https://app.close.io/api/v1/report/{YOUR_ORGANIZATION_ID}?user_id=all&date_start=%sT04:00:00.000Z&date_end=%sT06:59:59.999Z' % (today, tomorrow)
response = requests.get(today_report, auth=(closeio_key, ''), headers={'Content-Type': 'application/json'})

## PICK YOUR VARIABLE FROM THE CLOSE.IO JSON RESPONSE ##

#Calls for today using the today_report URL
calls_today = response.json['calls']

#The amount of won deals today using the same today_report URL
won_today = response.json['opportunities_won']

#The amount of revenue won today, the output is in cents, must divide by 100.0