@messagebird/sdk 0.30.0 → 0.31.0
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/README.md +16 -0
- package/dist/index.d.mts +516 -31
- package/dist/index.mjs +392 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,6 +78,22 @@ for await (const message of bird.whatsapp.list()) {
|
|
|
78
78
|
const { data } = await bird.whatsapp.listEvents(messageId); // full lifecycle timeline, not paginated
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
+
## Lookup
|
|
82
|
+
|
|
83
|
+
Every answer is billed. A phone number lookup bills once for the base answer plus once per **delivered** property; an email lookup bills once per answered address. Nothing is billed for a failed lookup, and nothing is billed for a property that came back unanswered, so read `status` before you read a value.
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
const number = await bird.lookup.phoneNumber({ phone_number, type: ["score"] });
|
|
87
|
+
number.country_code; // base answer: always present, always billed
|
|
88
|
+
if (number.score?.status === "ok") number.score.value; // only `ok` carries a value, and only `ok` is billed
|
|
89
|
+
|
|
90
|
+
const address = await bird.lookup.email({ email });
|
|
91
|
+
address.result; // valid | neutral | risky | undeliverable | typo: an open vocabulary
|
|
92
|
+
address.delivery_confidence; // 0-100, always present: the safe fallback for a verdict you don't know
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Pass an `Idempotency-Key` so a retry replays the stored answer instead of buying a second one.
|
|
96
|
+
|
|
81
97
|
## Webhooks
|
|
82
98
|
|
|
83
99
|
`unwrap` verifies a delivery's Standard Webhooks signature and returns a typed, discriminated event. **Pass the raw request body** — never the parsed JSON. Set the signing secret once via `webhooks: { secret }` on the client (or pass `{ secret }` per call).
|