Authenticate
Use a workspace secret key. Identify the end user with a header — do not put a user id in the URL.string
required
Bearer plus a workspace secret (sk_…). Leftover sk_test_ secrets still authenticate and spend the same workspace balance.string
required
Stable id for the person in this channel. Prefix by channel so Slack and WhatsApp users do not collide:
slack:U0APP, wa:15551234567.string
Connection id or name. Sets which host tools this call uses. Required when the agent has unpinned customer tools.
subject_ref in the create-thread body. The header wins if both are present.
Post a message
202 with a run_id. Your backend waits for the run — poll or subscribe — then writes the assistant’s reply back to Slack (or WhatsApp, or email).
When the agent asks a question
The run entersawaiting_input. Collect the user’s next message in your channel, then POST it to the same thread. The run resumes.
When the agent calls a tool you host
The run entersawaiting_outcome. Confirm the side effect:
state is occurred or failed. The agent continues from there.
Verifying the tool call itself is the same as direct: Patchwork-Signature over your request secret, plus the subject token.
Subject tokens (mint URL)
When a run needs a subject token to call your tools, Patchwork POSTs to your workspacemint_url. The request is presenter-signed.
Patchwork-Subject names the person.
Thread identity
Threads are scoped to the subject. The same Slack user talking to the same agent reuses their thread. A different channel prefix is a different person. Do not put emails or phone numbers inPatchwork-Subject if you can avoid it. Use the channel’s stable user id.