Skip to main content

Python SDK for Contackd Sync

Project description

contackd-sync (Python)

Python SDK for pushing and syncing customer data (contacts, leads, prospects).

Install

pip install contackd-sync

2-Minute Start (Push Customer Details)

from contackd_sync import ContackdClient, Contact

client = ContackdClient(
    api_key="sk_live_...",
    base_url="https://api.yourapp.com/v1",  # no trailing slash required
)

# Create/update a customer contact by email
customer = client.contacts.upsert(
    Contact(
        email="jane@acme.com",
        first_name="Jane",
        last_name="Doe",
        phone="+14155550199",
        tags=["customer", "vip"],
        custom={
            "customer_id": "CUST-1001",
            "plan": "pro",
            "country": "US",
        },
    )
)

print(customer)

Common Customer Push Patterns

1) Push one new customer

from contackd_sync import Contact

created = client.contacts.create(
    Contact(email="new@acme.com", first_name="New", last_name="Customer")
)

2) Push many customers (bulk upsert)

from contackd_sync import Contact

result = client.contacts.bulk_upsert(
    [
        Contact(email="a@acme.com", first_name="A"),
        Contact(email="b@acme.com", first_name="B", tags=["trial"]),
    ]
)

print(len(result.created), len(result.updated), result.errors)

3) Read/filter customers

page = client.contacts.list(page=1, per_page=50, email="jane@acme.com")

API Key Setup

  1. Create key (JWT required):
curl -X POST http://localhost:8000/api/v1/auth/api-keys \
  -H "Authorization: Bearer <ACCESS_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"name":"py-sdk"}'
  1. Use returned api_key as api_key in ContackdClient.

  2. Revoke key:

curl -X DELETE http://localhost:8000/api/v1/auth/api-keys/<API_KEY_ID> \
  -H "Authorization: Bearer <ACCESS_TOKEN>"

Backend Routes Expected by SDK

Given base_url = https://api.yourapp.com/v1:

  • GET /health
  • POST /contacts|leads|prospects
  • GET /contacts|leads|prospects/{id}
  • PUT /contacts|leads|prospects/{id}
  • DELETE /contacts|leads|prospects/{id}
  • GET /contacts|leads|prospects
  • POST /contacts|leads|prospects/upsert
  • POST /contacts|leads|prospects/bulk
  • POST /contacts|leads|prospects/bulk/upsert
  • POST /contacts|leads|prospects/bulk/delete

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contackd_sync-0.1.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contackd_sync-0.1.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file contackd_sync-0.1.1.tar.gz.

File metadata

  • Download URL: contackd_sync-0.1.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for contackd_sync-0.1.1.tar.gz
Algorithm Hash digest
SHA256 f56042d6d78b80bb59ee6827d843183eba929a83c4919aa6603b89c0c0685af7
MD5 cfb4bddb842f08e788dd57e4652ef659
BLAKE2b-256 19144a1b83cbb7b0b5ab88ca8a55a42bde65fc29fb5463224b3c94cdefbb670b

See more details on using hashes here.

File details

Details for the file contackd_sync-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: contackd_sync-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.13

File hashes

Hashes for contackd_sync-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cadcec79c3a046efa094a1ad265cf1388c0b31dd09873e31b4acfd019337366f
MD5 2eccce429160f6e8b74e4782031f24bc
BLAKE2b-256 6723dfef9d37f24caa6eb03ce9f00fc3fac3fcb4a71a1db3fcbdb9eafb60614c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page