@wats/graph 0.3.3 → 0.3.5
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
CHANGED
|
@@ -1,3 +1,34 @@
|
|
|
1
1
|
# @wats/graph
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Graph client, transport seam, endpoint callables, typed Graph errors, pagination helpers, MockTransport, and WhatsApp endpoint-family helpers.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun add @wats/graph
|
|
9
|
+
npm i @wats/graph
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { GraphClient, createFetchTransport, sendMessage } from "@wats/graph";
|
|
16
|
+
|
|
17
|
+
const graph = new GraphClient({
|
|
18
|
+
accessToken: process.env.WATS_ACCESS_TOKEN ?? "",
|
|
19
|
+
apiVersion: "v25.0",
|
|
20
|
+
transport: createFetchTransport()
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
await sendMessage(graph, { phoneNumberId: "1234567890" }, {
|
|
24
|
+
messaging_product: "whatsapp",
|
|
25
|
+
to: "15551234567",
|
|
26
|
+
type: "text",
|
|
27
|
+
text: { body: "Hello from WATS" }
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Use `createMockTransport` from `@wats/graph/testing` for credential-free tests and examples. Some endpoint families are still expanding and should be treated according to the API stability policy.
|
|
32
|
+
|
|
33
|
+
Docs: https://github.com/Switchbord/wats
|
|
34
|
+
License: MIT
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @experimental Calling endpoint helpers may change in 0.x minors while live calling parity expands.
|
|
3
|
+
*/
|
|
1
4
|
import { type EndpointInvokeOptions } from "../endpoint.js";
|
|
2
5
|
import type { GraphClient } from "../client.js";
|
|
3
6
|
export type CallAction = "connect" | "pre_accept" | "accept" | "reject" | "terminate";
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @experimental Flow DSL and data-channel helpers may change in 0.x minors while WATS expands Flow parity.
|
|
3
|
+
*/
|
|
1
4
|
export { FLOW_JSON_MAX_ARRAY_LENGTH, FLOW_JSON_MAX_BYTES, FLOW_JSON_MAX_COMPONENTS, FLOW_JSON_MAX_DEPTH, FLOW_JSON_MAX_SCREENS, FLOW_JSON_MAX_STRING_LENGTH, FLOW_MAX_CATEGORIES, buildFlowCloseResponse, buildFlowErrorResponse, buildFlowJson, buildFlowScreenResponse, createFlow, deleteFlow, deprecateFlow, getFlow, getFlowAssets, listFlows, publishFlow, updateFlowJson, updateFlowMetadata, validateFlowJson } from "./flows/index.js";
|
|
2
5
|
export type { CreateFlowBody, FlowAssetDetails, FlowAssetsResponse, FlowCategory, FlowCloseResponse, FlowCloseResponseInput, FlowDetails, FlowErrorResponse, FlowErrorResponseInput, FlowJson, FlowListResponse, FlowMutationResponse, FlowScreenResponse, FlowScreenResponseInput, FlowStatus, GetFlowAssetsInput, GetFlowInput, GraphPaging, ListFlowsInput, UpdateFlowJsonBody, UpdateFlowMetadataBody } from "./flows/index.js";
|
|
@@ -2,5 +2,8 @@ export { listPhoneNumbers } from "./waba/index.js";
|
|
|
2
2
|
export type { GraphPaging, PhoneNumberListEntry, PhoneNumberListResponse } from "./waba/index.js";
|
|
3
3
|
export { buildCreateMessageTemplateBody, buildUpdateMessageTemplateBody, buildTemplateBodyComponent, buildTemplateButtonComponent, buildTemplateFooterComponent, buildTemplateHeaderComponent, createMessageTemplate, deleteMessageTemplate, getMessageTemplate, listMessageTemplates, updateMessageTemplate, listTemplateGroups, createTemplateGroup, getTemplateGroup, updateTemplateGroup, deleteTemplateGroup, getTemplateGroupAnalytics, validateTemplateParameterCounts } from "./templates/index.js";
|
|
4
4
|
export type { CreateMessageTemplateBody, DeleteMessageTemplateInput, GetMessageTemplateInput, ListMessageTemplatesInput, ListTemplateGroupsInput, SendTemplateComponentForValidation, TemplateBodyComponentInput, TemplateButtonInput, TemplateButtonsComponentInput, TemplateButtonType, TemplateCategory, TemplateComponent, TemplateDefinitionForValidation, TemplateDetails, TemplateGroupAnalyticsInput, TemplateGroupAnalyticsPoint, TemplateGroupAnalyticsResponse, TemplateGroupBody, TemplateGroupDetails, TemplateGroupListResponse, TemplateGroupMutationResponse, TemplateFooterComponentInput, TemplateHeaderComponentInput, TemplateHeaderFormat, TemplateLanguageCode, TemplateListResponse, TemplateMutationResponse, TemplateOtpType, TemplateParameterFormat, TemplateQualityScore, TemplateStatus, TemplateSupportedAppInput, UpdateMessageTemplateBody, CreateTemplateGroupBody, DeleteTemplateGroupInput, GetTemplateGroupInput, UpdateTemplateGroupBody } from "./templates/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* @experimental Flow DSL and data-channel helpers may change in 0.x minors while WATS expands Flow parity.
|
|
7
|
+
*/
|
|
5
8
|
export { FLOW_JSON_MAX_ARRAY_LENGTH, FLOW_JSON_MAX_BYTES, FLOW_JSON_MAX_COMPONENTS, FLOW_JSON_MAX_DEPTH, FLOW_JSON_MAX_SCREENS, FLOW_JSON_MAX_STRING_LENGTH, FLOW_MAX_CATEGORIES, buildFlowCloseResponse, buildFlowErrorResponse, buildFlowJson, buildFlowScreenResponse, createFlow, deleteFlow, deprecateFlow, getFlow, getFlowAssets, listFlows, publishFlow, updateFlowJson, updateFlowMetadata, validateFlowJson } from "./flows/index.js";
|
|
6
9
|
export type { CreateFlowBody, FlowAssetDetails, FlowAssetsResponse, FlowCategory, FlowCloseResponse, FlowCloseResponseInput, FlowDetails, FlowErrorResponse, FlowErrorResponseInput, FlowJson, FlowListResponse, FlowMutationResponse, FlowScreenResponse, FlowScreenResponseInput, FlowStatus, GetFlowAssetsInput, GetFlowInput, ListFlowsInput, UpdateFlowJsonBody, UpdateFlowMetadataBody } from "./flows/index.js";
|