Customers

Add customers, segment them, and record their activity.

goomzo.customers, goomzo.segments and goomzo.activity keep Goomzo in step with your own system. See Customers.

Add or update customers

saved = goomzo.customers.create(
    [{
        'name': 'Amina Juma',
        'phone': '+255712345678',
        'attributes': {'plan': 'gold'},
        'segments': [{'name': 'Shoppers'}],
        'activities': [{'key': 'purchased', 'value': 'Shoes'}],
    }],
    if_exists='update',
)

saved[0]['result']  # 'created', 'updated' or 'unchanged'

Record customer activity

goomzo.activity.record(
    [{'key': 'purchased', 'value': 'Shoes'}, {'key': 'spent', 'value': 45000}],
    phone='+255712345678',
)

Segments

for customer in goomzo.segments.customers.list('seg_4hq2v9n1c8x0t6pk'):
    print(customer['name'])

goomzo.segments.customers.add('seg_4hq2v9n1c8x0t6pk', ['cus_4hq2v9n1c8x0t6pk'])

Other methods

MethodDoes
customers.list(q, segment, limit)Lists customers, a page at a time.
customers.get(id)Gets one.
customers.update(id, changes)Changes one.
customers.delete(id)Deletes one.
customers.segments.set(id, names)Sets the segments a customer is in.
customers.activity.list(id)Lists a customer's activity.
segments.create(segment)Adds a segment, by hand or by rules.
segments.customers.remove(id, ids)Takes customers out of a segment.

Next steps

Last updated