Devmachinist /Docs
Sign in Start
All docs

Webhooks and integrations

This page covers the ways data and actions cross between your project and other services:

  • Incoming hooks: a private address that Zapier, or anything that can send JSON, posts rows to. The rows wait in an inbox until you import them.
  • Posting from your app: your app's admins publish to the social accounts you linked in the builder, without the account's token ever reaching the browser.
  • Stripe webhooks for stores, covered in full on the Payments API page.

Linking apps and databases in the builder is described in Databases and apps.

Incoming hooks #

A hook connection gives your project a private web address:

http
POST https://devmachinist.com/_hooks/in/<token>

The token in the address is the only secret: there is no header to sign and no key to send. Treat the whole address like a password. Only a hash of the token is used to look it up.

Getting the address #

In the builder, ask the chat to connect Zapier ("set up Zapier so new form entries come into the project"). A card appears in the chat; setting it up creates a connection with an id like conn_4f9a1c2b7d3e5a and shows its address. There is nothing to sign in to and nothing the site's owner has to register. You can copy the address again from the connection later.

Both steps are also REST routes for a signed-in browser session. They refuse personal access tokens (403), because the address is a secret.

http
POST /api/projects/<projectId>/connections/app
Content-Type: application/json

{ "connector": "zapier" }
json
{
  "ok": true,
  "connection": { "id": "conn_4f9a1c2b7d3e5a", "kind": "app", "engine": "zapier", "label": "Zapier", "access": "read", "status": "active", "webhook": true },
  "hook": "https://devmachinist.com/_hooks/in/x7Kp2mQ9vR4tY8wZ1aB3cD5eF6gH0jLn"
}
http
GET /api/projects/<projectId>/connections/<connectionId>/hook
json
{ "ok": true, "hook": "https://devmachinist.com/_hooks/in/x7Kp2mQ9vR4tY8wZ1aB3cD5eF6gH0jLn" }

Removing the connection (DELETE /api/projects/<projectId>/connections/<connectionId>, or in the builder) deletes its inbox, and the address answers 404 from then on.

Sending rows #

Send JSON with Content-Type: application/json. Three body shapes are accepted:

BodyRows stored
One object, { "email": "…" }One row
A list of objects, [{ … }, { … }]One row per object
{ "rows": [{ … }, { … }] }One row per object in rows

Entries that aren't objects are dropped. Form-encoded bodies (application/x-www-form-urlencoded) are parsed into an object and stored as one row.

bash
curl -X POST https://devmachinist.com/_hooks/in/x7Kp2mQ9vR4tY8wZ1aB3cD5eF6gH0jLn \
  -H "Content-Type: application/json" \
  -d '{ "email": "ada@example.com", "name": "Ada Lovelace", "plan": "pro" }'
json
{ "ok": true, "received": 1 }

From another server:

js
await fetch('https://devmachinist.com/_hooks/in/x7Kp2mQ9vR4tY8wZ1aB3cD5eF6gH0jLn', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ rows: [
    { sku: 'TOTE-01', stock: 18 },
    { sku: 'LAMP-01', stock: 4 },
  ] }),
})

In Zapier, add the action Webhooks by Zapier → POST, paste the address as the URL, choose JSON as the payload type and map the fields you want under Data.

The address sends no CORS headers, so it is meant for server-to-server calls, not for fetch from a web page on another site.

Limits and errors #

StatusWhen
200{ "ok": true, "received": <n> }
400The body holds no object: Send a JSON object, or a list of them
404No connection has this address: Unknown address
413The rows are larger than 512 KB in one request
429More than 120 requests in a minute to this address
  • At most 500 rows are kept from one request. Any beyond that are ignored, so send larger batches in several requests.
  • Each connection's inbox keeps the newest 5,000 rows. Older ones are dropped as new ones arrive.
  • The server's general limit of 1,200 requests a minute per sending address also applies.
The hook address is open to senders anywhere, even when the Devmachinist server limits the app itself to some countries.

Where rows go #

Rows are stored as they arrived in the connection's inbox (connection_inbox). Nothing reaches your app's data until someone imports it and a person approves the import. Each stored row is read back with an extra received_at field (an ISO date), and the inbox is resource inbox of the connection. Its fields are every key that appears in any row.

http
GET /api/projects/<projectId>/connections/<connectionId>/inspect?resource=inbox
json
{
  "ok": true,
  "text": "Zapier → inbox: 2 rows.\nFields: email, name, plan, received_at\n…",
  "data": {
    "fields": ["email", "name", "plan", "received_at"],
    "sample": [ { "email": "ada@example.com", "name": "Ada Lovelace", "plan": "pro", "received_at": "2026-11-13T10:20:31.000Z" } ]
  }
}

Importing the inbox #

The easiest way is to ask the chat: "import the Zapier inbox into Subscribers, matched on email". It calls stage_data with the connection and the resource; the rows go from the inbox to a staged preview server to server, never through the AI. You see the preview (new, updated, unchanged, problems) and press Approve and save.

The same through REST, with a session or a personal access token with the write scope (see Agents & MCP). mapping_json and match_on work as for any staged import: mapping_json is a JSON string mapping model fields to inbox fields.

bash
curl -X POST https://devmachinist.com/api/projects/$PROJECT_ID/data/stage \
  -H "Authorization: Bearer $DM_PAT" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Subscriber",
    "connection_id": "conn_4f9a1c2b7d3e5a",
    "resource": "inbox",
    "mapping_json": "{\"email\": \"email\", \"name\": \"name\", \"tier\": \"plan\"}",
    "match_on": ["email"]
  }'
json
{
  "ok": true,
  "text": "Staged stg_9c1e0a7b3f2d4e68 — Subscriber: 2 new, 0 updated, 0 unchanged. Matched existing rows on email. …",
  "staged": { "id": "stg_9c1e0a7b3f2d4e68", "status": "pending", "summary": "Subscriber: 2 new, 0 updated, 0 unchanged" }
}

Then commit it with POST /api/projects/<projectId>/data/staged/<stagedId>/commit, or approve it in the chat. Up to 5,000 rows can be staged at a time.

Importing does not empty the inbox. Always set match_on to a field that identifies a row (an email, an order number, an external id), so importing again updates rows instead of adding duplicates.

Posting from your app #

Your app's admins can publish posts through social accounts you linked in the builder. The account's tokens stay on the Devmachinist server; the app only calls two runtime routes on its own API.

ConnectorPosts toUsesNeeds
facebookA Facebook Page the linked account managestext, link, image, targetOne of text, link or image. With image it posts a photo with text as the caption
instagramThe linked professional accountimage, text as the captionimage
threadsThe linked accounttext, image, link added after the textText or an image
xThe linked accounttext and link, joined and cut to 280 charactersText or a link
linkedinThe linked member's own profiletext and linkText or a link

Turning it on #

  1. In the builder, link the account (the chat shows a sign-in button, or use Databases and apps). The sign-in already asks for the posting permission.
  2. Turn on sign-in for the site's API (API → Auth). Only that API's admins may post, so it needs accounts.
  3. Press Let my app post on the connection. This ties the connection to the site's sign-in API. Stop my app posting switches it off at once.

Without sign-in, step 3 answers 409 with "Turn on sign-in for this site first". Connectors that can't post answer 400.

Who may call the routes #

Both routes need the Authorization: Bearer <token> of a user of that API whose role is admin:

StatusWhen
401No valid token: Sign in first
403A signed-in user who isn't an admin: Only this app’s admins can use its linked accounts
404No such API

List the linked accounts #

http
GET /_api/<apiId>/integrations
bash
curl https://devmachinist.com/_api/mhx3k2pq9a7f2c/integrations \
  -H "Authorization: Bearer $ADMIN_TOKEN"
json
{
  "integrations": [
    { "connector": "facebook", "label": "Facebook Pages", "account": "Ada Lovelace" },
    { "connector": "instagram", "label": "Instagram", "account": "adas.studio" }
  ]
}

Only connections allowed to post for this API are listed. account is the name the provider gave at sign-in, or null.

Publish a post #

http
POST /_api/<apiId>/integrations/<connector>/post
Content-Type: application/json
FieldNotes
textUp to 5,000 characters (X cuts it to 280 with the link)
linkMust start with https://, else it is ignored
imageA public https:// image address the provider can fetch, else it is ignored
targetFacebook only: the Page id or name. Default: the first Page the account manages
bash
curl -X POST https://devmachinist.com/_api/mhx3k2pq9a7f2c/integrations/facebook/post \
  -H "Authorization: Bearer $ADMIN_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "text": "New in the shop: the Everyday Tote", "link": "https://shop.example.com/product/1/" }'
json
{ "ok": true, "id": "1234567890_9876543210", "url": "https://www.facebook.com/1234567890_9876543210", "target": "Ada's Studio", "connector": "facebook" }

id and url are the new post's, when the provider returns them. LinkedIn returns neither, so both are null.

StatusWhen
400Missing content, for example no image for Instagram, or a Facebook target the account doesn't manage
401The provider refused the linked account's sign-in. Link it again in the builder
404<connector> isn’t linked to this app, or posting is switched off
429More than 30 posts in an hour through one linked account
502The provider failed

Every post is audited (integration.posted) under the person who linked the account, with the admin who sent it and the post's address.

From a React admin page #

The generated auth client (src/api/<api-slug>-auth.jsx, see the generated client) exports integrations, which adds the signed-in admin's token for you:

  • integrations.list() resolves to the integrations array. It resolves to [] instead of failing when the user isn't allowed.
  • integrations.post(connector, { text, link, image, target }) resolves to { ok, id, url, connector } and throws an Error with the server's message when posting fails.

Use them only in admin code, behind <Auth role={['admin']}>:

jsx
import React, { useEffect, useState } from 'react'
import { Auth, integrations } from '../api/my-blog-auth.jsx'

export default function SharePost({ post }) {
  const [linked, setLinked] = useState([])
  const [note, setNote] = useState(null)
  useEffect(() => { integrations.list().then(setLinked) }, [])

  const share = async (connector) => {
    setNote('Posting…')
    try {
      const r = await integrations.post(connector, {
        text: post.title,
        link: 'https://blog.example.com/post/' + post.slug + '/',
        image: post.cover,             // must be a public https:// address
      })
      setNote(r.url ? 'Posted: ' + r.url : 'Posted')
    } catch (e) {
      setNote(e.message)               // e.g. "At most 30 posts an hour per linked account"
    }
  }

  return (
    <Auth role={['admin']}>
      <div className="flex flex-wrap gap-2">
        {linked.map(i => (
          <button key={i.connector} onClick={() => share(i.connector)} className="rounded-xl border-2 px-3 py-1.5 text-sm">
            Share on {i.label}
          </button>
        ))}
      </div>
      {note && <p className="mt-2 text-sm text-gray-400">{note}</p>}
    </Auth>
  )
}

Pictures uploaded with uploadFile(file, { access: 'public' }) have public https:// addresses and work as image. Private files don't, because the provider can't fetch them.

Stripe webhooks for stores #

A store on the API builder that takes payments with its own Stripe keys needs one webhook in the Stripe dashboard, pointing at:

http
POST https://devmachinist.com/_api/<apiId>/payments/webhook

It is verified with the signing secret you paste in API → Payments and settles, cancels and refunds orders and updates memberships. Stores on Stripe Connect need no webhook of their own. The events, the checks and the responses are on the Payments API page.

Devmachinist's own webhooks #

The server also has a billing webhook, /api/billing/webhook, and a Stripe Connect endpoint. They belong to the Devmachinist platform: they carry its own plan, credit and Shop payments and are signed with the platform's secrets. They are not an API for your apps, and you can't register for or receive their events.