@usenadia/node 0.1.0 → 0.1.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/README.md +85 -9
- package/dist/index.d.mts +116 -5
- package/dist/index.d.ts +116 -5
- package/dist/index.js +85 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +82 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -8
package/README.md
CHANGED
|
@@ -7,33 +7,44 @@ manage channels, and drive the Instagram comment/story → DM machinery.
|
|
|
7
7
|
pnpm add @usenadia/node
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
+
<!-- smoke:start -->
|
|
10
11
|
```ts
|
|
11
12
|
import { Nadia, NadiaError } from '@usenadia/node';
|
|
12
13
|
|
|
13
|
-
const nadia = new Nadia(process.env.
|
|
14
|
+
const nadia = new Nadia(process.env.NADIA_API_KEY ?? '');
|
|
14
15
|
|
|
15
16
|
const channels = await nadia.integrations();
|
|
17
|
+
const instagram = channels.find((c) => c.identifier === 'instagram-standalone');
|
|
18
|
+
if (!instagram) throw new Error('Connect an Instagram account first.');
|
|
16
19
|
|
|
17
20
|
try {
|
|
18
|
-
await nadia.post({
|
|
19
|
-
type: 'schedule'
|
|
20
|
-
date: '
|
|
21
|
+
const [{ postId }] = await nadia.post({
|
|
22
|
+
type: 'draft', // or 'schedule' / 'now'
|
|
23
|
+
date: '2030-01-15T09:00:00.000Z',
|
|
21
24
|
shortLink: false,
|
|
22
25
|
tags: [],
|
|
23
26
|
posts: [
|
|
24
27
|
{
|
|
25
|
-
integration: { id:
|
|
28
|
+
integration: { id: instagram.id },
|
|
26
29
|
value: [{ content: 'Hello from the SDK', image: [] }],
|
|
27
|
-
settings
|
|
30
|
+
// Each network has its own settings; Instagram wants `post_type`.
|
|
31
|
+
settings: { __type: 'instagram-standalone', post_type: 'post' },
|
|
28
32
|
},
|
|
29
33
|
],
|
|
30
34
|
});
|
|
35
|
+
|
|
36
|
+
await nadia.deletePost(postId);
|
|
31
37
|
} catch (err) {
|
|
32
38
|
if (err instanceof NadiaError) {
|
|
33
39
|
console.error(err.status, err.message); // 402 "You have reached your limit"
|
|
34
40
|
}
|
|
41
|
+
throw err;
|
|
35
42
|
}
|
|
36
43
|
```
|
|
44
|
+
<!-- smoke:end -->
|
|
45
|
+
|
|
46
|
+
This block is run as is against the real API by the smoke test
|
|
47
|
+
(`test/smoke.test.mjs`): if it stops working, the release stops.
|
|
37
48
|
|
|
38
49
|
## The content board
|
|
39
50
|
|
|
@@ -88,10 +99,58 @@ await nadia.request((o) =>
|
|
|
88
99
|
);
|
|
89
100
|
```
|
|
90
101
|
|
|
102
|
+
## Webhooks
|
|
103
|
+
|
|
104
|
+
UseNadia signs every delivery: `X-Nadia-Signature: sha256=<hex>`, an
|
|
105
|
+
HMAC-SHA256 of `` `${X-Nadia-Timestamp}.${raw body}` `` with the secret
|
|
106
|
+
returned when the webhook was created. `parseWebhook` checks it (in constant
|
|
107
|
+
time), refuses a timestamp more than 5 minutes off, and returns the parsed
|
|
108
|
+
delivery — or throws a `NadiaWebhookError` whose `reason` says why
|
|
109
|
+
(`missing_header`, `bad_signature`, `stale`, `bad_body`).
|
|
110
|
+
|
|
111
|
+
**Read the raw body.** A body parsed then re-serialized is not byte-identical
|
|
112
|
+
and will not verify.
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
import express from 'express';
|
|
116
|
+
import { parseWebhook, NadiaWebhookError } from '@usenadia/node';
|
|
117
|
+
|
|
118
|
+
const app = express();
|
|
119
|
+
|
|
120
|
+
app.post('/nadia', express.raw({ type: 'application/json' }), (req, res) => {
|
|
121
|
+
try {
|
|
122
|
+
const delivery = parseWebhook({
|
|
123
|
+
secret: process.env.NADIA_WEBHOOK_SECRET!,
|
|
124
|
+
headers: req.headers,
|
|
125
|
+
body: req.body, // a Buffer, thanks to express.raw()
|
|
126
|
+
});
|
|
127
|
+
if (delivery.event === 'post.published') {
|
|
128
|
+
// delivery.data …
|
|
129
|
+
}
|
|
130
|
+
res.sendStatus(200);
|
|
131
|
+
} catch (err) {
|
|
132
|
+
if (err instanceof NadiaWebhookError) return res.status(400).send(err.reason);
|
|
133
|
+
throw err;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Fastify: register a `content-type` parser with `{ parseAs: 'buffer' }` and
|
|
139
|
+
pass `request.headers` and the buffer the same way. With the Fetch API
|
|
140
|
+
(Next.js route handlers, Hono, Workers with `nodejs_compat`):
|
|
141
|
+
`parseWebhook({ secret, headers: request.headers, body: await request.text() })`.
|
|
142
|
+
|
|
143
|
+
`verifyWebhookSignature({ secret, signature, timestamp, body, tolerance? })`
|
|
144
|
+
is the primitive underneath: it returns a boolean and checks the timestamp
|
|
145
|
+
only when `tolerance` (seconds) is given. Both are tested against the
|
|
146
|
+
fixture the server signs with
|
|
147
|
+
(`libraries/nestjs-libraries/src/database/prisma/webhooks/__fixtures__/signed-delivery.json`).
|
|
148
|
+
|
|
91
149
|
## Errors
|
|
92
150
|
|
|
93
151
|
Every response with a status ≥ 400 throws a `NadiaError` carrying `status`,
|
|
94
|
-
`body` and the API's `msg
|
|
152
|
+
`body` and the API's message (`msg`, or the list of fields a validation
|
|
153
|
+
error names). `err.isTransient` is true for 429 and 5xx — those
|
|
95
154
|
are retried automatically (twice by default, `new Nadia(key, { retries: 0 })`
|
|
96
155
|
to turn it off).
|
|
97
156
|
|
|
@@ -109,12 +168,29 @@ both fixes:
|
|
|
109
168
|
|
|
110
169
|
The default base URL is `https://app.usenadia.com/api`.
|
|
111
170
|
|
|
112
|
-
## Regenerating
|
|
171
|
+
## Regenerating and testing
|
|
113
172
|
|
|
114
173
|
```bash
|
|
115
174
|
pnpm run generate # from apps/sdk/node — reads ../../../openapi.public.json
|
|
116
175
|
pnpm run build
|
|
176
|
+
pnpm test # offline, stubbed transport
|
|
177
|
+
NADIA_API_KEY=… pnpm run test:smoke # real API: one draft in 2030, deleted
|
|
117
178
|
```
|
|
118
179
|
|
|
180
|
+
## Releasing
|
|
181
|
+
|
|
182
|
+
A tag publishes; nothing is published from a laptop.
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# 1. bump "version" in apps/sdk/node/package.json, commit, push main
|
|
186
|
+
# 2. tag it — the tag must equal the version
|
|
187
|
+
git tag node-v0.1.1 && git push origin node-v0.1.1
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`.github/workflows/publish-npm.yml` refuses a tag that does not match
|
|
191
|
+
`package.json`, builds, runs the offline tests **and the smoke test against
|
|
192
|
+
the real API**, and publishes only if all are green (npm Trusted Publisher,
|
|
193
|
+
no token).
|
|
194
|
+
|
|
119
195
|
`openapi.public.json` itself is produced by `pnpm openapi:dump` at the repo
|
|
120
|
-
root and guarded by CI. Plan: `docs/roadmap/19-sdk-public-api.md`.
|
|
196
|
+
root and guarded by CI. Plan: `docs/roadmap/done/19-sdk-public-api.md`.
|
package/dist/index.d.mts
CHANGED
|
@@ -434,15 +434,15 @@ type MediaDto = {
|
|
|
434
434
|
};
|
|
435
435
|
type PostContent = {
|
|
436
436
|
content: string;
|
|
437
|
-
id
|
|
438
|
-
delay
|
|
437
|
+
id?: string;
|
|
438
|
+
delay?: number;
|
|
439
439
|
image: Array<MediaDto>;
|
|
440
440
|
};
|
|
441
441
|
type Post = {
|
|
442
442
|
type?: string;
|
|
443
443
|
integration: Integration;
|
|
444
444
|
value: Array<PostContent>;
|
|
445
|
-
group
|
|
445
|
+
group?: string;
|
|
446
446
|
settings: {
|
|
447
447
|
[key: string]: unknown;
|
|
448
448
|
};
|
|
@@ -1144,6 +1144,30 @@ type WebhookCreatedDto = {
|
|
|
1144
1144
|
*/
|
|
1145
1145
|
secret?: string;
|
|
1146
1146
|
};
|
|
1147
|
+
type TestWebhookDto = {
|
|
1148
|
+
/**
|
|
1149
|
+
* The event to simulate. Default: the first event the webhook subscribed to, or `post.published` when it receives every event.
|
|
1150
|
+
*/
|
|
1151
|
+
event?: 'post.published' | 'comment.received' | 'dm.received' | 'automation.triggered' | 'automation.email_captured';
|
|
1152
|
+
};
|
|
1153
|
+
type WebhookTestResultDto = {
|
|
1154
|
+
/**
|
|
1155
|
+
* Whether the endpoint answered 2xx. One attempt, no retry, 10-second timeout.
|
|
1156
|
+
*/
|
|
1157
|
+
delivered: boolean;
|
|
1158
|
+
/**
|
|
1159
|
+
* The HTTP status the endpoint answered; null when nothing answered (timeout, DNS, connection refused).
|
|
1160
|
+
*/
|
|
1161
|
+
status: number | null;
|
|
1162
|
+
/**
|
|
1163
|
+
* The event simulated.
|
|
1164
|
+
*/
|
|
1165
|
+
event: string;
|
|
1166
|
+
/**
|
|
1167
|
+
* The `id` of the envelope and the `X-Nadia-Delivery` header, to find it on the receiving side.
|
|
1168
|
+
*/
|
|
1169
|
+
deliveryId: string;
|
|
1170
|
+
};
|
|
1147
1171
|
type ContentChannelPerformanceDto = {
|
|
1148
1172
|
integrationId: string;
|
|
1149
1173
|
postId: string;
|
|
@@ -3403,6 +3427,33 @@ type GetWebhookResponses = {
|
|
|
3403
3427
|
200: WebhookDto;
|
|
3404
3428
|
};
|
|
3405
3429
|
type GetWebhookResponse = GetWebhookResponses[keyof GetWebhookResponses];
|
|
3430
|
+
type TestWebhookData = {
|
|
3431
|
+
body?: TestWebhookDto;
|
|
3432
|
+
path: {
|
|
3433
|
+
id: string;
|
|
3434
|
+
};
|
|
3435
|
+
query?: never;
|
|
3436
|
+
url: '/public/v1/webhooks/{id}/test';
|
|
3437
|
+
};
|
|
3438
|
+
type TestWebhookErrors = {
|
|
3439
|
+
/**
|
|
3440
|
+
* The request was rejected — `msg` says why.
|
|
3441
|
+
*/
|
|
3442
|
+
400: ApiErrorDto;
|
|
3443
|
+
/**
|
|
3444
|
+
* Missing or invalid API key (`Authorization` header).
|
|
3445
|
+
*/
|
|
3446
|
+
401: ApiErrorDto;
|
|
3447
|
+
/**
|
|
3448
|
+
* The channel, post or record named in the path does not belong to your organisation.
|
|
3449
|
+
*/
|
|
3450
|
+
404: ApiErrorDto;
|
|
3451
|
+
};
|
|
3452
|
+
type TestWebhookError = TestWebhookErrors[keyof TestWebhookErrors];
|
|
3453
|
+
type TestWebhookResponses = {
|
|
3454
|
+
201: WebhookTestResultDto;
|
|
3455
|
+
};
|
|
3456
|
+
type TestWebhookResponse = TestWebhookResponses[keyof TestWebhookResponses];
|
|
3406
3457
|
type ListContentsData = {
|
|
3407
3458
|
body?: never;
|
|
3408
3459
|
path?: never;
|
|
@@ -4197,6 +4248,12 @@ declare const deleteWebhook: <ThrowOnError extends boolean = false>(options: Opt
|
|
|
4197
4248
|
* One webhook endpoint
|
|
4198
4249
|
*/
|
|
4199
4250
|
declare const getWebhook: <ThrowOnError extends boolean = false>(options: Options<GetWebhookData, ThrowOnError>) => RequestResult<GetWebhookResponses, GetWebhookErrors, ThrowOnError>;
|
|
4251
|
+
/**
|
|
4252
|
+
* Send one signed test delivery to a webhook and return its HTTP status
|
|
4253
|
+
*
|
|
4254
|
+
* POSTs a sample of the event to this webhook only — same envelope `{ id, event, occurredAt, organizationId, data }`, same `X-Nadia-*` headers and signature as a real delivery — with `test: true` added to the envelope and `data` a realistic sample (fake `test_…` ids; nothing happened). One attempt, no retry, 10-second timeout; the call waits for it and returns what the endpoint answered. 400 when the event is not in the catalogue or the webhook is not subscribed to it.
|
|
4255
|
+
*/
|
|
4256
|
+
declare const testWebhook: <ThrowOnError extends boolean = false>(options: Options<TestWebhookData, ThrowOnError>) => RequestResult<TestWebhookResponses, TestWebhookErrors, ThrowOnError>;
|
|
4200
4257
|
/**
|
|
4201
4258
|
* List the cards of the board
|
|
4202
4259
|
*
|
|
@@ -4290,7 +4347,8 @@ declare const importMusic: <ThrowOnError extends boolean = false>(options: Optio
|
|
|
4290
4347
|
*/
|
|
4291
4348
|
declare const uploadMusicFile: <ThrowOnError extends boolean = false>(options: Options<UploadMusicFileData, ThrowOnError>) => RequestResult<UploadMusicFileResponses, UploadMusicFileErrors, ThrowOnError>;
|
|
4292
4349
|
|
|
4293
|
-
/** Body of {@link Nadia.post}.
|
|
4350
|
+
/** Body of {@link Nadia.post}: the spec's own shape (`group`, `value[].id`
|
|
4351
|
+
* and `value[].delay` are optional there since 2026-10-21). */
|
|
4294
4352
|
type CreatePostBody = PublicCreatePostDto;
|
|
4295
4353
|
/** A column of the content board, in board order. */
|
|
4296
4354
|
type ContentStage = MoveContentDto['stage'];
|
|
@@ -4405,4 +4463,57 @@ declare class Nadia {
|
|
|
4405
4463
|
get raw(): Client;
|
|
4406
4464
|
}
|
|
4407
4465
|
|
|
4408
|
-
export { type AccountHistoryItemDto, type AnalyticsMetricDto, type AnalyticsPointDto, type ApiErrorDto, type AutomationFlowCountsDto, type AutomationFlowDto, type AutomationFlowIssueDto, type AutomationFlowPollResultDto, type AutomationFlowPoseResponseDto, type AutomationFlowReplayResultDto, type AutomationFlowResponseDto, type AutomationFlowRunResponseDto, type AutomationFlowStatusDto, type AutomationPoseCountsDto, type AutomationPoseFlowDto, type CallVideoFunctionData, type CallVideoFunctionError, type CallVideoFunctionErrors, type CallVideoFunctionResponse, type CallVideoFunctionResponses, type ChangePostStatusData, type ChangePostStatusDto, type ChangePostStatusError, type ChangePostStatusErrors, type ChangePostStatusResponse, type ChangePostStatusResponses, type CheckConnectionData, type CheckConnectionError, type CheckConnectionErrors, type CheckConnectionResponse, type CheckConnectionResponses, type ClientOptions, type ContentChannelPerformanceDto, type ContentDto, type ContentListItemDto, type ContentPerformanceDto, type ContentPostDto, type ContentStage, type ContentUpsertDto, type CreateAutomationFlowData, type CreateAutomationFlowError, type CreateAutomationFlowErrors, type CreateAutomationFlowResponse, type CreateAutomationFlowResponses, type CreateContentData, type CreateContentDto, type CreateContentError, type CreateContentErrors, type CreateContentResponse, type CreateContentResponses, type CreatePostBody, type CreatePostData, type CreatePostError, type CreatePostErrors, type CreatePostResponse, type CreatePostResponses, type CreatePostResultItemDto, type CreatePublicWebhookDto, type CreateWebhookData, type CreateWebhookError, type CreateWebhookErrors, type CreateWebhookResponse, type CreateWebhookResponses, DEFAULT_BASE_URL, type DeleteAutomationFlowData, type DeleteAutomationFlowError, type DeleteAutomationFlowErrors, type DeleteAutomationFlowResponse, type DeleteAutomationFlowResponses, type DeleteAutomationPoseData, type DeleteAutomationPoseError, type DeleteAutomationPoseErrors, type DeleteAutomationPoseResponse, type DeleteAutomationPoseResponses, type DeleteChannelData, type DeleteChannelError, type DeleteChannelErrors, type DeleteChannelResponse, type DeleteChannelResponses, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteContentData, type DeleteContentError, type DeleteContentErrors, type DeleteContentResponse, type DeleteContentResponses, type DeletePostData, type DeletePostError, type DeletePostErrors, type DeletePostGroupData, type DeletePostGroupError, type DeletePostGroupErrors, type DeletePostGroupResponse, type DeletePostGroupResponses, type DeletePostResponse, type DeletePostResponses, type DeleteWebhookData, type DeleteWebhookError, type DeleteWebhookErrors, type DeleteWebhookResponse, type DeleteWebhookResponses, type DeletedIdDto, type EmailPreviewDto, type EmailPreviewDtoResponse, type EmailSentDto, type EmailTestDto, type FindSlotData, type FindSlotDto, type FindSlotError, type FindSlotErrors, type FindSlotResponse, type FindSlotResponses, type GenerateVideoData, type GenerateVideoError, type GenerateVideoErrors, type GenerateVideoResponse, type GenerateVideoResponses, type GeneratedVideoDto, type GetAccountHistoryData, type GetAccountHistoryError, type GetAccountHistoryErrors, type GetAccountHistoryResponse, type GetAccountHistoryResponses, type GetAutomationFlowData, type GetAutomationFlowError, type GetAutomationFlowErrors, type GetAutomationFlowResponse, type GetAutomationFlowResponses, type GetAutomationPoseData, type GetAutomationPoseError, type GetAutomationPoseErrors, type GetAutomationPoseResponse, type GetAutomationPoseResponses, type GetChannelAnalyticsData, type GetChannelAnalyticsError, type GetChannelAnalyticsErrors, type GetChannelAnalyticsResponse, type GetChannelAnalyticsResponses, type GetChannelSettingsData, type GetChannelSettingsError, type GetChannelSettingsErrors, type GetChannelSettingsResponse, type GetChannelSettingsResponses, type GetContentData, type GetContentError, type GetContentErrors, type GetContentResponse, type GetContentResponses, type GetContentsPerformanceData, type GetContentsPerformanceError, type GetContentsPerformanceErrors, type GetContentsPerformanceResponse, type GetContentsPerformanceResponses, type GetConversationData, type GetConversationError, type GetConversationErrors, type GetConversationResponse, type GetConversationResponses, type GetHookFormsData, type GetHookFormsError, type GetHookFormsErrors, type GetHookFormsResponse, type GetHookFormsResponses, type GetMusicTrackData, type GetMusicTrackError, type GetMusicTrackErrors, type GetMusicTrackResponse, type GetMusicTrackResponses, type GetPostAnalyticsData, type GetPostAnalyticsError, type GetPostAnalyticsErrors, type GetPostAnalyticsResponse, type GetPostAnalyticsResponses, type GetVideoHistoryData, type GetVideoHistoryError, type GetVideoHistoryErrors, type GetVideoHistoryResponse, type GetVideoHistoryResponses, type GetWebhookData, type GetWebhookError, type GetWebhookErrors, type GetWebhookResponse, type GetWebhookResponses, type GroupDto, type HideCommentData, type HideCommentDto, type HideCommentError, type HideCommentErrors, type HideCommentResponse, type HideCommentResponses, type HistoryPageDto, type HookDto, type HookFamiliesImportDto, type HookFamilyDto, type HookFamilyStatDto, type HookFormDto, type HookImportItemDto, type HooksImportDto, type HooksImportResultDto, type HooksSearchResultDto, type ImportHooksData, type ImportHooksError, type ImportHooksErrors, type ImportHooksResponse, type ImportHooksResponses, type ImportMusicData, type ImportMusicError, type ImportMusicErrors, type ImportMusicResponse, type ImportMusicResponses, type InboxConversationDto, type InboxMessageDto, type InboxParticipantDto, type InboxPollResultDto, type InstagramCommentAuthorDto, type InstagramCommentDto, type InstagramMediaDto, type Integration, type IntegrationListItemDto, type IntegrationSettingsDto, type IntegrationSettingsOutputDto, type IntegrationToolDto, type IntegrationToolParamDto, type IntegrationTriggerDto, type IntegrationTriggerResultDto, type IsConnectedDto, type LinkContentPostData, type LinkContentPostDto, type LinkContentPostError, type LinkContentPostErrors, type LinkContentPostResponse, type LinkContentPostResponses, type ListAutomationFlowPosesData, type ListAutomationFlowPosesError, type ListAutomationFlowPosesErrors, type ListAutomationFlowPosesResponse, type ListAutomationFlowPosesResponses, type ListAutomationFlowsData, type ListAutomationFlowsError, type ListAutomationFlowsErrors, type ListAutomationFlowsResponse, type ListAutomationFlowsResponses, type ListAutomationPoseRunsData, type ListAutomationPoseRunsError, type ListAutomationPoseRunsErrors, type ListAutomationPoseRunsResponse, type ListAutomationPoseRunsResponses, type ListChannelAutomationPosesData, type ListChannelAutomationPosesError, type ListChannelAutomationPosesErrors, type ListChannelAutomationPosesResponse, type ListChannelAutomationPosesResponses, type ListChannelMediaData, type ListChannelMediaError, type ListChannelMediaErrors, type ListChannelMediaResponse, type ListChannelMediaResponses, type ListChannelStoriesData, type ListChannelStoriesError, type ListChannelStoriesErrors, type ListChannelStoriesResponse, type ListChannelStoriesResponses, type ListChannelsData, type ListChannelsError, type ListChannelsErrors, type ListChannelsResponse, type ListChannelsResponses, type ListContentsData, type ListContentsError, type ListContentsErrors, type ListContentsResponse, type ListContentsResponses, type ListConversationsData, type ListConversationsError, type ListConversationsErrors, type ListConversationsResponse, type ListConversationsResponses, type ListGroupsData, type ListGroupsError, type ListGroupsErrors, type ListGroupsResponse, type ListGroupsResponses, type ListHookFamiliesData, type ListHookFamiliesError, type ListHookFamiliesErrors, type ListHookFamiliesResponse, type ListHookFamiliesResponses, type ListMediaCommentsData, type ListMediaCommentsError, type ListMediaCommentsErrors, type ListMediaCommentsResponse, type ListMediaCommentsResponses, type ListMissingMediaData, type ListMissingMediaError, type ListMissingMediaErrors, type ListMissingMediaResponse, type ListMissingMediaResponses, type ListMusicData, type ListMusicError, type ListMusicErrors, type ListMusicPillarsData, type ListMusicPillarsError, type ListMusicPillarsErrors, type ListMusicPillarsResponse, type ListMusicPillarsResponses, type ListMusicResponse, type ListMusicResponses, type ListNotificationsData, type ListNotificationsError, type ListNotificationsErrors, type ListNotificationsResponse, type ListNotificationsResponses, type ListPostsData, type ListPostsError, type ListPostsErrors, type ListPostsResponse, type ListPostsResponses, type ListVideoPerformanceData, type ListVideoPerformanceError, type ListVideoPerformanceErrors, type ListVideoPerformanceResponse, type ListVideoPerformanceResponses, type ListWebhookEventsData, type ListWebhookEventsError, type ListWebhookEventsErrors, type ListWebhookEventsResponse, type ListWebhookEventsResponses, type ListWebhooksData, type ListWebhooksError, type ListWebhooksErrors, type ListWebhooksResponse, type ListWebhooksResponses, type MediaDto, type MediaResponseDto, type MissingContentItemDto, type MoveContentData, type MoveContentDto, type MoveContentError, type MoveContentErrors, type MoveContentResponse, type MoveContentResponses, type MusicImportDto, type MusicImportItemDto, type MusicImportResultDto, type MusicListResultDto, type MusicPillarDto, type MusicTrackDto, Nadia, NadiaError, type NadiaOptions, type NotificationDto, type NotificationsPageDto, type OkDto, type Options, type PollAutomationPoseData, type PollAutomationPoseError, type PollAutomationPoseErrors, type PollAutomationPoseResponse, type PollAutomationPoseResponses, type PollInboxData, type PollInboxError, type PollInboxErrors, type PollInboxResponse, type PollInboxResponses, type PoseAutomationFlowData, type PoseAutomationFlowDto, type PoseAutomationFlowError, type PoseAutomationFlowErrors, type PoseAutomationFlowResponse, type PoseAutomationFlowResponses, type Post, type PostContent, type PostDto, type PostIntegrationSummaryDto, type PostListDto, type PostStatusDto, type PostTagDto, type PreviewAutomationEmailData, type PreviewAutomationEmailError, type PreviewAutomationEmailErrors, type PreviewAutomationEmailResponse, type PreviewAutomationEmailResponses, type PublicCreatePostDto, type ReplaceHookFamiliesData, type ReplaceHookFamiliesError, type ReplaceHookFamiliesErrors, type ReplaceHookFamiliesResponse, type ReplaceHookFamiliesResponses, type ReplayAutomationPoseData, type ReplayAutomationPoseError, type ReplayAutomationPoseErrors, type ReplayAutomationPoseResponse, type ReplayAutomationPoseResponses, type ReplayPoseDto, type ReplyToCommentData, type ReplyToCommentDto, type ReplyToCommentError, type ReplyToCommentErrors, type ReplyToCommentResponse, type ReplyToCommentResponses, type RunChannelToolData, type RunChannelToolError, type RunChannelToolErrors, type RunChannelToolResponse, type RunChannelToolResponses, type SearchHooksData, type SearchHooksError, type SearchHooksErrors, type SearchHooksResponse, type SearchHooksResponses, type SendAutomationTestEmailData, type SendAutomationTestEmailError, type SendAutomationTestEmailErrors, type SendAutomationTestEmailResponse, type SendAutomationTestEmailResponses, type SendDirectMessageData, type SendDirectMessageError, type SendDirectMessageErrors, type SendDirectMessageResponse, type SendDirectMessageResponses, type SendMessageDto, type SetAutomationFlowStatusData, type SetAutomationFlowStatusError, type SetAutomationFlowStatusErrors, type SetAutomationFlowStatusResponse, type SetAutomationFlowStatusResponses, type SetPostReleaseIdData, type SetPostReleaseIdError, type SetPostReleaseIdErrors, type SetPostReleaseIdResponse, type SetPostReleaseIdResponses, type SocialAuthUrlDto, type StartChannelConnectionData, type StartChannelConnectionError, type StartChannelConnectionErrors, type StartChannelConnectionResponse, type StartChannelConnectionResponses, type SubscribeInboxWebhookData, type SubscribeInboxWebhookError, type SubscribeInboxWebhookErrors, type SubscribeInboxWebhookResponse, type SubscribeInboxWebhookResponses, type SuccessDto, type Tags, type UpdateAutomationFlowData, type UpdateAutomationFlowDto, type UpdateAutomationFlowError, type UpdateAutomationFlowErrors, type UpdateAutomationFlowPoseDto, type UpdateAutomationFlowResponse, type UpdateAutomationFlowResponses, type UpdateAutomationPoseData, type UpdateAutomationPoseError, type UpdateAutomationPoseErrors, type UpdateAutomationPoseResponse, type UpdateAutomationPoseResponses, type UpdateContentData, type UpdateContentDto, type UpdateContentError, type UpdateContentErrors, type UpdateContentResponse, type UpdateContentResponses, type UpdateReleaseIdDto, type UploadDto, type UploadFileData, type UploadFileError, type UploadFileErrors, type UploadFileResponse, type UploadFileResponses, type UploadFromUrlData, type UploadFromUrlError, type UploadFromUrlErrors, type UploadFromUrlResponse, type UploadFromUrlResponses, type UploadMusicFileData, type UploadMusicFileError, type UploadMusicFileErrors, type UploadMusicFileResponse, type UploadMusicFileResponses, type UpsertContentData, type UpsertContentDto, type UpsertContentError, type UpsertContentErrors, type UpsertContentResponse, type UpsertContentResponses, type VideoDto, type VideoFunctionDto, type VideoHistoryPageDto, type VideoIdentityDto, type WebhookCreatedDto, type WebhookDto, type WebhookEventDto, type WebhookEventListDto, type WebhooksIntegrationDto, callVideoFunction, changePostStatus, checkConnection, createAutomationFlow, createContent, createPost, createWebhook, Nadia as default, deleteAutomationFlow, deleteAutomationPose, deleteChannel, deleteComment, deleteContent, deletePost, deletePostGroup, deleteWebhook, findSlot, generateVideo, getAccountHistory, getAutomationFlow, getAutomationPose, getChannelAnalytics, getChannelSettings, getContent, getContentsPerformance, getConversation, getHookForms, getMusicTrack, getPostAnalytics, getVideoHistory, getWebhook, hideComment, importHooks, importMusic, linkContentPost, listAutomationFlowPoses, listAutomationFlows, listAutomationPoseRuns, listChannelAutomationPoses, listChannelMedia, listChannelStories, listChannels, listContents, listConversations, listGroups, listHookFamilies, listMediaComments, listMissingMedia, listMusic, listMusicPillars, listNotifications, listPosts, listVideoPerformance, listWebhookEvents, listWebhooks, moveContent, pollAutomationPose, pollInbox, poseAutomationFlow, previewAutomationEmail, replaceHookFamilies, replayAutomationPose, replyToComment, runChannelTool, searchHooks, sendAutomationTestEmail, sendDirectMessage, setAutomationFlowStatus, setPostReleaseId, startChannelConnection, subscribeInboxWebhook, updateAutomationFlow, updateAutomationPose, updateContent, uploadFile, uploadFromUrl, uploadMusicFile, upsertContent };
|
|
4466
|
+
/**
|
|
4467
|
+
* What every webhook delivery carries (the JSON body). `data` depends on
|
|
4468
|
+
* `event` — `nadia.request(listWebhookEvents)` lists the events.
|
|
4469
|
+
*/
|
|
4470
|
+
interface WebhookDelivery<T = unknown> {
|
|
4471
|
+
id: string;
|
|
4472
|
+
event: string;
|
|
4473
|
+
occurredAt: string;
|
|
4474
|
+
organizationId: string;
|
|
4475
|
+
data: T;
|
|
4476
|
+
}
|
|
4477
|
+
interface VerifyWebhookOptions {
|
|
4478
|
+
/** The secret returned once, when the webhook was created. */
|
|
4479
|
+
secret: string;
|
|
4480
|
+
/** The `X-Nadia-Signature` header: `sha256=<hex>`. */
|
|
4481
|
+
signature: string | null | undefined;
|
|
4482
|
+
/** The `X-Nadia-Timestamp` header, epoch seconds. */
|
|
4483
|
+
timestamp: string | number | null | undefined;
|
|
4484
|
+
/** The body exactly as received — not a re-serialized `JSON.parse`. */
|
|
4485
|
+
body: string | Uint8Array;
|
|
4486
|
+
/**
|
|
4487
|
+
* Reject deliveries whose timestamp is further than this from now, in
|
|
4488
|
+
* seconds (a replayed capture). Not checked when left out.
|
|
4489
|
+
*/
|
|
4490
|
+
tolerance?: number;
|
|
4491
|
+
/** Current time in epoch milliseconds — for tests. Defaults to `Date.now()`. */
|
|
4492
|
+
now?: number;
|
|
4493
|
+
}
|
|
4494
|
+
/** Why {@link parseWebhook} refused a delivery. */
|
|
4495
|
+
declare class NadiaWebhookError extends Error {
|
|
4496
|
+
readonly reason: 'missing_header' | 'bad_signature' | 'stale' | 'bad_body';
|
|
4497
|
+
constructor(reason: NadiaWebhookError['reason'], message: string);
|
|
4498
|
+
}
|
|
4499
|
+
/**
|
|
4500
|
+
* True when the delivery was signed with `secret`. Compared in constant time.
|
|
4501
|
+
* Pass the **raw** body: a parsed and re-serialized one will not match.
|
|
4502
|
+
*/
|
|
4503
|
+
declare function verifyWebhookSignature(options: VerifyWebhookOptions): boolean;
|
|
4504
|
+
/**
|
|
4505
|
+
* Verifies a delivery and returns it parsed — or throws `NadiaWebhookError`.
|
|
4506
|
+
* Unlike {@link verifyWebhookSignature}, the timestamp is checked by
|
|
4507
|
+
* default (300 s, the margin a retry needs); `tolerance: Infinity` turns it off.
|
|
4508
|
+
*
|
|
4509
|
+
* `headers` takes a Node `req.headers` object or a `Headers` instance.
|
|
4510
|
+
*/
|
|
4511
|
+
declare function parseWebhook<T = unknown>(options: {
|
|
4512
|
+
secret: string;
|
|
4513
|
+
headers: Headers | Record<string, string | string[] | undefined>;
|
|
4514
|
+
body: string | Uint8Array;
|
|
4515
|
+
tolerance?: number;
|
|
4516
|
+
now?: number;
|
|
4517
|
+
}): WebhookDelivery<T>;
|
|
4518
|
+
|
|
4519
|
+
export { type AccountHistoryItemDto, type AnalyticsMetricDto, type AnalyticsPointDto, type ApiErrorDto, type AutomationFlowCountsDto, type AutomationFlowDto, type AutomationFlowIssueDto, type AutomationFlowPollResultDto, type AutomationFlowPoseResponseDto, type AutomationFlowReplayResultDto, type AutomationFlowResponseDto, type AutomationFlowRunResponseDto, type AutomationFlowStatusDto, type AutomationPoseCountsDto, type AutomationPoseFlowDto, type CallVideoFunctionData, type CallVideoFunctionError, type CallVideoFunctionErrors, type CallVideoFunctionResponse, type CallVideoFunctionResponses, type ChangePostStatusData, type ChangePostStatusDto, type ChangePostStatusError, type ChangePostStatusErrors, type ChangePostStatusResponse, type ChangePostStatusResponses, type CheckConnectionData, type CheckConnectionError, type CheckConnectionErrors, type CheckConnectionResponse, type CheckConnectionResponses, type ClientOptions, type ContentChannelPerformanceDto, type ContentDto, type ContentListItemDto, type ContentPerformanceDto, type ContentPostDto, type ContentStage, type ContentUpsertDto, type CreateAutomationFlowData, type CreateAutomationFlowError, type CreateAutomationFlowErrors, type CreateAutomationFlowResponse, type CreateAutomationFlowResponses, type CreateContentData, type CreateContentDto, type CreateContentError, type CreateContentErrors, type CreateContentResponse, type CreateContentResponses, type CreatePostBody, type CreatePostData, type CreatePostError, type CreatePostErrors, type CreatePostResponse, type CreatePostResponses, type CreatePostResultItemDto, type CreatePublicWebhookDto, type CreateWebhookData, type CreateWebhookError, type CreateWebhookErrors, type CreateWebhookResponse, type CreateWebhookResponses, DEFAULT_BASE_URL, type DeleteAutomationFlowData, type DeleteAutomationFlowError, type DeleteAutomationFlowErrors, type DeleteAutomationFlowResponse, type DeleteAutomationFlowResponses, type DeleteAutomationPoseData, type DeleteAutomationPoseError, type DeleteAutomationPoseErrors, type DeleteAutomationPoseResponse, type DeleteAutomationPoseResponses, type DeleteChannelData, type DeleteChannelError, type DeleteChannelErrors, type DeleteChannelResponse, type DeleteChannelResponses, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteContentData, type DeleteContentError, type DeleteContentErrors, type DeleteContentResponse, type DeleteContentResponses, type DeletePostData, type DeletePostError, type DeletePostErrors, type DeletePostGroupData, type DeletePostGroupError, type DeletePostGroupErrors, type DeletePostGroupResponse, type DeletePostGroupResponses, type DeletePostResponse, type DeletePostResponses, type DeleteWebhookData, type DeleteWebhookError, type DeleteWebhookErrors, type DeleteWebhookResponse, type DeleteWebhookResponses, type DeletedIdDto, type EmailPreviewDto, type EmailPreviewDtoResponse, type EmailSentDto, type EmailTestDto, type FindSlotData, type FindSlotDto, type FindSlotError, type FindSlotErrors, type FindSlotResponse, type FindSlotResponses, type GenerateVideoData, type GenerateVideoError, type GenerateVideoErrors, type GenerateVideoResponse, type GenerateVideoResponses, type GeneratedVideoDto, type GetAccountHistoryData, type GetAccountHistoryError, type GetAccountHistoryErrors, type GetAccountHistoryResponse, type GetAccountHistoryResponses, type GetAutomationFlowData, type GetAutomationFlowError, type GetAutomationFlowErrors, type GetAutomationFlowResponse, type GetAutomationFlowResponses, type GetAutomationPoseData, type GetAutomationPoseError, type GetAutomationPoseErrors, type GetAutomationPoseResponse, type GetAutomationPoseResponses, type GetChannelAnalyticsData, type GetChannelAnalyticsError, type GetChannelAnalyticsErrors, type GetChannelAnalyticsResponse, type GetChannelAnalyticsResponses, type GetChannelSettingsData, type GetChannelSettingsError, type GetChannelSettingsErrors, type GetChannelSettingsResponse, type GetChannelSettingsResponses, type GetContentData, type GetContentError, type GetContentErrors, type GetContentResponse, type GetContentResponses, type GetContentsPerformanceData, type GetContentsPerformanceError, type GetContentsPerformanceErrors, type GetContentsPerformanceResponse, type GetContentsPerformanceResponses, type GetConversationData, type GetConversationError, type GetConversationErrors, type GetConversationResponse, type GetConversationResponses, type GetHookFormsData, type GetHookFormsError, type GetHookFormsErrors, type GetHookFormsResponse, type GetHookFormsResponses, type GetMusicTrackData, type GetMusicTrackError, type GetMusicTrackErrors, type GetMusicTrackResponse, type GetMusicTrackResponses, type GetPostAnalyticsData, type GetPostAnalyticsError, type GetPostAnalyticsErrors, type GetPostAnalyticsResponse, type GetPostAnalyticsResponses, type GetVideoHistoryData, type GetVideoHistoryError, type GetVideoHistoryErrors, type GetVideoHistoryResponse, type GetVideoHistoryResponses, type GetWebhookData, type GetWebhookError, type GetWebhookErrors, type GetWebhookResponse, type GetWebhookResponses, type GroupDto, type HideCommentData, type HideCommentDto, type HideCommentError, type HideCommentErrors, type HideCommentResponse, type HideCommentResponses, type HistoryPageDto, type HookDto, type HookFamiliesImportDto, type HookFamilyDto, type HookFamilyStatDto, type HookFormDto, type HookImportItemDto, type HooksImportDto, type HooksImportResultDto, type HooksSearchResultDto, type ImportHooksData, type ImportHooksError, type ImportHooksErrors, type ImportHooksResponse, type ImportHooksResponses, type ImportMusicData, type ImportMusicError, type ImportMusicErrors, type ImportMusicResponse, type ImportMusicResponses, type InboxConversationDto, type InboxMessageDto, type InboxParticipantDto, type InboxPollResultDto, type InstagramCommentAuthorDto, type InstagramCommentDto, type InstagramMediaDto, type Integration, type IntegrationListItemDto, type IntegrationSettingsDto, type IntegrationSettingsOutputDto, type IntegrationToolDto, type IntegrationToolParamDto, type IntegrationTriggerDto, type IntegrationTriggerResultDto, type IsConnectedDto, type LinkContentPostData, type LinkContentPostDto, type LinkContentPostError, type LinkContentPostErrors, type LinkContentPostResponse, type LinkContentPostResponses, type ListAutomationFlowPosesData, type ListAutomationFlowPosesError, type ListAutomationFlowPosesErrors, type ListAutomationFlowPosesResponse, type ListAutomationFlowPosesResponses, type ListAutomationFlowsData, type ListAutomationFlowsError, type ListAutomationFlowsErrors, type ListAutomationFlowsResponse, type ListAutomationFlowsResponses, type ListAutomationPoseRunsData, type ListAutomationPoseRunsError, type ListAutomationPoseRunsErrors, type ListAutomationPoseRunsResponse, type ListAutomationPoseRunsResponses, type ListChannelAutomationPosesData, type ListChannelAutomationPosesError, type ListChannelAutomationPosesErrors, type ListChannelAutomationPosesResponse, type ListChannelAutomationPosesResponses, type ListChannelMediaData, type ListChannelMediaError, type ListChannelMediaErrors, type ListChannelMediaResponse, type ListChannelMediaResponses, type ListChannelStoriesData, type ListChannelStoriesError, type ListChannelStoriesErrors, type ListChannelStoriesResponse, type ListChannelStoriesResponses, type ListChannelsData, type ListChannelsError, type ListChannelsErrors, type ListChannelsResponse, type ListChannelsResponses, type ListContentsData, type ListContentsError, type ListContentsErrors, type ListContentsResponse, type ListContentsResponses, type ListConversationsData, type ListConversationsError, type ListConversationsErrors, type ListConversationsResponse, type ListConversationsResponses, type ListGroupsData, type ListGroupsError, type ListGroupsErrors, type ListGroupsResponse, type ListGroupsResponses, type ListHookFamiliesData, type ListHookFamiliesError, type ListHookFamiliesErrors, type ListHookFamiliesResponse, type ListHookFamiliesResponses, type ListMediaCommentsData, type ListMediaCommentsError, type ListMediaCommentsErrors, type ListMediaCommentsResponse, type ListMediaCommentsResponses, type ListMissingMediaData, type ListMissingMediaError, type ListMissingMediaErrors, type ListMissingMediaResponse, type ListMissingMediaResponses, type ListMusicData, type ListMusicError, type ListMusicErrors, type ListMusicPillarsData, type ListMusicPillarsError, type ListMusicPillarsErrors, type ListMusicPillarsResponse, type ListMusicPillarsResponses, type ListMusicResponse, type ListMusicResponses, type ListNotificationsData, type ListNotificationsError, type ListNotificationsErrors, type ListNotificationsResponse, type ListNotificationsResponses, type ListPostsData, type ListPostsError, type ListPostsErrors, type ListPostsResponse, type ListPostsResponses, type ListVideoPerformanceData, type ListVideoPerformanceError, type ListVideoPerformanceErrors, type ListVideoPerformanceResponse, type ListVideoPerformanceResponses, type ListWebhookEventsData, type ListWebhookEventsError, type ListWebhookEventsErrors, type ListWebhookEventsResponse, type ListWebhookEventsResponses, type ListWebhooksData, type ListWebhooksError, type ListWebhooksErrors, type ListWebhooksResponse, type ListWebhooksResponses, type MediaDto, type MediaResponseDto, type MissingContentItemDto, type MoveContentData, type MoveContentDto, type MoveContentError, type MoveContentErrors, type MoveContentResponse, type MoveContentResponses, type MusicImportDto, type MusicImportItemDto, type MusicImportResultDto, type MusicListResultDto, type MusicPillarDto, type MusicTrackDto, Nadia, NadiaError, type NadiaOptions, NadiaWebhookError, type NotificationDto, type NotificationsPageDto, type OkDto, type Options, type PollAutomationPoseData, type PollAutomationPoseError, type PollAutomationPoseErrors, type PollAutomationPoseResponse, type PollAutomationPoseResponses, type PollInboxData, type PollInboxError, type PollInboxErrors, type PollInboxResponse, type PollInboxResponses, type PoseAutomationFlowData, type PoseAutomationFlowDto, type PoseAutomationFlowError, type PoseAutomationFlowErrors, type PoseAutomationFlowResponse, type PoseAutomationFlowResponses, type Post, type PostContent, type PostDto, type PostIntegrationSummaryDto, type PostListDto, type PostStatusDto, type PostTagDto, type PreviewAutomationEmailData, type PreviewAutomationEmailError, type PreviewAutomationEmailErrors, type PreviewAutomationEmailResponse, type PreviewAutomationEmailResponses, type PublicCreatePostDto, type ReplaceHookFamiliesData, type ReplaceHookFamiliesError, type ReplaceHookFamiliesErrors, type ReplaceHookFamiliesResponse, type ReplaceHookFamiliesResponses, type ReplayAutomationPoseData, type ReplayAutomationPoseError, type ReplayAutomationPoseErrors, type ReplayAutomationPoseResponse, type ReplayAutomationPoseResponses, type ReplayPoseDto, type ReplyToCommentData, type ReplyToCommentDto, type ReplyToCommentError, type ReplyToCommentErrors, type ReplyToCommentResponse, type ReplyToCommentResponses, type RunChannelToolData, type RunChannelToolError, type RunChannelToolErrors, type RunChannelToolResponse, type RunChannelToolResponses, type SearchHooksData, type SearchHooksError, type SearchHooksErrors, type SearchHooksResponse, type SearchHooksResponses, type SendAutomationTestEmailData, type SendAutomationTestEmailError, type SendAutomationTestEmailErrors, type SendAutomationTestEmailResponse, type SendAutomationTestEmailResponses, type SendDirectMessageData, type SendDirectMessageError, type SendDirectMessageErrors, type SendDirectMessageResponse, type SendDirectMessageResponses, type SendMessageDto, type SetAutomationFlowStatusData, type SetAutomationFlowStatusError, type SetAutomationFlowStatusErrors, type SetAutomationFlowStatusResponse, type SetAutomationFlowStatusResponses, type SetPostReleaseIdData, type SetPostReleaseIdError, type SetPostReleaseIdErrors, type SetPostReleaseIdResponse, type SetPostReleaseIdResponses, type SocialAuthUrlDto, type StartChannelConnectionData, type StartChannelConnectionError, type StartChannelConnectionErrors, type StartChannelConnectionResponse, type StartChannelConnectionResponses, type SubscribeInboxWebhookData, type SubscribeInboxWebhookError, type SubscribeInboxWebhookErrors, type SubscribeInboxWebhookResponse, type SubscribeInboxWebhookResponses, type SuccessDto, type Tags, type TestWebhookData, type TestWebhookDto, type TestWebhookError, type TestWebhookErrors, type TestWebhookResponse, type TestWebhookResponses, type UpdateAutomationFlowData, type UpdateAutomationFlowDto, type UpdateAutomationFlowError, type UpdateAutomationFlowErrors, type UpdateAutomationFlowPoseDto, type UpdateAutomationFlowResponse, type UpdateAutomationFlowResponses, type UpdateAutomationPoseData, type UpdateAutomationPoseError, type UpdateAutomationPoseErrors, type UpdateAutomationPoseResponse, type UpdateAutomationPoseResponses, type UpdateContentData, type UpdateContentDto, type UpdateContentError, type UpdateContentErrors, type UpdateContentResponse, type UpdateContentResponses, type UpdateReleaseIdDto, type UploadDto, type UploadFileData, type UploadFileError, type UploadFileErrors, type UploadFileResponse, type UploadFileResponses, type UploadFromUrlData, type UploadFromUrlError, type UploadFromUrlErrors, type UploadFromUrlResponse, type UploadFromUrlResponses, type UploadMusicFileData, type UploadMusicFileError, type UploadMusicFileErrors, type UploadMusicFileResponse, type UploadMusicFileResponses, type UpsertContentData, type UpsertContentDto, type UpsertContentError, type UpsertContentErrors, type UpsertContentResponse, type UpsertContentResponses, type VerifyWebhookOptions, type VideoDto, type VideoFunctionDto, type VideoHistoryPageDto, type VideoIdentityDto, type WebhookCreatedDto, type WebhookDelivery, type WebhookDto, type WebhookEventDto, type WebhookEventListDto, type WebhookTestResultDto, type WebhooksIntegrationDto, callVideoFunction, changePostStatus, checkConnection, createAutomationFlow, createContent, createPost, createWebhook, Nadia as default, deleteAutomationFlow, deleteAutomationPose, deleteChannel, deleteComment, deleteContent, deletePost, deletePostGroup, deleteWebhook, findSlot, generateVideo, getAccountHistory, getAutomationFlow, getAutomationPose, getChannelAnalytics, getChannelSettings, getContent, getContentsPerformance, getConversation, getHookForms, getMusicTrack, getPostAnalytics, getVideoHistory, getWebhook, hideComment, importHooks, importMusic, linkContentPost, listAutomationFlowPoses, listAutomationFlows, listAutomationPoseRuns, listChannelAutomationPoses, listChannelMedia, listChannelStories, listChannels, listContents, listConversations, listGroups, listHookFamilies, listMediaComments, listMissingMedia, listMusic, listMusicPillars, listNotifications, listPosts, listVideoPerformance, listWebhookEvents, listWebhooks, moveContent, parseWebhook, pollAutomationPose, pollInbox, poseAutomationFlow, previewAutomationEmail, replaceHookFamilies, replayAutomationPose, replyToComment, runChannelTool, searchHooks, sendAutomationTestEmail, sendDirectMessage, setAutomationFlowStatus, setPostReleaseId, startChannelConnection, subscribeInboxWebhook, testWebhook, updateAutomationFlow, updateAutomationPose, updateContent, uploadFile, uploadFromUrl, uploadMusicFile, upsertContent, verifyWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -434,15 +434,15 @@ type MediaDto = {
|
|
|
434
434
|
};
|
|
435
435
|
type PostContent = {
|
|
436
436
|
content: string;
|
|
437
|
-
id
|
|
438
|
-
delay
|
|
437
|
+
id?: string;
|
|
438
|
+
delay?: number;
|
|
439
439
|
image: Array<MediaDto>;
|
|
440
440
|
};
|
|
441
441
|
type Post = {
|
|
442
442
|
type?: string;
|
|
443
443
|
integration: Integration;
|
|
444
444
|
value: Array<PostContent>;
|
|
445
|
-
group
|
|
445
|
+
group?: string;
|
|
446
446
|
settings: {
|
|
447
447
|
[key: string]: unknown;
|
|
448
448
|
};
|
|
@@ -1144,6 +1144,30 @@ type WebhookCreatedDto = {
|
|
|
1144
1144
|
*/
|
|
1145
1145
|
secret?: string;
|
|
1146
1146
|
};
|
|
1147
|
+
type TestWebhookDto = {
|
|
1148
|
+
/**
|
|
1149
|
+
* The event to simulate. Default: the first event the webhook subscribed to, or `post.published` when it receives every event.
|
|
1150
|
+
*/
|
|
1151
|
+
event?: 'post.published' | 'comment.received' | 'dm.received' | 'automation.triggered' | 'automation.email_captured';
|
|
1152
|
+
};
|
|
1153
|
+
type WebhookTestResultDto = {
|
|
1154
|
+
/**
|
|
1155
|
+
* Whether the endpoint answered 2xx. One attempt, no retry, 10-second timeout.
|
|
1156
|
+
*/
|
|
1157
|
+
delivered: boolean;
|
|
1158
|
+
/**
|
|
1159
|
+
* The HTTP status the endpoint answered; null when nothing answered (timeout, DNS, connection refused).
|
|
1160
|
+
*/
|
|
1161
|
+
status: number | null;
|
|
1162
|
+
/**
|
|
1163
|
+
* The event simulated.
|
|
1164
|
+
*/
|
|
1165
|
+
event: string;
|
|
1166
|
+
/**
|
|
1167
|
+
* The `id` of the envelope and the `X-Nadia-Delivery` header, to find it on the receiving side.
|
|
1168
|
+
*/
|
|
1169
|
+
deliveryId: string;
|
|
1170
|
+
};
|
|
1147
1171
|
type ContentChannelPerformanceDto = {
|
|
1148
1172
|
integrationId: string;
|
|
1149
1173
|
postId: string;
|
|
@@ -3403,6 +3427,33 @@ type GetWebhookResponses = {
|
|
|
3403
3427
|
200: WebhookDto;
|
|
3404
3428
|
};
|
|
3405
3429
|
type GetWebhookResponse = GetWebhookResponses[keyof GetWebhookResponses];
|
|
3430
|
+
type TestWebhookData = {
|
|
3431
|
+
body?: TestWebhookDto;
|
|
3432
|
+
path: {
|
|
3433
|
+
id: string;
|
|
3434
|
+
};
|
|
3435
|
+
query?: never;
|
|
3436
|
+
url: '/public/v1/webhooks/{id}/test';
|
|
3437
|
+
};
|
|
3438
|
+
type TestWebhookErrors = {
|
|
3439
|
+
/**
|
|
3440
|
+
* The request was rejected — `msg` says why.
|
|
3441
|
+
*/
|
|
3442
|
+
400: ApiErrorDto;
|
|
3443
|
+
/**
|
|
3444
|
+
* Missing or invalid API key (`Authorization` header).
|
|
3445
|
+
*/
|
|
3446
|
+
401: ApiErrorDto;
|
|
3447
|
+
/**
|
|
3448
|
+
* The channel, post or record named in the path does not belong to your organisation.
|
|
3449
|
+
*/
|
|
3450
|
+
404: ApiErrorDto;
|
|
3451
|
+
};
|
|
3452
|
+
type TestWebhookError = TestWebhookErrors[keyof TestWebhookErrors];
|
|
3453
|
+
type TestWebhookResponses = {
|
|
3454
|
+
201: WebhookTestResultDto;
|
|
3455
|
+
};
|
|
3456
|
+
type TestWebhookResponse = TestWebhookResponses[keyof TestWebhookResponses];
|
|
3406
3457
|
type ListContentsData = {
|
|
3407
3458
|
body?: never;
|
|
3408
3459
|
path?: never;
|
|
@@ -4197,6 +4248,12 @@ declare const deleteWebhook: <ThrowOnError extends boolean = false>(options: Opt
|
|
|
4197
4248
|
* One webhook endpoint
|
|
4198
4249
|
*/
|
|
4199
4250
|
declare const getWebhook: <ThrowOnError extends boolean = false>(options: Options<GetWebhookData, ThrowOnError>) => RequestResult<GetWebhookResponses, GetWebhookErrors, ThrowOnError>;
|
|
4251
|
+
/**
|
|
4252
|
+
* Send one signed test delivery to a webhook and return its HTTP status
|
|
4253
|
+
*
|
|
4254
|
+
* POSTs a sample of the event to this webhook only — same envelope `{ id, event, occurredAt, organizationId, data }`, same `X-Nadia-*` headers and signature as a real delivery — with `test: true` added to the envelope and `data` a realistic sample (fake `test_…` ids; nothing happened). One attempt, no retry, 10-second timeout; the call waits for it and returns what the endpoint answered. 400 when the event is not in the catalogue or the webhook is not subscribed to it.
|
|
4255
|
+
*/
|
|
4256
|
+
declare const testWebhook: <ThrowOnError extends boolean = false>(options: Options<TestWebhookData, ThrowOnError>) => RequestResult<TestWebhookResponses, TestWebhookErrors, ThrowOnError>;
|
|
4200
4257
|
/**
|
|
4201
4258
|
* List the cards of the board
|
|
4202
4259
|
*
|
|
@@ -4290,7 +4347,8 @@ declare const importMusic: <ThrowOnError extends boolean = false>(options: Optio
|
|
|
4290
4347
|
*/
|
|
4291
4348
|
declare const uploadMusicFile: <ThrowOnError extends boolean = false>(options: Options<UploadMusicFileData, ThrowOnError>) => RequestResult<UploadMusicFileResponses, UploadMusicFileErrors, ThrowOnError>;
|
|
4292
4349
|
|
|
4293
|
-
/** Body of {@link Nadia.post}.
|
|
4350
|
+
/** Body of {@link Nadia.post}: the spec's own shape (`group`, `value[].id`
|
|
4351
|
+
* and `value[].delay` are optional there since 2026-10-21). */
|
|
4294
4352
|
type CreatePostBody = PublicCreatePostDto;
|
|
4295
4353
|
/** A column of the content board, in board order. */
|
|
4296
4354
|
type ContentStage = MoveContentDto['stage'];
|
|
@@ -4405,4 +4463,57 @@ declare class Nadia {
|
|
|
4405
4463
|
get raw(): Client;
|
|
4406
4464
|
}
|
|
4407
4465
|
|
|
4408
|
-
export { type AccountHistoryItemDto, type AnalyticsMetricDto, type AnalyticsPointDto, type ApiErrorDto, type AutomationFlowCountsDto, type AutomationFlowDto, type AutomationFlowIssueDto, type AutomationFlowPollResultDto, type AutomationFlowPoseResponseDto, type AutomationFlowReplayResultDto, type AutomationFlowResponseDto, type AutomationFlowRunResponseDto, type AutomationFlowStatusDto, type AutomationPoseCountsDto, type AutomationPoseFlowDto, type CallVideoFunctionData, type CallVideoFunctionError, type CallVideoFunctionErrors, type CallVideoFunctionResponse, type CallVideoFunctionResponses, type ChangePostStatusData, type ChangePostStatusDto, type ChangePostStatusError, type ChangePostStatusErrors, type ChangePostStatusResponse, type ChangePostStatusResponses, type CheckConnectionData, type CheckConnectionError, type CheckConnectionErrors, type CheckConnectionResponse, type CheckConnectionResponses, type ClientOptions, type ContentChannelPerformanceDto, type ContentDto, type ContentListItemDto, type ContentPerformanceDto, type ContentPostDto, type ContentStage, type ContentUpsertDto, type CreateAutomationFlowData, type CreateAutomationFlowError, type CreateAutomationFlowErrors, type CreateAutomationFlowResponse, type CreateAutomationFlowResponses, type CreateContentData, type CreateContentDto, type CreateContentError, type CreateContentErrors, type CreateContentResponse, type CreateContentResponses, type CreatePostBody, type CreatePostData, type CreatePostError, type CreatePostErrors, type CreatePostResponse, type CreatePostResponses, type CreatePostResultItemDto, type CreatePublicWebhookDto, type CreateWebhookData, type CreateWebhookError, type CreateWebhookErrors, type CreateWebhookResponse, type CreateWebhookResponses, DEFAULT_BASE_URL, type DeleteAutomationFlowData, type DeleteAutomationFlowError, type DeleteAutomationFlowErrors, type DeleteAutomationFlowResponse, type DeleteAutomationFlowResponses, type DeleteAutomationPoseData, type DeleteAutomationPoseError, type DeleteAutomationPoseErrors, type DeleteAutomationPoseResponse, type DeleteAutomationPoseResponses, type DeleteChannelData, type DeleteChannelError, type DeleteChannelErrors, type DeleteChannelResponse, type DeleteChannelResponses, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteContentData, type DeleteContentError, type DeleteContentErrors, type DeleteContentResponse, type DeleteContentResponses, type DeletePostData, type DeletePostError, type DeletePostErrors, type DeletePostGroupData, type DeletePostGroupError, type DeletePostGroupErrors, type DeletePostGroupResponse, type DeletePostGroupResponses, type DeletePostResponse, type DeletePostResponses, type DeleteWebhookData, type DeleteWebhookError, type DeleteWebhookErrors, type DeleteWebhookResponse, type DeleteWebhookResponses, type DeletedIdDto, type EmailPreviewDto, type EmailPreviewDtoResponse, type EmailSentDto, type EmailTestDto, type FindSlotData, type FindSlotDto, type FindSlotError, type FindSlotErrors, type FindSlotResponse, type FindSlotResponses, type GenerateVideoData, type GenerateVideoError, type GenerateVideoErrors, type GenerateVideoResponse, type GenerateVideoResponses, type GeneratedVideoDto, type GetAccountHistoryData, type GetAccountHistoryError, type GetAccountHistoryErrors, type GetAccountHistoryResponse, type GetAccountHistoryResponses, type GetAutomationFlowData, type GetAutomationFlowError, type GetAutomationFlowErrors, type GetAutomationFlowResponse, type GetAutomationFlowResponses, type GetAutomationPoseData, type GetAutomationPoseError, type GetAutomationPoseErrors, type GetAutomationPoseResponse, type GetAutomationPoseResponses, type GetChannelAnalyticsData, type GetChannelAnalyticsError, type GetChannelAnalyticsErrors, type GetChannelAnalyticsResponse, type GetChannelAnalyticsResponses, type GetChannelSettingsData, type GetChannelSettingsError, type GetChannelSettingsErrors, type GetChannelSettingsResponse, type GetChannelSettingsResponses, type GetContentData, type GetContentError, type GetContentErrors, type GetContentResponse, type GetContentResponses, type GetContentsPerformanceData, type GetContentsPerformanceError, type GetContentsPerformanceErrors, type GetContentsPerformanceResponse, type GetContentsPerformanceResponses, type GetConversationData, type GetConversationError, type GetConversationErrors, type GetConversationResponse, type GetConversationResponses, type GetHookFormsData, type GetHookFormsError, type GetHookFormsErrors, type GetHookFormsResponse, type GetHookFormsResponses, type GetMusicTrackData, type GetMusicTrackError, type GetMusicTrackErrors, type GetMusicTrackResponse, type GetMusicTrackResponses, type GetPostAnalyticsData, type GetPostAnalyticsError, type GetPostAnalyticsErrors, type GetPostAnalyticsResponse, type GetPostAnalyticsResponses, type GetVideoHistoryData, type GetVideoHistoryError, type GetVideoHistoryErrors, type GetVideoHistoryResponse, type GetVideoHistoryResponses, type GetWebhookData, type GetWebhookError, type GetWebhookErrors, type GetWebhookResponse, type GetWebhookResponses, type GroupDto, type HideCommentData, type HideCommentDto, type HideCommentError, type HideCommentErrors, type HideCommentResponse, type HideCommentResponses, type HistoryPageDto, type HookDto, type HookFamiliesImportDto, type HookFamilyDto, type HookFamilyStatDto, type HookFormDto, type HookImportItemDto, type HooksImportDto, type HooksImportResultDto, type HooksSearchResultDto, type ImportHooksData, type ImportHooksError, type ImportHooksErrors, type ImportHooksResponse, type ImportHooksResponses, type ImportMusicData, type ImportMusicError, type ImportMusicErrors, type ImportMusicResponse, type ImportMusicResponses, type InboxConversationDto, type InboxMessageDto, type InboxParticipantDto, type InboxPollResultDto, type InstagramCommentAuthorDto, type InstagramCommentDto, type InstagramMediaDto, type Integration, type IntegrationListItemDto, type IntegrationSettingsDto, type IntegrationSettingsOutputDto, type IntegrationToolDto, type IntegrationToolParamDto, type IntegrationTriggerDto, type IntegrationTriggerResultDto, type IsConnectedDto, type LinkContentPostData, type LinkContentPostDto, type LinkContentPostError, type LinkContentPostErrors, type LinkContentPostResponse, type LinkContentPostResponses, type ListAutomationFlowPosesData, type ListAutomationFlowPosesError, type ListAutomationFlowPosesErrors, type ListAutomationFlowPosesResponse, type ListAutomationFlowPosesResponses, type ListAutomationFlowsData, type ListAutomationFlowsError, type ListAutomationFlowsErrors, type ListAutomationFlowsResponse, type ListAutomationFlowsResponses, type ListAutomationPoseRunsData, type ListAutomationPoseRunsError, type ListAutomationPoseRunsErrors, type ListAutomationPoseRunsResponse, type ListAutomationPoseRunsResponses, type ListChannelAutomationPosesData, type ListChannelAutomationPosesError, type ListChannelAutomationPosesErrors, type ListChannelAutomationPosesResponse, type ListChannelAutomationPosesResponses, type ListChannelMediaData, type ListChannelMediaError, type ListChannelMediaErrors, type ListChannelMediaResponse, type ListChannelMediaResponses, type ListChannelStoriesData, type ListChannelStoriesError, type ListChannelStoriesErrors, type ListChannelStoriesResponse, type ListChannelStoriesResponses, type ListChannelsData, type ListChannelsError, type ListChannelsErrors, type ListChannelsResponse, type ListChannelsResponses, type ListContentsData, type ListContentsError, type ListContentsErrors, type ListContentsResponse, type ListContentsResponses, type ListConversationsData, type ListConversationsError, type ListConversationsErrors, type ListConversationsResponse, type ListConversationsResponses, type ListGroupsData, type ListGroupsError, type ListGroupsErrors, type ListGroupsResponse, type ListGroupsResponses, type ListHookFamiliesData, type ListHookFamiliesError, type ListHookFamiliesErrors, type ListHookFamiliesResponse, type ListHookFamiliesResponses, type ListMediaCommentsData, type ListMediaCommentsError, type ListMediaCommentsErrors, type ListMediaCommentsResponse, type ListMediaCommentsResponses, type ListMissingMediaData, type ListMissingMediaError, type ListMissingMediaErrors, type ListMissingMediaResponse, type ListMissingMediaResponses, type ListMusicData, type ListMusicError, type ListMusicErrors, type ListMusicPillarsData, type ListMusicPillarsError, type ListMusicPillarsErrors, type ListMusicPillarsResponse, type ListMusicPillarsResponses, type ListMusicResponse, type ListMusicResponses, type ListNotificationsData, type ListNotificationsError, type ListNotificationsErrors, type ListNotificationsResponse, type ListNotificationsResponses, type ListPostsData, type ListPostsError, type ListPostsErrors, type ListPostsResponse, type ListPostsResponses, type ListVideoPerformanceData, type ListVideoPerformanceError, type ListVideoPerformanceErrors, type ListVideoPerformanceResponse, type ListVideoPerformanceResponses, type ListWebhookEventsData, type ListWebhookEventsError, type ListWebhookEventsErrors, type ListWebhookEventsResponse, type ListWebhookEventsResponses, type ListWebhooksData, type ListWebhooksError, type ListWebhooksErrors, type ListWebhooksResponse, type ListWebhooksResponses, type MediaDto, type MediaResponseDto, type MissingContentItemDto, type MoveContentData, type MoveContentDto, type MoveContentError, type MoveContentErrors, type MoveContentResponse, type MoveContentResponses, type MusicImportDto, type MusicImportItemDto, type MusicImportResultDto, type MusicListResultDto, type MusicPillarDto, type MusicTrackDto, Nadia, NadiaError, type NadiaOptions, type NotificationDto, type NotificationsPageDto, type OkDto, type Options, type PollAutomationPoseData, type PollAutomationPoseError, type PollAutomationPoseErrors, type PollAutomationPoseResponse, type PollAutomationPoseResponses, type PollInboxData, type PollInboxError, type PollInboxErrors, type PollInboxResponse, type PollInboxResponses, type PoseAutomationFlowData, type PoseAutomationFlowDto, type PoseAutomationFlowError, type PoseAutomationFlowErrors, type PoseAutomationFlowResponse, type PoseAutomationFlowResponses, type Post, type PostContent, type PostDto, type PostIntegrationSummaryDto, type PostListDto, type PostStatusDto, type PostTagDto, type PreviewAutomationEmailData, type PreviewAutomationEmailError, type PreviewAutomationEmailErrors, type PreviewAutomationEmailResponse, type PreviewAutomationEmailResponses, type PublicCreatePostDto, type ReplaceHookFamiliesData, type ReplaceHookFamiliesError, type ReplaceHookFamiliesErrors, type ReplaceHookFamiliesResponse, type ReplaceHookFamiliesResponses, type ReplayAutomationPoseData, type ReplayAutomationPoseError, type ReplayAutomationPoseErrors, type ReplayAutomationPoseResponse, type ReplayAutomationPoseResponses, type ReplayPoseDto, type ReplyToCommentData, type ReplyToCommentDto, type ReplyToCommentError, type ReplyToCommentErrors, type ReplyToCommentResponse, type ReplyToCommentResponses, type RunChannelToolData, type RunChannelToolError, type RunChannelToolErrors, type RunChannelToolResponse, type RunChannelToolResponses, type SearchHooksData, type SearchHooksError, type SearchHooksErrors, type SearchHooksResponse, type SearchHooksResponses, type SendAutomationTestEmailData, type SendAutomationTestEmailError, type SendAutomationTestEmailErrors, type SendAutomationTestEmailResponse, type SendAutomationTestEmailResponses, type SendDirectMessageData, type SendDirectMessageError, type SendDirectMessageErrors, type SendDirectMessageResponse, type SendDirectMessageResponses, type SendMessageDto, type SetAutomationFlowStatusData, type SetAutomationFlowStatusError, type SetAutomationFlowStatusErrors, type SetAutomationFlowStatusResponse, type SetAutomationFlowStatusResponses, type SetPostReleaseIdData, type SetPostReleaseIdError, type SetPostReleaseIdErrors, type SetPostReleaseIdResponse, type SetPostReleaseIdResponses, type SocialAuthUrlDto, type StartChannelConnectionData, type StartChannelConnectionError, type StartChannelConnectionErrors, type StartChannelConnectionResponse, type StartChannelConnectionResponses, type SubscribeInboxWebhookData, type SubscribeInboxWebhookError, type SubscribeInboxWebhookErrors, type SubscribeInboxWebhookResponse, type SubscribeInboxWebhookResponses, type SuccessDto, type Tags, type UpdateAutomationFlowData, type UpdateAutomationFlowDto, type UpdateAutomationFlowError, type UpdateAutomationFlowErrors, type UpdateAutomationFlowPoseDto, type UpdateAutomationFlowResponse, type UpdateAutomationFlowResponses, type UpdateAutomationPoseData, type UpdateAutomationPoseError, type UpdateAutomationPoseErrors, type UpdateAutomationPoseResponse, type UpdateAutomationPoseResponses, type UpdateContentData, type UpdateContentDto, type UpdateContentError, type UpdateContentErrors, type UpdateContentResponse, type UpdateContentResponses, type UpdateReleaseIdDto, type UploadDto, type UploadFileData, type UploadFileError, type UploadFileErrors, type UploadFileResponse, type UploadFileResponses, type UploadFromUrlData, type UploadFromUrlError, type UploadFromUrlErrors, type UploadFromUrlResponse, type UploadFromUrlResponses, type UploadMusicFileData, type UploadMusicFileError, type UploadMusicFileErrors, type UploadMusicFileResponse, type UploadMusicFileResponses, type UpsertContentData, type UpsertContentDto, type UpsertContentError, type UpsertContentErrors, type UpsertContentResponse, type UpsertContentResponses, type VideoDto, type VideoFunctionDto, type VideoHistoryPageDto, type VideoIdentityDto, type WebhookCreatedDto, type WebhookDto, type WebhookEventDto, type WebhookEventListDto, type WebhooksIntegrationDto, callVideoFunction, changePostStatus, checkConnection, createAutomationFlow, createContent, createPost, createWebhook, Nadia as default, deleteAutomationFlow, deleteAutomationPose, deleteChannel, deleteComment, deleteContent, deletePost, deletePostGroup, deleteWebhook, findSlot, generateVideo, getAccountHistory, getAutomationFlow, getAutomationPose, getChannelAnalytics, getChannelSettings, getContent, getContentsPerformance, getConversation, getHookForms, getMusicTrack, getPostAnalytics, getVideoHistory, getWebhook, hideComment, importHooks, importMusic, linkContentPost, listAutomationFlowPoses, listAutomationFlows, listAutomationPoseRuns, listChannelAutomationPoses, listChannelMedia, listChannelStories, listChannels, listContents, listConversations, listGroups, listHookFamilies, listMediaComments, listMissingMedia, listMusic, listMusicPillars, listNotifications, listPosts, listVideoPerformance, listWebhookEvents, listWebhooks, moveContent, pollAutomationPose, pollInbox, poseAutomationFlow, previewAutomationEmail, replaceHookFamilies, replayAutomationPose, replyToComment, runChannelTool, searchHooks, sendAutomationTestEmail, sendDirectMessage, setAutomationFlowStatus, setPostReleaseId, startChannelConnection, subscribeInboxWebhook, updateAutomationFlow, updateAutomationPose, updateContent, uploadFile, uploadFromUrl, uploadMusicFile, upsertContent };
|
|
4466
|
+
/**
|
|
4467
|
+
* What every webhook delivery carries (the JSON body). `data` depends on
|
|
4468
|
+
* `event` — `nadia.request(listWebhookEvents)` lists the events.
|
|
4469
|
+
*/
|
|
4470
|
+
interface WebhookDelivery<T = unknown> {
|
|
4471
|
+
id: string;
|
|
4472
|
+
event: string;
|
|
4473
|
+
occurredAt: string;
|
|
4474
|
+
organizationId: string;
|
|
4475
|
+
data: T;
|
|
4476
|
+
}
|
|
4477
|
+
interface VerifyWebhookOptions {
|
|
4478
|
+
/** The secret returned once, when the webhook was created. */
|
|
4479
|
+
secret: string;
|
|
4480
|
+
/** The `X-Nadia-Signature` header: `sha256=<hex>`. */
|
|
4481
|
+
signature: string | null | undefined;
|
|
4482
|
+
/** The `X-Nadia-Timestamp` header, epoch seconds. */
|
|
4483
|
+
timestamp: string | number | null | undefined;
|
|
4484
|
+
/** The body exactly as received — not a re-serialized `JSON.parse`. */
|
|
4485
|
+
body: string | Uint8Array;
|
|
4486
|
+
/**
|
|
4487
|
+
* Reject deliveries whose timestamp is further than this from now, in
|
|
4488
|
+
* seconds (a replayed capture). Not checked when left out.
|
|
4489
|
+
*/
|
|
4490
|
+
tolerance?: number;
|
|
4491
|
+
/** Current time in epoch milliseconds — for tests. Defaults to `Date.now()`. */
|
|
4492
|
+
now?: number;
|
|
4493
|
+
}
|
|
4494
|
+
/** Why {@link parseWebhook} refused a delivery. */
|
|
4495
|
+
declare class NadiaWebhookError extends Error {
|
|
4496
|
+
readonly reason: 'missing_header' | 'bad_signature' | 'stale' | 'bad_body';
|
|
4497
|
+
constructor(reason: NadiaWebhookError['reason'], message: string);
|
|
4498
|
+
}
|
|
4499
|
+
/**
|
|
4500
|
+
* True when the delivery was signed with `secret`. Compared in constant time.
|
|
4501
|
+
* Pass the **raw** body: a parsed and re-serialized one will not match.
|
|
4502
|
+
*/
|
|
4503
|
+
declare function verifyWebhookSignature(options: VerifyWebhookOptions): boolean;
|
|
4504
|
+
/**
|
|
4505
|
+
* Verifies a delivery and returns it parsed — or throws `NadiaWebhookError`.
|
|
4506
|
+
* Unlike {@link verifyWebhookSignature}, the timestamp is checked by
|
|
4507
|
+
* default (300 s, the margin a retry needs); `tolerance: Infinity` turns it off.
|
|
4508
|
+
*
|
|
4509
|
+
* `headers` takes a Node `req.headers` object or a `Headers` instance.
|
|
4510
|
+
*/
|
|
4511
|
+
declare function parseWebhook<T = unknown>(options: {
|
|
4512
|
+
secret: string;
|
|
4513
|
+
headers: Headers | Record<string, string | string[] | undefined>;
|
|
4514
|
+
body: string | Uint8Array;
|
|
4515
|
+
tolerance?: number;
|
|
4516
|
+
now?: number;
|
|
4517
|
+
}): WebhookDelivery<T>;
|
|
4518
|
+
|
|
4519
|
+
export { type AccountHistoryItemDto, type AnalyticsMetricDto, type AnalyticsPointDto, type ApiErrorDto, type AutomationFlowCountsDto, type AutomationFlowDto, type AutomationFlowIssueDto, type AutomationFlowPollResultDto, type AutomationFlowPoseResponseDto, type AutomationFlowReplayResultDto, type AutomationFlowResponseDto, type AutomationFlowRunResponseDto, type AutomationFlowStatusDto, type AutomationPoseCountsDto, type AutomationPoseFlowDto, type CallVideoFunctionData, type CallVideoFunctionError, type CallVideoFunctionErrors, type CallVideoFunctionResponse, type CallVideoFunctionResponses, type ChangePostStatusData, type ChangePostStatusDto, type ChangePostStatusError, type ChangePostStatusErrors, type ChangePostStatusResponse, type ChangePostStatusResponses, type CheckConnectionData, type CheckConnectionError, type CheckConnectionErrors, type CheckConnectionResponse, type CheckConnectionResponses, type ClientOptions, type ContentChannelPerformanceDto, type ContentDto, type ContentListItemDto, type ContentPerformanceDto, type ContentPostDto, type ContentStage, type ContentUpsertDto, type CreateAutomationFlowData, type CreateAutomationFlowError, type CreateAutomationFlowErrors, type CreateAutomationFlowResponse, type CreateAutomationFlowResponses, type CreateContentData, type CreateContentDto, type CreateContentError, type CreateContentErrors, type CreateContentResponse, type CreateContentResponses, type CreatePostBody, type CreatePostData, type CreatePostError, type CreatePostErrors, type CreatePostResponse, type CreatePostResponses, type CreatePostResultItemDto, type CreatePublicWebhookDto, type CreateWebhookData, type CreateWebhookError, type CreateWebhookErrors, type CreateWebhookResponse, type CreateWebhookResponses, DEFAULT_BASE_URL, type DeleteAutomationFlowData, type DeleteAutomationFlowError, type DeleteAutomationFlowErrors, type DeleteAutomationFlowResponse, type DeleteAutomationFlowResponses, type DeleteAutomationPoseData, type DeleteAutomationPoseError, type DeleteAutomationPoseErrors, type DeleteAutomationPoseResponse, type DeleteAutomationPoseResponses, type DeleteChannelData, type DeleteChannelError, type DeleteChannelErrors, type DeleteChannelResponse, type DeleteChannelResponses, type DeleteCommentData, type DeleteCommentError, type DeleteCommentErrors, type DeleteCommentResponse, type DeleteCommentResponses, type DeleteContentData, type DeleteContentError, type DeleteContentErrors, type DeleteContentResponse, type DeleteContentResponses, type DeletePostData, type DeletePostError, type DeletePostErrors, type DeletePostGroupData, type DeletePostGroupError, type DeletePostGroupErrors, type DeletePostGroupResponse, type DeletePostGroupResponses, type DeletePostResponse, type DeletePostResponses, type DeleteWebhookData, type DeleteWebhookError, type DeleteWebhookErrors, type DeleteWebhookResponse, type DeleteWebhookResponses, type DeletedIdDto, type EmailPreviewDto, type EmailPreviewDtoResponse, type EmailSentDto, type EmailTestDto, type FindSlotData, type FindSlotDto, type FindSlotError, type FindSlotErrors, type FindSlotResponse, type FindSlotResponses, type GenerateVideoData, type GenerateVideoError, type GenerateVideoErrors, type GenerateVideoResponse, type GenerateVideoResponses, type GeneratedVideoDto, type GetAccountHistoryData, type GetAccountHistoryError, type GetAccountHistoryErrors, type GetAccountHistoryResponse, type GetAccountHistoryResponses, type GetAutomationFlowData, type GetAutomationFlowError, type GetAutomationFlowErrors, type GetAutomationFlowResponse, type GetAutomationFlowResponses, type GetAutomationPoseData, type GetAutomationPoseError, type GetAutomationPoseErrors, type GetAutomationPoseResponse, type GetAutomationPoseResponses, type GetChannelAnalyticsData, type GetChannelAnalyticsError, type GetChannelAnalyticsErrors, type GetChannelAnalyticsResponse, type GetChannelAnalyticsResponses, type GetChannelSettingsData, type GetChannelSettingsError, type GetChannelSettingsErrors, type GetChannelSettingsResponse, type GetChannelSettingsResponses, type GetContentData, type GetContentError, type GetContentErrors, type GetContentResponse, type GetContentResponses, type GetContentsPerformanceData, type GetContentsPerformanceError, type GetContentsPerformanceErrors, type GetContentsPerformanceResponse, type GetContentsPerformanceResponses, type GetConversationData, type GetConversationError, type GetConversationErrors, type GetConversationResponse, type GetConversationResponses, type GetHookFormsData, type GetHookFormsError, type GetHookFormsErrors, type GetHookFormsResponse, type GetHookFormsResponses, type GetMusicTrackData, type GetMusicTrackError, type GetMusicTrackErrors, type GetMusicTrackResponse, type GetMusicTrackResponses, type GetPostAnalyticsData, type GetPostAnalyticsError, type GetPostAnalyticsErrors, type GetPostAnalyticsResponse, type GetPostAnalyticsResponses, type GetVideoHistoryData, type GetVideoHistoryError, type GetVideoHistoryErrors, type GetVideoHistoryResponse, type GetVideoHistoryResponses, type GetWebhookData, type GetWebhookError, type GetWebhookErrors, type GetWebhookResponse, type GetWebhookResponses, type GroupDto, type HideCommentData, type HideCommentDto, type HideCommentError, type HideCommentErrors, type HideCommentResponse, type HideCommentResponses, type HistoryPageDto, type HookDto, type HookFamiliesImportDto, type HookFamilyDto, type HookFamilyStatDto, type HookFormDto, type HookImportItemDto, type HooksImportDto, type HooksImportResultDto, type HooksSearchResultDto, type ImportHooksData, type ImportHooksError, type ImportHooksErrors, type ImportHooksResponse, type ImportHooksResponses, type ImportMusicData, type ImportMusicError, type ImportMusicErrors, type ImportMusicResponse, type ImportMusicResponses, type InboxConversationDto, type InboxMessageDto, type InboxParticipantDto, type InboxPollResultDto, type InstagramCommentAuthorDto, type InstagramCommentDto, type InstagramMediaDto, type Integration, type IntegrationListItemDto, type IntegrationSettingsDto, type IntegrationSettingsOutputDto, type IntegrationToolDto, type IntegrationToolParamDto, type IntegrationTriggerDto, type IntegrationTriggerResultDto, type IsConnectedDto, type LinkContentPostData, type LinkContentPostDto, type LinkContentPostError, type LinkContentPostErrors, type LinkContentPostResponse, type LinkContentPostResponses, type ListAutomationFlowPosesData, type ListAutomationFlowPosesError, type ListAutomationFlowPosesErrors, type ListAutomationFlowPosesResponse, type ListAutomationFlowPosesResponses, type ListAutomationFlowsData, type ListAutomationFlowsError, type ListAutomationFlowsErrors, type ListAutomationFlowsResponse, type ListAutomationFlowsResponses, type ListAutomationPoseRunsData, type ListAutomationPoseRunsError, type ListAutomationPoseRunsErrors, type ListAutomationPoseRunsResponse, type ListAutomationPoseRunsResponses, type ListChannelAutomationPosesData, type ListChannelAutomationPosesError, type ListChannelAutomationPosesErrors, type ListChannelAutomationPosesResponse, type ListChannelAutomationPosesResponses, type ListChannelMediaData, type ListChannelMediaError, type ListChannelMediaErrors, type ListChannelMediaResponse, type ListChannelMediaResponses, type ListChannelStoriesData, type ListChannelStoriesError, type ListChannelStoriesErrors, type ListChannelStoriesResponse, type ListChannelStoriesResponses, type ListChannelsData, type ListChannelsError, type ListChannelsErrors, type ListChannelsResponse, type ListChannelsResponses, type ListContentsData, type ListContentsError, type ListContentsErrors, type ListContentsResponse, type ListContentsResponses, type ListConversationsData, type ListConversationsError, type ListConversationsErrors, type ListConversationsResponse, type ListConversationsResponses, type ListGroupsData, type ListGroupsError, type ListGroupsErrors, type ListGroupsResponse, type ListGroupsResponses, type ListHookFamiliesData, type ListHookFamiliesError, type ListHookFamiliesErrors, type ListHookFamiliesResponse, type ListHookFamiliesResponses, type ListMediaCommentsData, type ListMediaCommentsError, type ListMediaCommentsErrors, type ListMediaCommentsResponse, type ListMediaCommentsResponses, type ListMissingMediaData, type ListMissingMediaError, type ListMissingMediaErrors, type ListMissingMediaResponse, type ListMissingMediaResponses, type ListMusicData, type ListMusicError, type ListMusicErrors, type ListMusicPillarsData, type ListMusicPillarsError, type ListMusicPillarsErrors, type ListMusicPillarsResponse, type ListMusicPillarsResponses, type ListMusicResponse, type ListMusicResponses, type ListNotificationsData, type ListNotificationsError, type ListNotificationsErrors, type ListNotificationsResponse, type ListNotificationsResponses, type ListPostsData, type ListPostsError, type ListPostsErrors, type ListPostsResponse, type ListPostsResponses, type ListVideoPerformanceData, type ListVideoPerformanceError, type ListVideoPerformanceErrors, type ListVideoPerformanceResponse, type ListVideoPerformanceResponses, type ListWebhookEventsData, type ListWebhookEventsError, type ListWebhookEventsErrors, type ListWebhookEventsResponse, type ListWebhookEventsResponses, type ListWebhooksData, type ListWebhooksError, type ListWebhooksErrors, type ListWebhooksResponse, type ListWebhooksResponses, type MediaDto, type MediaResponseDto, type MissingContentItemDto, type MoveContentData, type MoveContentDto, type MoveContentError, type MoveContentErrors, type MoveContentResponse, type MoveContentResponses, type MusicImportDto, type MusicImportItemDto, type MusicImportResultDto, type MusicListResultDto, type MusicPillarDto, type MusicTrackDto, Nadia, NadiaError, type NadiaOptions, NadiaWebhookError, type NotificationDto, type NotificationsPageDto, type OkDto, type Options, type PollAutomationPoseData, type PollAutomationPoseError, type PollAutomationPoseErrors, type PollAutomationPoseResponse, type PollAutomationPoseResponses, type PollInboxData, type PollInboxError, type PollInboxErrors, type PollInboxResponse, type PollInboxResponses, type PoseAutomationFlowData, type PoseAutomationFlowDto, type PoseAutomationFlowError, type PoseAutomationFlowErrors, type PoseAutomationFlowResponse, type PoseAutomationFlowResponses, type Post, type PostContent, type PostDto, type PostIntegrationSummaryDto, type PostListDto, type PostStatusDto, type PostTagDto, type PreviewAutomationEmailData, type PreviewAutomationEmailError, type PreviewAutomationEmailErrors, type PreviewAutomationEmailResponse, type PreviewAutomationEmailResponses, type PublicCreatePostDto, type ReplaceHookFamiliesData, type ReplaceHookFamiliesError, type ReplaceHookFamiliesErrors, type ReplaceHookFamiliesResponse, type ReplaceHookFamiliesResponses, type ReplayAutomationPoseData, type ReplayAutomationPoseError, type ReplayAutomationPoseErrors, type ReplayAutomationPoseResponse, type ReplayAutomationPoseResponses, type ReplayPoseDto, type ReplyToCommentData, type ReplyToCommentDto, type ReplyToCommentError, type ReplyToCommentErrors, type ReplyToCommentResponse, type ReplyToCommentResponses, type RunChannelToolData, type RunChannelToolError, type RunChannelToolErrors, type RunChannelToolResponse, type RunChannelToolResponses, type SearchHooksData, type SearchHooksError, type SearchHooksErrors, type SearchHooksResponse, type SearchHooksResponses, type SendAutomationTestEmailData, type SendAutomationTestEmailError, type SendAutomationTestEmailErrors, type SendAutomationTestEmailResponse, type SendAutomationTestEmailResponses, type SendDirectMessageData, type SendDirectMessageError, type SendDirectMessageErrors, type SendDirectMessageResponse, type SendDirectMessageResponses, type SendMessageDto, type SetAutomationFlowStatusData, type SetAutomationFlowStatusError, type SetAutomationFlowStatusErrors, type SetAutomationFlowStatusResponse, type SetAutomationFlowStatusResponses, type SetPostReleaseIdData, type SetPostReleaseIdError, type SetPostReleaseIdErrors, type SetPostReleaseIdResponse, type SetPostReleaseIdResponses, type SocialAuthUrlDto, type StartChannelConnectionData, type StartChannelConnectionError, type StartChannelConnectionErrors, type StartChannelConnectionResponse, type StartChannelConnectionResponses, type SubscribeInboxWebhookData, type SubscribeInboxWebhookError, type SubscribeInboxWebhookErrors, type SubscribeInboxWebhookResponse, type SubscribeInboxWebhookResponses, type SuccessDto, type Tags, type TestWebhookData, type TestWebhookDto, type TestWebhookError, type TestWebhookErrors, type TestWebhookResponse, type TestWebhookResponses, type UpdateAutomationFlowData, type UpdateAutomationFlowDto, type UpdateAutomationFlowError, type UpdateAutomationFlowErrors, type UpdateAutomationFlowPoseDto, type UpdateAutomationFlowResponse, type UpdateAutomationFlowResponses, type UpdateAutomationPoseData, type UpdateAutomationPoseError, type UpdateAutomationPoseErrors, type UpdateAutomationPoseResponse, type UpdateAutomationPoseResponses, type UpdateContentData, type UpdateContentDto, type UpdateContentError, type UpdateContentErrors, type UpdateContentResponse, type UpdateContentResponses, type UpdateReleaseIdDto, type UploadDto, type UploadFileData, type UploadFileError, type UploadFileErrors, type UploadFileResponse, type UploadFileResponses, type UploadFromUrlData, type UploadFromUrlError, type UploadFromUrlErrors, type UploadFromUrlResponse, type UploadFromUrlResponses, type UploadMusicFileData, type UploadMusicFileError, type UploadMusicFileErrors, type UploadMusicFileResponse, type UploadMusicFileResponses, type UpsertContentData, type UpsertContentDto, type UpsertContentError, type UpsertContentErrors, type UpsertContentResponse, type UpsertContentResponses, type VerifyWebhookOptions, type VideoDto, type VideoFunctionDto, type VideoHistoryPageDto, type VideoIdentityDto, type WebhookCreatedDto, type WebhookDelivery, type WebhookDto, type WebhookEventDto, type WebhookEventListDto, type WebhookTestResultDto, type WebhooksIntegrationDto, callVideoFunction, changePostStatus, checkConnection, createAutomationFlow, createContent, createPost, createWebhook, Nadia as default, deleteAutomationFlow, deleteAutomationPose, deleteChannel, deleteComment, deleteContent, deletePost, deletePostGroup, deleteWebhook, findSlot, generateVideo, getAccountHistory, getAutomationFlow, getAutomationPose, getChannelAnalytics, getChannelSettings, getContent, getContentsPerformance, getConversation, getHookForms, getMusicTrack, getPostAnalytics, getVideoHistory, getWebhook, hideComment, importHooks, importMusic, linkContentPost, listAutomationFlowPoses, listAutomationFlows, listAutomationPoseRuns, listChannelAutomationPoses, listChannelMedia, listChannelStories, listChannels, listContents, listConversations, listGroups, listHookFamilies, listMediaComments, listMissingMedia, listMusic, listMusicPillars, listNotifications, listPosts, listVideoPerformance, listWebhookEvents, listWebhooks, moveContent, parseWebhook, pollAutomationPose, pollInbox, poseAutomationFlow, previewAutomationEmail, replaceHookFamilies, replayAutomationPose, replyToComment, runChannelTool, searchHooks, sendAutomationTestEmail, sendDirectMessage, setAutomationFlowStatus, setPostReleaseId, startChannelConnection, subscribeInboxWebhook, testWebhook, updateAutomationFlow, updateAutomationPose, updateContent, uploadFile, uploadFromUrl, uploadMusicFile, upsertContent, verifyWebhookSignature };
|