client.text_triggers
client.text_triggers — the textTriggers operations.
On AsyncKindgi every method is the same, awaited.
client.text_triggers.list()
Section titled “client.text_triggers.list()”list( *, limit: int | None = None, cursor: str | None = None, status: Literal['active', 'paused'] | None = None, include_unregistered: bool | None = None, project_id: str | UUID | None = None, timeout: float | None = None,) -> TextTriggerCollectionPageList text triggers. GET /v1/text-triggers
The workspace's text triggers whose project the caller may read; with projectId, that project's only (which needs read on it). Removed text triggers only with ?includeUnregistered=true, each with unregisteredAt, and ?status= matches the status a removed one had.
client.text_triggers.register()
Section titled “client.text_triggers.register()”register( body: RegisterTextTriggerBody | Mapping[str, Any] | None = None, /, *, idempotency_key: str | None = None, timeout: float | None = None, **fields: Any,) -> TextTriggerRecordRegister a text trigger. POST /v1/text-triggers
Each text (SMS or WhatsApp) to the business number starts a run of the trigger's agent or flow, with the text as the run's input, as the trigger's owner. A flow's input is { text, thread }: text is { from, channel, body, receivedAt } (channel sms or whatsapp), and thread is { connectionId, channel, sender }. config.connectionId names the number: one of the project's company connections of app texts (GET /v1/connection-choices/candidates). One live text trigger answers a connection, so another on it is 409 trigger-connection-taken. The number is the company's: registering needs admin on the project, and execute on what it runs. runAsServiceAccountId makes it shared, owned by that service account (which needs act_as on it), and runAsProject makes it shared, owned by the project's own account (made the first time, with the editor role on the project). A trigger that names no projectId goes in the workspace's default project. In its runs, every call that changes something, except handing the conversation to a person (kindgi_hand_to_person), waits for a person's yes, unless toolsAllowedUnattended names it: naming it takes admin on the project, each id must be a tool the target calls, it never names kindgi_send_text, and it's audited (trigger-tools-allowed-unattended-set).
client.text_triggers.get()
Section titled “client.text_triggers.get()”get( trigger_id: str | UUID, /, *, include_unregistered: bool | None = None, timeout: float | None = None,) -> TextTriggerRecordFetch a text trigger. GET /v1/text-triggers/{triggerId}
client.text_triggers.update()
Section titled “client.text_triggers.update()”update( trigger_id: str | UUID, body: PatchTextTriggerBody | Mapping[str, Any] | None = None, /, *, idempotency_key: str | None = None, timeout: float | None = None, **fields: Any,) -> TextTriggerRecordUpdate a text trigger. PATCH /v1/text-triggers/{triggerId}
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.
client.text_triggers.pause()
Section titled “client.text_triggers.pause()”pause( trigger_id: str | UUID, /, *, idempotency_key: str | None = None, timeout: float | None = None,) -> TextTriggerRecordPause a text trigger. POST /v1/text-triggers/{triggerId}/pause
A paused trigger answers no texts: one that comes in while it's paused never starts a run. It still holds its connection. A personal trigger's pause is its owner's or a project admin's; a shared one's needs write on the project.
client.text_triggers.resume()
Section titled “client.text_triggers.resume()”resume( trigger_id: str | UUID, /, *, idempotency_key: str | None = None, timeout: float | None = None,) -> TextTriggerRecordResume a text trigger. POST /v1/text-triggers/{triggerId}/resume
It answers the texts that come in from now on, on the connection it kept while paused. Who may resume it is as for a pause.
client.text_triggers.unregister()
Section titled “client.text_triggers.unregister()”unregister( trigger_id: str | UUID, /, *, idempotency_key: str | None = None, timeout: float | None = None,) -> WebhookTriggerUnregisterResultSoft-delete a text trigger (tombstone). POST /v1/text-triggers/{triggerId}/unregister
Who may unregister it is as for a pause. Its connection is free for another text trigger. Its record, versions and fires stay, readable with ?includeUnregistered=true (one version with no flag), until the workspace is purged.
client.text_triggers.fires()
Section titled “client.text_triggers.fires()”fires( trigger_id: str | UUID, /, *, include_unregistered: bool | None = None, limit: int | None = None, cursor: str | None = None, timeout: float | None = None,) -> TextFirePageA text trigger's texts. GET /v1/text-triggers/{triggerId}/fires
Newest first: each text the trigger was given and what came of it (TextFire): the run it started, or why it was skipped, refused or failed.
client.text_triggers.list_versions()
Section titled “client.text_triggers.list_versions()”list_versions( trigger_id: str | UUID, /, *, include_unregistered: bool | None = None, limit: int | None = None, cursor: str | None = None, timeout: float | None = None,) -> TextTriggerVersionPageA text trigger's versions. GET /v1/text-triggers/{triggerId}/versions
Newest first: each version of the text trigger, what it was from createdAt on, who made it (createdBy) and why (cause). Registering makes version 1, and each change makes the next (a PATCH that alters it, or a take-over to another owner): a PATCH that changes nothing makes none, nor do pausing, resuming or deleting. A version never changes once made. A text's run uses the newest when it starts, and keeps it whatever later edits make (the run's trigger.version). Whoever can read the text trigger can read its versions. A removed text trigger's versions stay: ?includeUnregistered=true lists them, each with unregisteredAt.
client.text_triggers.get_version()
Section titled “client.text_triggers.get_version()”get_version( trigger_id: str | UUID, version: int, /, *, timeout: float | None = None,) -> TextTriggerVersionFetch one version of a text trigger. GET /v1/text-triggers/{triggerId}/versions/{version}
A removed text trigger's too, with no flag, carrying unregisteredAt: a run keeps the version it started from (its trigger.version), whatever became of the text trigger since. Reading it takes what reading the text trigger does.
client.text_triggers.take_ownership()
Section titled “client.text_triggers.take_ownership()”take_ownership( trigger_id: str | UUID, body: TakeTriggerOwnerBody | Mapping[str, Any] | None = None, /, *, idempotency_key: str | None = None, timeout: float | None = None, **fields: Any,) -> TextTriggerRecordTake over a text trigger. POST /v1/text-triggers/{triggerId}/owner
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).