Take over a text trigger
const url = 'https://example.com/v1/text-triggers/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/owner';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"runAsServiceAccountId":"example","runAsProject":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/text-triggers/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/owner \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "runAsServiceAccountId": "example", "runAsProject": true }'The only way a text trigger’s owner changes. The caller becomes it, so its runs act as the caller, with the caller’s connections, from the next text. Needs admin on the trigger’s project and execute on its target. Name runAsServiceAccountId instead to make a service account the owner: that needs act_as on the account, and the account must itself hold what its target needs. With an authorization store, that’s checked when the account is named: an account that can’t is refused (409 trigger-owner-cannot-run-target). Or name runAsProject: true to make the project’s own service account the owner, made the first time with the editor role on the project. It runs only what the project’s editors can, and is checked the same way. The trigger keeps its connection and its toolsAllowedUnattended; a body naming the list is refused (change it with PATCH).
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Request Body
Section titled “Request Body”Who the trigger’s runs act as from now: for a trigger whose owner left, or to make one shared or personal. Absent, or an empty body: the caller takes it over (today’s behaviour). With runAsServiceAccountId: that service account becomes the owner. With runAsProject: the project’s own account does. A take-over keeps the trigger’s toolsAllowedUnattended: change that with PATCH.
object
Examplegenerated
{ "runAsServiceAccountId": "example", "runAsProject": true}Responses
Section titled “Responses”The trigger, with its new owner.
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
Example
{ "owner": { "kind": "user", "isProjectAccount": true }, "status": "active"}bad-input: a body naming toolsAllowedUnattended, or runAsProject with runAsServiceAccountId.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}No text trigger with that id, or no such service account.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}runAsServiceAccountId names an unregistered account (service-account-unregistered), a project’s own account (service-account-project-owned: name it with runAsProject), or one that can’t run what the trigger runs (trigger-owner-cannot-run-target). Or, with runAsProject, the project’s own account can’t run what the trigger runs either (trigger-owner-cannot-run-target; the account stays, for the next runAsProject), or an active account someone made already has the project account’s name, project-<projectId> (service-account-name-taken: a tenant admin can unregister it). Or the Idempotency-Key was reused with a different body, or a resource-state conflict. 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
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
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
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Server error (unmapped domain code or framework crash).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}trigger-operation-unsupported: this deployment can’t change a trigger’s owner, or can’t make a project’s own account (runAsProject).
object
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
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”See also
GET /v1/text-triggers/{triggerId}: Fetch a text triggerPATCH /v1/text-triggers/{triggerId}: Update a text triggerPOST /v1/text-triggers/{triggerId}/pause: Pause a text triggerPOST /v1/text-triggers/{triggerId}/resume: Resume a text trigger- Error code
authz-backend-unavailable - Error code
bad-input - Error code
database-busy - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
rate-limit-exceeded - Error code
request-too-large - Error code
service-account-name-taken - Error code
service-account-project-owned - Error code
service-account-unregistered - Error code
tenant-state-unavailable - Error code
trigger-operation-unsupported - Error code
trigger-owner-cannot-run-target - Every error code