Sync Polar customers into Attio
A Polar + Attio agent flow
Polar handles billing for a developer tool or open-source project, and Attio is where the team tracks who its users actually are. Between the two there's a manual step nobody enjoys: a customer pays, and someone is supposed to add them to the CRM so the relationship has a home. It rarely happens consistently. This recipe makes it automatic and idempotent: your agent reads Polar customers and upserts each into Attio keyed on email, so paying customers show up in the CRM whether or not they were ever entered by hand. It calls polar_customers_list, and for each customer calls upsert-record against the People object matching on email, which creates the person if they're new and updates them if they exist. Polar answers on request, so the agent runs on a cadence and reconciles the customer list against Attio each pass.
The flow
polar_customers_listLists customers.
upsert-recordCreates or updates a record by matching attributes such as email or domain.
Step by step
- Read the Polar customers
The agent calls polar_customers_list and pages through. Each record has the customer's email, name, and Polar customer ID. You can narrow to customers created since the last run with the stored timestamp, or reconcile the full list each pass.
- Upsert into Attio by email
For each customer it calls upsert-record on the People object, matching on the email attribute. Attio creates the person if no match exists and updates the matched record otherwise, so there's no separate dedupe step.
- Tag the source and link back
Set an attribute that marks the person as a Polar customer and, if you keep a field for it, store the Polar customer ID so a rep can jump from Attio back to the billing record.
- Track what's been synced
Because upsert is idempotent, re-running is safe by design. Still, store the newest customer timestamp so each pass only reads recent customers and the job stays cheap on a large book.
Tell your agent
Every hour, list Polar customers created since your last run. For each one, upsert a record on the Attio People object matching on email, setting the name, an attribute marking them as a Polar customer, and the Polar customer ID. Track the newest customer timestamp so you only pull recent customers next time.
Setup
This flow needs both servers connected to your agent. Follow each install guide:
Worth knowing
- upsert-record needs a matching attribute that's actually unique in your Attio workspace, email being the obvious one. If two Polar customers share an email, or a person has no email, the match is ambiguous and you'll either collide records or fail to create one.
- Attio's People and Companies are distinct objects. polar_customers_list gives you a person-level email, so upsert into People; if you also want the company, derive it from the email domain and upsert a Company separately, then link them.
- Confirm the attribute slugs before writing. Attio addresses custom fields by their API slug, not the label in the UI, so list the object's attribute definitions once and map your fields to the right slugs.
Questions
- What makes this safe to run repeatedly?
- The upsert. Because it matches on email and updates rather than blindly inserting, running the agent again over the same customers refreshes their records instead of creating duplicates, so you can run it as often as you like.
- Does it react the instant someone subscribes on Polar?
- No. Polar responds when the agent calls it, it doesn't push to Attio. New customers appear in the CRM on your next scheduled pass, so set the cadence to match how quickly you need them there.