Pull sync
With pull sync, you serve a small read-only API and the CRM polls it every few minutes for orders and customers that changed. Use it when you cannot run code on every change, or as a safety net next to push so nothing is missed during an outage.
Everything pulled goes through the same processing as a push, so pushing and pulling the same order never creates a duplicate.
Connect#
A CRM administrator opens Settings → Integrations → Overview → Add pull connection and enters:
- a platform name (for example
woocommerce). Pulled records are tagged with it exactly like pushes from an API key with that platform. If you also push, use the same name. - your feed's base URL, for example
https://shop.example.com/crm; - a key the CRM sends as
Authorization: Bearer <key>.
They then pick how often to check (every 5 minutes up to once a day) and switch it on. Run now starts a run straight away. Reload all history starts again from the beginning.
The contract#
Implement these GET endpoints under your base URL. Only /orders is required.
| Endpoint | Required | Returns |
|---|---|---|
/orders | yes | Orders, in the order push shape |
/customers | no (answer 404 if you do not offer it) | Customers, in the customer push shape |
/products | no | { externalId, name, categoryExternalId, price, active } |
/categories | no | { externalId, name, parentExternalId } |
Requests#
GET /crm/orders?updatedSince=2026-10-06T09:00:00.000Z&limit=100 HTTP/1.1
Authorization: Bearer <key>
Accept: application/json
User-Agent: AbayCRM-Sync/1.0
| Parameter | Meaning |
|---|---|
updatedSince | Return items with updatedAt at or after this instant. Absent on the very first run, which means everything. |
limit | Page size the CRM wants (100, or 200 while loading history). You may return fewer. |
cursor | Your nextCursor from the previous page. When it is present, updatedSince is left out. |
Responses#
{
"data": [
{ "externalId": "1001", "updatedAt": "2026-10-06T09:01:12Z", "placedAt": "2026-10-06T08:55:00Z", "…": "…" }
],
"nextCursor": "b3JkZXI6MTAwMQ"
}
Rules:
- Sort by
updatedAt, then by id, oldest first. Every item must includeupdatedAt(for customers,createdAtwill do if it never changes). - Return
nextCursorwhile there are more pages andnull(or leave it out) on the last one. A cursor can be any string, such as a base64 ofupdatedAtand id. - Include items equal to
updatedSince. The CRM may read the boundary item twice, which is harmless. - If you cannot do cursors, return
nextCursor: nulland the CRM moves forward byupdatedSincealone. In that case no more thanlimititems may share the sameupdatedAt. - Answer
2xxwith JSON. Any other status fails the run, and the CRM tries again at the next interval. Time-outs are 30 seconds per page.
How the CRM keeps its place#
The CRM keeps a separate position for orders and for customers: the newest updatedAt it has processed. It saves that position after every page, so a crash part-way through only repeats one page. Products and categories are fetched at most once a day.
An item that fails validation is recorded as a failed event for an admin to look at. It does not stop the run.
Minimal example (Node.js)#
app.get('/crm/orders', requireBearer(process.env.CRM_PULL_KEY), async (req, res) => {
const limit = Math.min(Number(req.query.limit) || 100, 200);
const after = req.query.cursor ? JSON.parse(Buffer.from(req.query.cursor, 'base64url')) : null;
const since = req.query.updatedSince ? new Date(req.query.updatedSince) : new Date(0);
const rows = await db.orders.findMany({
where: after
? { OR: [{ updatedAt: { gt: new Date(after.u) } }, { updatedAt: new Date(after.u), id: { gt: after.i } }] }
: { updatedAt: { gte: since } },
orderBy: [{ updatedAt: 'asc' }, { id: 'asc' }],
take: limit + 1,
});
const page = rows.slice(0, limit);
const last = page.at(-1);
res.json({
data: page.map(toCrmOrder), // same shape as POST /v1/integrations/orders
nextCursor: rows.length > limit ? Buffer.from(JSON.stringify({ u: last.updatedAt, i: last.id })).toString('base64url') : null,
});
});
Health#
The admin overview shows, for each connection, the last run, the last success, the items read and the current position. A connection turns amber after a failed run and red after three failures in a row, or when there has been no success within the server's alert window (30 minutes by default).