Beispiel #1
0
def print_contacts():
    # Paginator is the action that returns a list of campaigns
    print 'Querying contact paginator ...'
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    # commented out for campaign pagination support
    # contact_paginator_file = open(contact_paginator_path, 'wb')
    # contact_paginator = ac.api('contact/paginator?sort=&offset=0&limit=20&filter=0&public=0')
    # json.dump(contact_paginator, contact_paginator_file)
    # contact_paginator_file.close()
    # assume hard limit of 100
    contact_paginator = ac.api(
        'contact/paginator?sort=&offset=0&limit=100&filter=0&public=0')
    contact_rows = contact_paginator['rows']
    if contact_paginator['total'] > 100:
        outstanding_contacts = contact_paginator['total'] - 100
        offset = 100
        while outstanding_contacts > 0:
            contact_paginator = ac.api('contact/paginator?sort=&offset=' +
                                       str(offset) +
                                       '&limit=100&filter=0&public=0')
            contact_rows.extend(contact_paginator['rows'])
            outstanding_contacts = outstanding_contacts - 100
            offset = offset + 100
    contact_list_file = open(contact_list_path, 'wb')
    #for contact_row in contact_paginator['rows']:
    for contact_row in contact_rows:
        print 'Querying \'' + contact_row['name'] + '\'; id=' + contact_row[
            'id'] + ' ...'
        contact_list = ac.api('contact/list?ids=' + contact_row['id'])
        json.dump(contact_list, contact_list_file)
        contact_list_file.write('\n')
    contact_list_file.close()
    print 'Done!'
Beispiel #2
0
def print_campaign_report_unopen_lists():
    # Paginator is the action that returns a list of campaigns
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    campaign_paginator = ac.api(
        'campaign/paginator?sort=&offset=0&limit=100&filter=0&public=0')
    campaign_rows = campaign_paginator['rows']
    if campaign_paginator['total'] > 100:
        outstanding_campaigns = campaign_paginator['total'] - 100
        offset = 100
        while outstanding_campaigns > 0:
            campaign_paginator = ac.api('campaign/paginator?sort=&offset=' +
                                        str(offset) +
                                        '&limit=100&filter=0&public=0')
            campaign_rows.extend(campaign_paginator['rows'])
            outstanding_campaigns = outstanding_campaigns - 100
            offset = offset + 100
    for campaign_row in campaign_rows:
        page = 0
        while True:  # there is no do ... while () loop in python
            page = page + 1
            campaign_report_unopen_dict = ac.api(
                'campaign/report_unopen_list?campaignid=' +
                campaign_row['id'] + '&messageid=' +
                str(campaign_row['messageid']) + '&page=' + str(page))
            have_unopens = campaign_report_unopen_dict.pop('result_code')
            campaign_report_unopen_dict.pop('result_message')
            campaign_report_unopen_dict.pop('result_output')
            if have_unopens == 0:
                break
            for user_open in list(campaign_report_unopen_dict.values()):
                print campaign_row['id'] + ',' + user_open[
                    'times'] + ',' + user_open['tstamp'] + ',' + user_open[
                        'orgname'] + ',' + user_open['phone'] + ',' + user_open[
                            'subscriberid'] + ',' + user_open['email']
Beispiel #3
0
def print_lists():
    # Paginator is the action that returns a list of campaigns
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    list_paginator = ac.api(
        'list/paginator?sort=&offset=0&limit=100&filter=0&public=0')
    list_rows = list_paginator['rows']
    if list_paginator['total'] > 100:
        outstanding_lists = list_paginator['total'] - 100
        offset = 100
        while outstanding_lists > 0:
            list_paginator = ac.api('list/paginator?sort=&offset=' +
                                    str(offset) +
                                    '&limit=100&filter=0&public=0')
            list_rows.extend(list_paginator['rows'])
            outstanding_lists = outstanding_lists - 100
            offset = offset + 100
    for list_row in list_rows:
        list_dict = ac.api('list/list?ids=' + list_row['id'])
        if list_dict['result_code'] == 1:
            for k in list_dict.keys():
                if is_int(k):
                    ls_dict = list_dict[k]
                    row_str = ''
                    row_str += ls_dict.get('name', '') + ','
                    row_str += str(ls_dict.get('subscriber_count', '')) + ','
                    row_str += ls_dict.get('userid', '') + ','
                    row_str += ls_dict.get('private', '') + ','
                    row_str += ls_dict.get('cdate', '') + ','
                    row_str += ls_dict.get('id', '')
                    print row_str
Beispiel #4
0
def print_campaign_report_forward_lists():
    # Paginator is the action that returns a list of campaigns
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    campaign_paginator = ac.api(
        'campaign/paginator?sort=&offset=0&limit=100&filter=0&public=0')
    campaign_rows = campaign_paginator['rows']
    if campaign_paginator['total'] > 100:
        outstanding_campaigns = campaign_paginator['total'] - 100
        offset = 100
        while outstanding_campaigns > 0:
            campaign_paginator = ac.api('campaign/paginator?sort=&offset=' +
                                        str(offset) +
                                        '&limit=100&filter=0&public=0')
            campaign_rows.extend(campaign_paginator['rows'])
            outstanding_campaigns = outstanding_campaigns - 100
            offset = offset + 100
    for campaign_row in campaign_rows:
        campaign_report_forward_dict = ac.api(
            'campaign/report_forward_list?campaignid=' + campaign_row['id'] +
            '&messageid=' + str(campaign_row['messageid']))
        if campaign_report_forward_dict['result_code'] == 1:
            for k in campaign_report_forward_dict.keys():
                if is_int(k):
                    fwd_dict = campaign_report_forward_dict[k]
                    row_str = ''
                    row_str += campaign_row['id'] + ','
                    row_str += fwd_dict.get('a_times', '') + ','
                    row_str += fwd_dict.get('subscriberid', '') + ','
                    row_str += fwd_dict.get('brief_message', '') + ','
                    row_str += fwd_dict.get('name_from', '') + ','
                    row_str += fwd_dict.get('tstamp', '') + ','
                    row_str += fwd_dict.get('email_to', '') + ','
                    row_str += fwd_dict.get('messageid', '') + ','
                    row_str += fwd_dict.get('email_from', '')
                    print row_str
Beispiel #5
0
def print_list_paginator():
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    list_paginator_dict = {'total': 100}
    offset = 0
    while list_paginator_dict['total'] - offset > 0:
        list_paginator_dict = ac.api('list/paginator?sort=&offset=' +
                                     str(offset) +
                                     '&limit=100&filter=0&public=0')
        for row in list_paginator_dict['rows']:
            print row['id']
        offset += 100
Beispiel #6
0
def print_campaign_report_link_lists():
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    campaign_paginator = ac.api(
        'campaign/paginator?sort=&offset=0&limit=100&filter=0&public=0')
    campaign_rows = campaign_paginator['rows']
    if campaign_paginator['total'] > 100:
        outstanding_campaigns = campaign_paginator['total'] - 100
        offset = 100
        while outstanding_campaigns > 0:
            campaign_paginator = ac.api('campaign/paginator?sort=&offset=' +
                                        str(offset) +
                                        '&limit=100&filter=0&public=0')
            campaign_rows.extend(campaign_paginator['rows'])
            outstanding_campaigns = outstanding_campaigns - 100
            offset = offset + 100
    for campaign_row in campaign_rows:
        campaign_report_link_dict = ac.api(
            'campaign/report_link_list?campaignid=' + campaign_row['id'] +
            '&messageid=' + str(campaign_row['messageid']))
        if campaign_report_link_dict['result_code'] == 1:
            for k in campaign_report_link_dict.keys():
                if is_int(k):
                    link_dict = campaign_report_link_dict[k]
                    if link_dict.has_key('info'):
                        for user_dict in link_dict['info']:
                            row_str = ''
                            row_str += campaign_row['id'] + ','
                            row_str += str(campaign_row['messageid']) + ','
                            row_str += link_dict.get('a_unique', '') + ','
                            row_str += link_dict.get('tracked', '') + ','
                            row_str += link_dict.get('link', '') + ','
                            row_str += link_dict.get('a_total', '') + ','
                            row_str += link_dict.get('id', '') + ','
                            row_str += link_dict.get('name', '') + ','
                            row_str += user_dict.get('subscriberid', '') + ','
                            row_str += user_dict.get('orgname', '') + ','
                            row_str += user_dict.get('times', '') + ','
                            row_str += user_dict.get('phone', '') + ','
                            row_str += user_dict.get('tstamp', '') + ','
                            row_str += user_dict.get('email', '')
                            print row_str
                    else:
                        row_str = ''
                        row_str += campaign_row['id'] + ','
                        row_str += str(campaign_row['messageid']) + ','
                        row_str += link_dict.get('a_unique', '') + ','
                        row_str += link_dict.get('tracked', '') + ','
                        row_str += link_dict.get('link', '') + ','
                        row_str += link_dict.get('a_total', '') + ','
                        row_str += link_dict.get('id', '') + ','
                        row_str += link_dict.get('name', '') + ',,,,,,'
                        print row_str
Beispiel #7
0
def write_list_paginator():
    print 'Querying list paginator ...'
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    list_paginator_file = open(list_paginator_path, 'wb')
    list_paginator_dict = {'total': 100}
    offset = 0
    while list_paginator_dict['total'] - offset > 0:
        list_paginator_dict = ac.api('list/paginator?sort=&offset=' +
                                     str(offset) +
                                     '&limit=100&filter=0&public=0')
        print str(list_paginator_dict['total']) + ' lists found'
        for row in list_paginator_dict['rows']:
            list_paginator_file.write(json.dumps(row) + '\n')
        offset += 100
Beispiel #8
0
def write_campaign_paginator():
    print 'Querying campaign paginator ...'
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    campaign_paginator_file = open(campaign_paginator_path, 'wb')
    campaign_paginator_dict = {'total': 100}
    offset = 0
    while campaign_paginator_dict['total'] - offset > 0:
        campaign_paginator_dict = ac.api('campaign/paginator?sort=&offset=' +
                                         str(offset) +
                                         '&limit=100&filter=0&public=0')
        print str(campaign_paginator_dict['total']) + 'campaigns found'
        for row in campaign_paginator_dict['rows']:
            campaign_paginator_file.write(json.dumps(row) + '\n')
            print row['id'] + ',' + row['uniqueopens']
        offset += 100
Beispiel #9
0
def write_campaign_report_unopen_lists():
    print 'Querying campaign paginator ...'
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    campaign_paginator = ac.api(
        'campaign/paginator?sort=&offset=0&limit=100&filter=0&public=0')
    campaign_rows = campaign_paginator['rows']
    if campaign_paginator['total'] > 100:
        outstanding_campaigns = campaign_paginator['total'] - 100
        offset = 100
        while outstanding_campaigns > 0:
            campaign_paginator = ac.api('campaign/paginator?sort=&offset=' +
                                        str(offset) +
                                        '&limit=100&filter=0&public=0')
            campaign_rows.extend(campaign_paginator['rows'])
            outstanding_campaigns = outstanding_campaigns - 100
            offset = offset + 100
    campaign_report_unopen_list_file = open(campaign_report_unopen_lists_path,
                                            'wb')
    for campaign_row in campaign_rows:
        page = 0
        campaign_report_unopen_list = []
        while True:  # there is no do ... while () loop in python
            page = page + 1
            print 'Querying unopen list for \'' + campaign_row[
                'analytics_campaign_name'] + '\'; id=' + campaign_row[
                    'id'] + '; messageid=' + str(
                        campaign_row['messageid']) + '; page=' + str(
                            page) + ' ...'
            campaign_report_unopen_dict = ac.api(
                'campaign/report_unopen_list?campaignid=' +
                campaign_row['id'] + '&messageid=' +
                str(campaign_row['messageid']) + '&page=' + str(page))
            have_unopens = campaign_report_unopen_dict.pop('result_code')
            campaign_report_unopen_dict.pop('result_message')
            campaign_report_unopen_dict.pop('result_output')
            if have_unopens == 0:
                break
            campaign_report_unopen_list.extend(
                list(campaign_report_unopen_dict.values()))
        out_dict = {
            'campaign_id': campaign_row['id']
        }  # store which campaign this list belongs to
        out_dict['open_list'] = campaign_report_unopen_list
        json.dump(out_dict, campaign_report_unopen_list_file)
        campaign_report_unopen_list_file.write('\n')
    campaign_report_unopen_list_file.close()
    print 'Done!'
Beispiel #10
0
def write_contact_paginator():
    # Paginator is the action that returns a list of campaigns
    print 'Querying contact paginator ...'
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    contact_paginator_file = open(contact_paginator_path, 'wb')
    contact_paginator = {'total': 100}
    offset = 0
    while contact_paginator['total'] - offset > 0:
        print 'querying offset ' + str(offset) + ' out of ' + str(
            contact_paginator['total'])
        contact_paginator = ac.api('contact/paginator?sort=&offset=' +
                                   str(offset) +
                                   '&limit=100&filter=0&public=0')
        contact_rows = contact_paginator['rows']
        for contact in contact_rows:
            json.dump(contact, contact_paginator_file)
            contact_paginator_file.write('\n')
        offset += 100
Beispiel #11
0
def write_contacts():
    # NOTE:
    # write contacts work differently from the other paginator based queries
    # Instead of collecting the paginator in memory before running the detail API calls
    # the paginator has to be run separately. The paginator results are then read here from a file.
    print 'Reading contact paginator json ...'
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    contact_paginator_file = open(contact_paginator_path, 'rb')
    contact_list_file = open(contact_list_path, 'wb')
    id_list = []
    total = 0
    i = 0
    for line in contact_paginator_file:  # read and parse line by line
        contact_row = json.loads(line)
        # query 20 by 20
        i += 1
        total += 1
        if i <= 20:
            id_list.append(contact_row['id'])
        if i == 20:
            print 'Querying ids=' + ','.join(id_list) + ' ...'
            contact_list = ac.api('contact/list?ids=' + ','.join(id_list))
            result_code = contact_list.pop('result_code')
            contact_list.pop('result_message')
            contact_list.pop('result_output')
            if result_code == 1:
                for contact in list(contact_list.values()):
                    json.dump(contact, contact_list_file)
                    contact_list_file.write('\n')
            i = 0
            id_list = []
    if len(id_list) > 0:  # repetitive code... ugly
        contact_list = ac.api('contact/list?ids=' + ','.join(id_list))
        result_code = contact_list.pop('result_code')
        contact_list.pop('result_message')
        contact_list.pop('result_output')
        if result_code == 1:
            for contact in list(contact_list.values()):
                json.dump(contact, contact_list_file)
                contact_list_file.write('\n')
    contact_paginator_file.close()
    contact_list_file.close()
    print 'Done!'
Beispiel #12
0
def print_campaigns():
    # Paginator is the action that returns a list of campaigns
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    campaign_paginator = ac.api(
        'campaign/paginator?sort=&offset=0&limit=100&filter=0&public=0')
    campaign_rows = campaign_paginator['rows']
    if campaign_paginator['total'] > 100:
        outstanding_campaigns = campaign_paginator['total'] - 100
        offset = 100
        while outstanding_campaigns > 0:
            campaign_paginator = ac.api('campaign/paginator?sort=&offset=' +
                                        str(offset) +
                                        '&limit=100&filter=0&public=0')
            campaign_rows.extend(campaign_paginator['rows'])
            outstanding_campaigns = outstanding_campaigns - 100
            offset = offset + 100
    for campaign_row in campaign_rows:
        print 'Querying \'' + campaign_row[
            'analytics_campaign_name'] + '\'; id=' + campaign_row['id'] + ' ...'
        campaign_dict = ac.api('campaign/list?ids=' + campaign_row['id'])

    print 'Done!'
Beispiel #13
0
def write_campaign_report_forward_lists():
    # Paginator is the action that returns a list of campaigns
    print 'Querying campaign paginator ...'
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    # commented out for campaign pagination support
    #campaign_paginator_file = open(campaign_paginator_path, 'wb')
    #campaign_paginator = ac.api('campaign/paginator?sort=&offset=0&limit=20&filter=0&public=0')
    #json.dump(campaign_paginator, campaign_paginator_file)
    #campaign_paginator_file.close()
    campaign_paginator = ac.api(
        'campaign/paginator?sort=&offset=0&limit=100&filter=0&public=0')
    campaign_rows = campaign_paginator['rows']
    if campaign_paginator['total'] > 100:
        outstanding_campaigns = campaign_paginator['total'] - 100
        offset = 100
        while outstanding_campaigns > 0:
            campaign_paginator = ac.api('campaign/paginator?sort=&offset=' +
                                        str(offset) +
                                        '&limit=100&filter=0&public=0')
            campaign_rows.extend(campaign_paginator['rows'])
            outstanding_campaigns = outstanding_campaigns - 100
            offset = offset + 100
    campaign_report_forward_list_file = open(
        campaign_report_forward_lists_path, 'wb')
    #for campaign_row in campaign_paginator['rows']:
    for campaign_row in campaign_rows:
        print 'Querying link list for \'' + campaign_row[
            'analytics_campaign_name'] + '\'; id=' + campaign_row[
                'id'] + '; messageid=' + str(
                    campaign_row['messageid']) + ' ...'
        campaign_report_forward_list = ac.api(
            'campaign/report_forward_list?campaignid=' + campaign_row['id'] +
            '&messageid=' + str(campaign_row['messageid']))
        json.dump(campaign_report_forward_list,
                  campaign_report_forward_list_file)
        campaign_report_forward_list_file.write('\n')
    campaign_report_forward_list_file.close()
    print 'Done!'
Beispiel #14
0
def write_message_lists():
    # No paginator in API but can request for all messages, subject to paging
    print 'Querying message list ...'
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    page = 0
    message_list_file = open(message_list_path, 'wb')
    while True:
        page = page + 1
        message_dict = ac.api('message/list?ids=all&page=' + str(page))
        have_opens = message_dict.pop('result_code')
        message_dict.pop('result_message')
        message_dict.pop('result_output')
        for key in range(len(message_dict)):
            print 'Querying \'' + message_dict[str(key)][
                'subject'] + '\'; id=' + message_dict[str(key)]['id'] + ' ...'
            message = ac.api('message/view?id=' +
                             str(message_dict[str(key)]['id']))
            json.dump(message, message_list_file)
            message_list_file.write('\n')
        if have_opens == 0:
            break
    message_list_file.close()
    print 'Done!'
Beispiel #15
0
def print_campaign_report_unsubscribe_lists():
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    #campaign_paginator = ac.api('campaign/paginator?sort=&offset=0&limit=20&filter=0&public=0')
    campaign_paginator = ac.api(
        'campaign/paginator?sort=&offset=0&limit=100&filter=0&public=0')
    campaign_rows = campaign_paginator['rows']
    if campaign_paginator['total'] > 100:
        outstanding_campaigns = campaign_paginator['total'] - 100
        offset = 100
        while outstanding_campaigns > 0:
            campaign_paginator = ac.api('campaign/paginator?sort=&offset=' +
                                        str(offset) +
                                        '&limit=100&filter=0&public=0')
            campaign_rows.extend(campaign_paginator['rows'])
            outstanding_campaigns = outstanding_campaigns - 100
            offset = offset + 100
    #for campaign_row in campaign_paginator['rows']:
    for campaign_row in campaign_rows:
        campaign_report_unsubscribe_dict = ac.api(
            'campaign/report_unsubscription_list?campaignid=' +
            campaign_row['id'])
        if campaign_report_unsubscribe_dict['result_code'] == 1:
            for k in campaign_report_unsubscribe_dict.keys():
                if is_int(k):
                    unsub_dict = campaign_report_unsubscribe_dict[k]
                    row_str = ''
                    row_str += campaign_row['id'] + ','
                    row_str += unsub_dict.get('orgname', '') + ','
                    unsub_reason = unsub_dict.get('unsubreason', '')
                    row_str += (unsub_reason
                                if unsub_reason != None else '') + ','
                    row_str += unsub_dict.get('udate', '') + ','
                    row_str += unsub_dict.get('subscriberid', '') + ','
                    row_str += unsub_dict.get('phone', '') + ','
                    row_str += unsub_dict.get('tstamp', '') + ','
                    row_str += unsub_dict.get('email', '')
                    print row_str
Beispiel #16
0
def write_lists():
    print 'Querying list paginator ...'
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)
    # assume hard limit of 100
    list_paginator = ac.api(
        'list/paginator?sort=&offset=0&limit=100&filter=0&public=0')
    list_rows = list_paginator['rows']
    if list_paginator['total'] > 100:
        offset = 0
        while list_paginator['total'] - offset > 0:
            list_paginator = ac.api('list/paginator?sort=&offset=' +
                                    str(offset) +
                                    '&limit=100&filter=0&public=0')
            list_rows.extend(list_paginator['rows'])
            offset += 100
    list_list_file = open(list_list_path, 'wb')
    for list_row in list_rows:
        print 'Querying \'' + list_row['name'] + '\'; id=' + list_row[
            'id'] + ' ...'
        list_list = ac.api('list/list?ids=' + list_row['id'])
        json.dump(list_list, list_list_file)
        list_list_file.write('\n')
    list_list_file.close()
    print 'Done!'
Beispiel #17
0
from includes.ActiveCampaign import ActiveCampaign
from includes.Config import ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY
#import datetime, time, json

if __name__ == '__main__':
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)

    # campaigns = ac.api('campaign/paginator?sort=&offset=0&limit=20&filter=0&public=0')
    # crows = campaigns['rows']

    # documentation points to limit of 20 items per page
    campaign5open = ac.api('campaign/report_open_list?campaignid=5&page=2')
    #print json.dumps(campaign5open)
    # print ac.api('campaign/report_open_list?campaignid=5&page=1')
    #
    # campaign11fwd = ac.api('campaign/report_forward_list?campaignid=11&messageid=16')
    # campaign5fwdtotal = ac.api('campaign/report_forward_totals?campaignid=5')
    #
    # campaign5link = ac.api('campaign/report_link_list?campaignid=5&messageid=10')
    #
    # campaign6unsub = ac.api('campaign/report_unsubscription_list?campaignid=6')
    #
    # campaign5opentotal = ac.api('campaign/report_open_totals?campaignid=5')
    #
    # contact = ac.api('contact/view?id=1')
    #
    #contact_list = ac.api('contact/list?ids=5')
    #
    contact_paginator = ac.api(
        'contact/paginator?sort=&offset=0&limit=100&filter=0&public=0')
    #
Beispiel #18
0
from includes.ActiveCampaign import ActiveCampaign
from includes.Config import ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY

if __name__ == '__main__':
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY)

    # add list
    list = {
        'name': 'A Subscripiton List',
        'get_unsubscribe_reason': 1,
        'sender_name': 'A Company',
        'sender_addr1': 'A Street There',
        'sender_zip': 'AA2 2AA',
        'sender_city': 'Manchester',
        'sender_country': 'United Kingdom',
        'sender_url': 'http://www.example.com/',
        'sender_reminder': 'You subscribed on our web site'
    }
    print ac.api('list/add', list)

    # add custom list field
    list_field = {
        'title': 'A Custom Field',
        'type':
        1,  # 1 = Text Field, 2 = Text Box, 3 = Checkbox, 4 = Radio, 5 = Dropdown, 6 = Hidden field, 7 = List Box, 9 = Date
        'req': 0,
        'perstag': 'CUSTOM_FIELD',
        'p[0]': 0
    }
    print ac.api('list/field_add', list_field)
Beispiel #19
0
from includes.ActiveCampaign import ActiveCampaign
from includes.Config import ACTIVECAMPAIGN_URL, ACTIVECAMPAIGN_API_KEY

if __name__ == '__main__':
    ac = ActiveCampaign(ACTIVECAMPAIGN_URL,  ACTIVECAMPAIGN_API_KEY)

    ## delete subscriber
    #print ac.api('subscriber/delete?id=10')

    ## delete_list
    #print ac.api('subscriber/delete_list?ids=9,11')

    # edit subscriber
    subscriber = {
       'id': 12,
       'email': '*****@*****.**',
       'first_name': 'John',
       'last_name': 'Smith',
       'p[1]': 1,
       'status[1]': 1,
    }
    print ac.api('subscriber/edit', subscriber)