跳转到内容
EN

Send a letter to a person or an agent

Code Mode: praxis.organization.notifications.letters.create

HTTP: POST /organization/v1/notifications/letters

Write one letter to a member or an agent of this organization, for an automation script or an outside caller that needs to reach someone, or to leave itself an alarm: a letter to your own address is allowed and arrives at its deliver_at. The sender is the credential’s own and is never a request field — a person writes as themselves, an agent as itself, and an automation run (a scheduled or service-started one included) as the platform’s automation sender with the run recorded in the letter’s source; a sender in the body is ignored. Any other credential (an organization API key, an application) has no address to write from and is refused with 403. The recipient must belong to this organization: a person or agent of another organization answers 404 without saying whether it exists. A letter to a person needs a summary of at most 60 characters — one sentence saying what the reader must do or know; a longer one is refused, never cut. An agent’s letter may leave summary out and the first line of body stands in. Repeating the same letter (same recipient, kind, thread, body and time) returns the same id and writes it once. Usage charge: none.

签名

praxis.organization.notifications.letters.create(args:{body:{/** The recipient's address: human:<user id> or agent:<agent id>, a member or an agent of this organization. pattern: ^(human|agent):[^\s:]+$ e.g. "human:usr_8a21c4" */ to:string;/** The whole letter, 1 to 16000 characters. */ body:string;/** One sentence saying what the reader is asked to do or needs to know, at most 60 characters. */ summary?:string;/** The letter's kind; it decides the channels. e.g. "mention" */ kind?:"notice"|"mention"|"decision";/** The conversation the letter belongs to, free text; omit for none. */ thread?:string;/** When to deliver it, ISO 8601, at most 366 days ahead. e.g. "2026-12-03T09:00:00+08:00" */ deliver_at?:string}}):Promise<{/** The letter that was written: its id and the time it is delivered. */ letter:{/** The letter's id. */ id:string;/** When it is delivered: now, or the time asked for. */ deliverAt:string}}>;

请求体

必填内容类型说明
是application/json

响应

状态码内容类型说明
200application/jsonThe letter is written; it is delivered at deliverAt.
400`to` is not an address, `body` is missing or too long, `summary` is missing for a person or longer than 60 characters, `kind` is unknown, or `deliver_at` is not an ISO 8601 time within 366 days (RFC 9457 problem).
401Missing or invalid credential (RFC 9457 problem).
403`PERMISSION_DENIED`: sending a letter needs a person, an agent or an automation run identity; an organization API key or an application cannot send (RFC 9457 problem).
404`SUBSCRIBER_NOT_FOUND`: the recipient is not a member or an agent of this organization (RFC 9457 problem).
502The notification service did not answer, or failed in a way it did not classify (RFC 9457 problem, `UNAVAILABLE`). A refusal the service classifies is never a 502 — it reaches the caller in its own class (400, 403, 404), so a client may act on it.