@segmentstream/ontology 0.139.0 → 0.139.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.139.1
4
+
5
+ A WhatsApp message Meta accepts and later reports it could not deliver, in a `failed` delivery
6
+ status, now reads `failed`: a replay of its idempotency key fails with `keyConsumed` and the
7
+ `refusal` Meta's code names, and the chat's history shows the message failed. The platform reads
8
+ these statuses; this release shares the ontology's WhatsApp refusal codes with it.
9
+
3
10
  ## 0.139.0
4
11
 
5
12
  The inbox takes `attribution`: `inbox: { roles: [client], attribution: "none" }` sends a member's
package/README.md CHANGED
@@ -1585,8 +1585,9 @@ renders it. The body is at most 4096 characters, and `reply_to` is refused. Meta
1585
1585
  free-form text only inside the 24-hour customer-service window: a post outside it fails with
1586
1586
  Meta's code 131047 and consumes the key. Any Meta refusal with an error code does the same; a
1587
1587
  timeout, a 5xx or an answer naming no message is `uncertain`. The receipt's `message_id` is the
1588
- `wamid…` Meta accepted; it has no URL, and a failure Meta reports later in delivery statuses does
1589
- not change it.
1588
+ `wamid…` Meta accepted; it has no URL. A failure Meta reports later in delivery statuses makes the
1589
+ receipt read `failed`: a replay of the key then fails with `keyConsumed` and the `refusal` Meta's
1590
+ code names.
1590
1591
 
1591
1592
  `chat` names the agent's channels as its `channels` does. A channel not named after its kind,
1592
1593
  such as a second number, says its kind: `chat: { sales_whatsapp: { kind: "whatsapp", connection:
@@ -0,0 +1,10 @@
1
+ import type { ChatRefusal } from "./provider.js";
2
+ /**
3
+ * Meta's refusals that code acts on: 131047, the person last wrote more than 24 hours ago, so only a
4
+ * template reaches them; 131026, the message cannot be delivered to the number; 131050, the person
5
+ * stopped marketing messages. Meta answers them when it refuses a message, or reports them later in
6
+ * a `failed` delivery status of a message it accepted.
7
+ */
8
+ export declare const REFUSALS: Readonly<Record<number, ChatRefusal>>;
9
+ /** The id Meta gives an accepted message, which its delivery statuses name. */
10
+ export declare const WAMID: RegExp;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Meta's refusals that code acts on: 131047, the person last wrote more than 24 hours ago, so only a
3
+ * template reaches them; 131026, the message cannot be delivered to the number; 131050, the person
4
+ * stopped marketing messages. Meta answers them when it refuses a message, or reports them later in
5
+ * a `failed` delivery status of a message it accepted.
6
+ */
7
+ export const REFUSALS = {
8
+ 131047: "outside_reply_window",
9
+ 131026: "recipient_unreachable",
10
+ 131050: "recipient_opted_out",
11
+ };
12
+ /** The id Meta gives an accepted message, which its delivery statuses name. */
13
+ export const WAMID = /^wamid\.[A-Za-z0-9+/=_-]{1,512}$/;
@@ -1,21 +1,10 @@
1
1
  import { Effect } from "effect";
2
2
  import { renderWhatsApp, WHATSAPP_MESSAGE_LIMIT } from "../../../whatsapp.js";
3
3
  import { whatsappTemplate } from "./whatsapp-template.js";
4
+ import { REFUSALS, WAMID } from "./whatsapp-refusals.js";
4
5
  import { record, transportFailure, } from "./provider.js";
5
6
  /** A WhatsApp id: the member's number, digits only. */
6
7
  const WA_ID = /^[1-9][0-9]{5,19}$/;
7
- /**
8
- * Meta's refusals that code acts on: 131047, the person last wrote more than 24 hours ago, so only a
9
- * template reaches them; 131026, the message cannot be delivered to the number; 131050, the person
10
- * stopped marketing messages.
11
- */
12
- const REFUSALS = {
13
- 131047: "outside_reply_window",
14
- 131026: "recipient_unreachable",
15
- 131050: "recipient_opted_out",
16
- };
17
- /** The id Meta gives an accepted message. */
18
- const WAMID = /^wamid\.[A-Za-z0-9+/=_-]{1,512}$/;
19
8
  /**
20
9
  * One text message from the workspace's number, `POST /phone/messages` on the connection's
21
10
  * `graph` API, never retried. A Graph refusal with an error code, such as 131047 outside the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@segmentstream/ontology",
3
- "version": "0.139.0",
3
+ "version": "0.139.1",
4
4
  "description": "Define a SegmentStream workspace app's ontology: entities, relationships, roles and actions, written with Effect.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "SegmentStream",