Update a text trigger
const url = 'https://example.com/v1/text-triggers/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"flowId":"example","flowVersion":"example","agentId":"example","agentVersion":"example","config":{"connectionId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","runsPerHour":1,"perSenderPerHour":1},"label":"example","toolsAllowedUnattended":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://example.com/v1/text-triggers/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0 \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "flowId": "example", "flowVersion": "example", "agentId": "example", "agentVersion": "example", "config": { "connectionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "runsPerHour": 1, "perSenderPerHour": 1 }, "label": "example", "toolsAllowedUnattended": [ "example" ] }'Changes what it runs (which needs execute on the new target, and must be the project’s to reach), its connection, pace or label (null clears it). Another connection is checked as at registration, and one another live text trigger answers is 409 trigger-connection-taken. The number is the company’s, so every change takes admin on the project. No edit moves the owner: a project admin’s change to a person’s trigger keeps its owner, so its runs go on acting as that person, and it’s audited as trigger-changed-for-owner, naming the trigger’s version after it. Since no edit moves the owner, with an authorization store a new target (another flow or agent) must be one the owner can run, a person or a service account, else 409 trigger-owner-cannot-run-target; that’s not checked for an owner that was unregistered or removed. toolsAllowedUnattended replaces the list ([] clears it; absent keeps it, a new version too), never names kindgi_send_text, and a new target or connection while it lists any must name it again.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”TriggerId — the trigger id (a UUID).
Header Parameters
Section titled “Header Parameters”Caller-supplied idempotency key, scoped to the caller: the same key from someone else in the workspace is their own request (from 0.1.5). Retries with the same key return the original response byte-identical (per docs/API-ROUTE-CONVENTIONS.md §3.1). A retry sent while the first request still runs is answered 409 idempotency-key-in-flight with Retry-After, on a runtime whose store holds keys (from 0.1.5); retry after it, and you get the first request’s answer. An answer that carries a secret (a new API key or public run token, a session token, a generated signing secret) isn’t kept: a retry gets 409 idempotency-key-replay-withheld, with the first request’s status and when it succeeded (from 0.1.5). A request whose key store can’t be read before it runs is answered 503 idempotency-store-unavailable with Retry-After: nothing ran, so retry with the same key (from 0.3.0).
Request Bodyrequired
Section titled “Request Bodyrequired”Change what it runs (the target fields, as at registration, which also needs execute on the new target), its connection, pace or label. Every change takes admin on the trigger’s project. The owner stays.
object
Run a flow (with flowVersion).
Run an agent (instead of a flow): at agentVersion, else its pinned version.
A text trigger’s connection or pace, to change. An absent field keeps its value.
object
The connection the texts come in on: one of the project’s company connections of app texts (GET /v1/connection-choices/candidates), one per business number. A person’s own connection is 400 bad-input, and any other 404 connection-not-found. One live text trigger answers a connection: another on it is 409 trigger-connection-taken, which names that trigger (details.heldBy).
The most runs its texts start in an hour (default 60). Past it, a text’s fire is refused (detail starts over-limit:), and that text doesn’t run later.
The most runs one sender’s texts start in an hour (default 10). Past it, a text’s fire is refused (detail starts over-limit:), and that text doesn’t run later.
Replaces the list ([] clears it; absent keeps it). Never kindgi_send_text (400). A new target (not just a version) or another connection while it lists any must name it again, as it is or []. Each tool by its id, with no wildcard or pattern, and only tools this trigger’s flow or agent calls. It lifts only that wait: the workspace’s approval rules, the agent’s own rules, the permission check (as the trigger’s owner) and the tool’s own limits all still apply.
Examplegenerated
{ "flowId": "example", "flowVersion": "example", "agentId": "example", "agentVersion": "example", "config": { "connectionId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "runsPerHour": 1, "perSenderPerHour": 1 }, "label": "example", "toolsAllowedUnattended": [ "example" ]}Responses
Section titled “Responses”Updated text trigger.
A text trigger: each text (SMS or WhatsApp) to its business number starts a run of its agent or flow, with the text as the run’s input, as its owner. A flow’s input is { text, thread }: text is { from, channel, body, receivedAt } (channel sms or whatsapp), and thread is { connectionId, channel, sender }. In such a run, every call that changes something, except handing the conversation to a person (kindgi_hand_to_person), waits for a person’s yes unless the trigger lists it (toolsAllowedUnattended); a text that isn’t a reply always waits.
object
Run a flow (with flowVersion).
Run an agent (instead of a flow): at agentVersion, else its pinned version.
The trigger’s project: its runs are this project’s.
Who its runs act as, with their connections. A service account owns a shared trigger: one named with runAsServiceAccountId, or the project’s own (runAsProject, isProjectAccount). Registered without either, the caller owns it. No edit moves it; only a take-over (POST /v1/text-triggers/{triggerId}/owner) does.
object
The owner’s name at the time of the response: the person’s display name, or the service account’s name. Absent when it can’t be read (no directory, a removed account) and from a runtime before Kindgi 0.1.6: show the id then.
Set when the owner is the trigger’s project’s own service account (runAsProject): the trigger is shared, and runs as the project. Show it as “This project”. Absent otherwise.
The connection the texts come in on: one of the project’s company connections of app texts (GET /v1/connection-choices/candidates), one per business number. A person’s own connection is 400 bad-input, and any other 404 connection-not-found. One live text trigger answers a connection: another on it is 409 trigger-connection-taken, which names that trigger (details.heldBy).
The most runs its texts start in an hour (default 60). Past it, a text’s fire is refused (detail starts over-limit:), and that text doesn’t run later.
The most runs one sender’s texts start in an hour (default 10). Past it, a text’s fire is refused (detail starts over-limit:), and that text doesn’t run later.
Lifecycle status. Only active triggers fire. Tombstoned rows are excluded from every read path.
Why it isn’t answering as it should: connection-missing (its connection is gone or lapsed; it answers again once it’s back), owner-refused (its owner was removed or may no longer run the target; its texts are refused until that changes or an admin takes it over), or why the runtime paused it.
The trigger’s newest version (GET /v1/text-triggers/{triggerId}/versions): one more for each change to what it runs, as whom, or on which number at what pace. Absent until its first version.
The tools whose calls in this trigger’s runs don’t wait for a person’s yes, though a run a text started asks for one for every call that changes something, except handing the conversation to a person (kindgi_hand_to_person). Never kindgi_send_text. Absent: none. Each tool by its id, with no wildcard or pattern, and only tools this trigger’s flow or agent calls. It lifts only that wait: the workspace’s approval rules, the agent’s own rules, the permission check (as the trigger’s owner) and the tool’s own limits all still apply.
When the text trigger was removed: only on a removed one, which a read answers when it asks (?includeUnregistered=true). status is the one it had then.
Example
{ "owner": { "kind": "user", "isProjectAccount": true }, "status": "active"}A body that fails validation (bad-input): runAsServiceAccountId or runAsProject (the owner changes only by POST /v1/text-triggers/{triggerId}/owner), a limit out of its range, a connectionId naming a person’s own live connection of the app, kindgi_send_text in toolsAllowedUnattended, or a new target or connection without the list it holds. Or reference-out-of-scope: the new target isn’t the project’s to reach. Nothing changes.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}No text trigger with that id. Or the new connectionId isn’t one of the project’s company connections of app texts (connection-not-found, details.field config.connectionId).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Another live text trigger answers the new connection (trigger-connection-taken: details.heldBy is its id, and can name a trigger in another project of the workspace). Or a new target the trigger’s owner can’t run (trigger-owner-cannot-run-target), with an authorization store. Or an Idempotency-Key reused with a different body. Or idempotency-key-in-flight (with Retry-After): a request with the same Idempotency-Key still runs, so this one wasn’t run; send it again after Retry-After to get that request’s answer.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}rate-limit-exceeded with details.limit: "api-requests", on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; Retry-After says when to send it again.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
Server error (unmapped domain code or framework crash).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The Idempotency-Key store (idempotency-store-unavailable) or the authorization store (authz-backend-unavailable) couldn’t be reached before the request ran, or the database was too busy for its authorization check (database-busy), so nothing was changed; Retry-After (whole seconds) says when to try again with the same key. Or tenant-state-unavailable (with Retry-After), on a runtime serving many workspaces: the workspace’s state couldn’t be read, so nothing was changed.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
See also
GET /v1/text-triggers/{triggerId}: Fetch a text triggerPOST /v1/text-triggers/{triggerId}/pause: Pause a text triggerPOST /v1/text-triggers/{triggerId}/resume: Resume a text triggerPOST /v1/text-triggers/{triggerId}/unregister: Soft-delete a text trigger (tombstone)- Error code
authz-backend-unavailable - Error code
bad-input - Error code
connection-not-found - Error code
database-busy - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
rate-limit-exceeded - Error code
reference-out-of-scope - Error code
request-too-large - Error code
tenant-state-unavailable - Error code
trigger-connection-taken - Error code
trigger-owner-cannot-run-target - Every error code