getricky 0.1.28 → 0.1.29
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/dist/cjs/generated/index.d.ts +1 -1
- package/dist/cjs/generated/sdk.gen.d.ts +9 -1
- package/dist/cjs/generated/sdk.gen.js +15 -0
- package/dist/cjs/generated/types.gen.d.ts +1125 -807
- package/dist/esm/generated/index.d.ts +1 -1
- package/dist/esm/generated/sdk.gen.d.ts +9 -1
- package/dist/esm/generated/sdk.gen.js +15 -0
- package/dist/esm/generated/types.gen.d.ts +1125 -807
- package/package.json +4 -1
|
@@ -26,233 +26,834 @@ export type Error = {
|
|
|
26
26
|
};
|
|
27
27
|
};
|
|
28
28
|
/**
|
|
29
|
-
*
|
|
29
|
+
* The ad as Ricky's Meta Ads sync last stored it, matched by `ad_id`. It is Ricky's lookup in the connected ad account, not part of the message Meta sent. `GET /ads/ads` reads the same ad live from Meta.
|
|
30
30
|
*/
|
|
31
|
-
export type
|
|
31
|
+
export type AdReferralResolution = {
|
|
32
|
+
/**
|
|
33
|
+
* Name of the ad in Meta.
|
|
34
|
+
*/
|
|
35
|
+
ad_name: string | null;
|
|
32
36
|
/**
|
|
33
37
|
* Campaign ID at Meta.
|
|
34
38
|
*/
|
|
35
|
-
|
|
39
|
+
campaign_id: string | null;
|
|
36
40
|
/**
|
|
37
|
-
*
|
|
41
|
+
* Campaign name in Meta.
|
|
38
42
|
*/
|
|
39
|
-
|
|
43
|
+
campaign_name: string | null;
|
|
40
44
|
/**
|
|
41
|
-
*
|
|
45
|
+
* Ad set ID at Meta.
|
|
42
46
|
*/
|
|
43
|
-
|
|
47
|
+
ad_set_id: string | null;
|
|
44
48
|
/**
|
|
45
|
-
*
|
|
49
|
+
* Ad set name in Meta.
|
|
46
50
|
*/
|
|
47
|
-
|
|
51
|
+
ad_set_name: string | null;
|
|
48
52
|
/**
|
|
49
|
-
*
|
|
53
|
+
* Ad account ID at Meta.
|
|
50
54
|
*/
|
|
51
|
-
|
|
55
|
+
ad_account_id: string | null;
|
|
52
56
|
/**
|
|
53
|
-
*
|
|
57
|
+
* When Ricky last synced this ad from Meta.
|
|
54
58
|
*/
|
|
55
|
-
|
|
59
|
+
synced_at: string | null;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* A Meta ad a customer came from: an inbound message whose Meta referral names an ad (Click to WhatsApp, Instagram or Messenger ads). The same definition as `GET /reports/ads`.
|
|
63
|
+
*/
|
|
64
|
+
export type AdReferral = {
|
|
56
65
|
/**
|
|
57
|
-
* `
|
|
66
|
+
* Meta's ID of the ad, as Meta sent it in the message's referral: WhatsApp `source_id`, Instagram and Messenger `ad_id`. The same ID as `GET /ads/ads` and `ad_id` in `GET /ads/insights`.
|
|
58
67
|
*/
|
|
59
|
-
|
|
68
|
+
ad_id: string;
|
|
60
69
|
/**
|
|
61
|
-
*
|
|
70
|
+
* Channel the customer wrote on.
|
|
62
71
|
*/
|
|
63
|
-
|
|
72
|
+
channel: 'whatsapp' | 'instagram' | 'messenger' | 'webchat';
|
|
64
73
|
/**
|
|
65
|
-
*
|
|
74
|
+
* The customer message that carried the referral.
|
|
66
75
|
*/
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Daily budget in the account currency; null when not set.
|
|
70
|
-
*/
|
|
71
|
-
daily: number | null;
|
|
72
|
-
/**
|
|
73
|
-
* Lifetime budget in the account currency; null when not set.
|
|
74
|
-
*/
|
|
75
|
-
lifetime: number | null;
|
|
76
|
-
/**
|
|
77
|
-
* Budget left in the account currency.
|
|
78
|
-
*/
|
|
79
|
-
remaining: number | null;
|
|
80
|
-
};
|
|
76
|
+
message_id: string;
|
|
81
77
|
/**
|
|
82
|
-
*
|
|
78
|
+
* Conversation of that message.
|
|
83
79
|
*/
|
|
84
|
-
|
|
80
|
+
conversation_id: string;
|
|
81
|
+
contact_id: string | null;
|
|
85
82
|
/**
|
|
86
|
-
*
|
|
83
|
+
* When the customer sent that message.
|
|
87
84
|
*/
|
|
88
|
-
|
|
85
|
+
referred_at: string;
|
|
89
86
|
/**
|
|
90
|
-
*
|
|
87
|
+
* Meta's kind of source: WhatsApp's `source_type` (`ad`) or Instagram and Messenger's `source` (`ADS`).
|
|
91
88
|
*/
|
|
92
|
-
|
|
89
|
+
source_type: string | null;
|
|
93
90
|
/**
|
|
94
|
-
*
|
|
91
|
+
* Link to the ad's post on Facebook or Instagram, as Meta sent it. WhatsApp only.
|
|
95
92
|
*/
|
|
96
|
-
|
|
97
|
-
};
|
|
98
|
-
/**
|
|
99
|
-
* An ad set of a connected ad account.
|
|
100
|
-
*/
|
|
101
|
-
export type MetaAdsAdSet = {
|
|
93
|
+
source_url: string | null;
|
|
102
94
|
/**
|
|
103
|
-
*
|
|
95
|
+
* The ad's title as Meta sent it: WhatsApp `headline`, Instagram and Messenger `ads_context_data.ad_title`.
|
|
104
96
|
*/
|
|
105
|
-
|
|
97
|
+
headline: string | null;
|
|
106
98
|
/**
|
|
107
|
-
*
|
|
99
|
+
* The ad's text as Meta sent it. WhatsApp only.
|
|
108
100
|
*/
|
|
109
|
-
|
|
101
|
+
body: string | null;
|
|
110
102
|
/**
|
|
111
|
-
*
|
|
103
|
+
* `image` or `video`, as Meta sent it. WhatsApp only.
|
|
112
104
|
*/
|
|
113
|
-
|
|
105
|
+
media_type: string | null;
|
|
114
106
|
/**
|
|
115
|
-
*
|
|
107
|
+
* The ad's image: Ricky's permanent copy of the image Meta sent, else Meta's own link while it has not expired; null otherwise.
|
|
116
108
|
*/
|
|
117
|
-
|
|
109
|
+
image_url: string | null;
|
|
118
110
|
/**
|
|
119
|
-
*
|
|
111
|
+
* Meta's link to the ad's video, as Meta sent it; it can expire.
|
|
120
112
|
*/
|
|
121
|
-
|
|
113
|
+
video_url: string | null;
|
|
122
114
|
/**
|
|
123
|
-
*
|
|
115
|
+
* Meta's click ID of the Click to WhatsApp ad, as Meta sent it; send it back to Meta's Conversions API to attribute an event. WhatsApp only.
|
|
124
116
|
*/
|
|
125
|
-
|
|
117
|
+
ctwa_clid: string | null;
|
|
126
118
|
/**
|
|
127
|
-
*
|
|
119
|
+
* The `ref` parameter of the ad link, as Meta sent it. Instagram and Messenger only.
|
|
128
120
|
*/
|
|
129
|
-
|
|
121
|
+
ref: string | null;
|
|
130
122
|
/**
|
|
131
|
-
*
|
|
123
|
+
* The ad's name, campaign and ad set from Ricky's Meta Ads sync; null when the ad is not in a connected ad account Ricky has synced.
|
|
132
124
|
*/
|
|
133
|
-
|
|
125
|
+
resolved: AdReferralResolution | null;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* The days a report covers, in America/Panama time, and the period it is compared with.
|
|
129
|
+
*/
|
|
130
|
+
export type ReportPeriod = {
|
|
134
131
|
/**
|
|
135
|
-
*
|
|
132
|
+
* First day, inclusive.
|
|
136
133
|
*/
|
|
137
|
-
|
|
134
|
+
from: string;
|
|
138
135
|
/**
|
|
139
|
-
*
|
|
136
|
+
* Last day, inclusive. A `to` after today is today.
|
|
140
137
|
*/
|
|
141
|
-
|
|
142
|
-
/**
|
|
143
|
-
* Daily budget in the account currency; null when not set.
|
|
144
|
-
*/
|
|
145
|
-
daily: number | null;
|
|
146
|
-
/**
|
|
147
|
-
* Lifetime budget in the account currency; null when not set.
|
|
148
|
-
*/
|
|
149
|
-
lifetime: number | null;
|
|
150
|
-
/**
|
|
151
|
-
* Budget left in the account currency.
|
|
152
|
-
*/
|
|
153
|
-
remaining: number | null;
|
|
154
|
-
};
|
|
138
|
+
to: string;
|
|
155
139
|
/**
|
|
156
|
-
*
|
|
140
|
+
* Days in the period.
|
|
157
141
|
*/
|
|
158
|
-
|
|
142
|
+
days: number;
|
|
159
143
|
/**
|
|
160
|
-
*
|
|
144
|
+
* `hour` when the period is one day: series then have 24 hourly slots.
|
|
161
145
|
*/
|
|
162
|
-
|
|
146
|
+
granularity: 'day' | 'hour';
|
|
163
147
|
/**
|
|
164
|
-
*
|
|
148
|
+
* The time zone of every day and hour in the report.
|
|
165
149
|
*/
|
|
166
|
-
|
|
150
|
+
time_zone: 'America/Panama';
|
|
167
151
|
/**
|
|
168
|
-
*
|
|
152
|
+
* First day of the previous period: the same number of days, right before.
|
|
169
153
|
*/
|
|
170
|
-
|
|
154
|
+
previous_from: string;
|
|
171
155
|
/**
|
|
172
|
-
*
|
|
156
|
+
* Last day of the previous period.
|
|
173
157
|
*/
|
|
174
|
-
|
|
158
|
+
previous_to: string;
|
|
175
159
|
};
|
|
176
160
|
/**
|
|
177
|
-
*
|
|
161
|
+
* How many customers write, whether they are new, and when. Only messages customers send count: a customer is a conversation with at least one of them in the period, and it is new when its first message ever falls in the period. Messages from the team, AI agents or campaigns and conversation openings and closes play no part.
|
|
178
162
|
*/
|
|
179
|
-
export type
|
|
180
|
-
|
|
181
|
-
* Ad ID at Meta.
|
|
182
|
-
*/
|
|
183
|
-
id: string;
|
|
184
|
-
/**
|
|
185
|
-
* Ad account ID at Meta.
|
|
186
|
-
*/
|
|
187
|
-
account_id: string;
|
|
188
|
-
/**
|
|
189
|
-
* Campaign ID at Meta.
|
|
190
|
-
*/
|
|
191
|
-
campaign_id: string;
|
|
192
|
-
/**
|
|
193
|
-
* Ad set ID at Meta.
|
|
194
|
-
*/
|
|
195
|
-
ad_set_id: string;
|
|
163
|
+
export type ConversationsReport = {
|
|
164
|
+
period: ReportPeriod;
|
|
196
165
|
/**
|
|
197
|
-
*
|
|
166
|
+
* The channel filter the report applied.
|
|
198
167
|
*/
|
|
199
|
-
|
|
168
|
+
channel: 'all' | 'whatsapp' | 'instagram' | 'messenger' | 'webchat';
|
|
200
169
|
/**
|
|
201
|
-
*
|
|
170
|
+
* The period.
|
|
202
171
|
*/
|
|
203
|
-
|
|
172
|
+
totals: {
|
|
173
|
+
/**
|
|
174
|
+
* Conversations with at least one customer message in the period.
|
|
175
|
+
*/
|
|
176
|
+
customers: number;
|
|
177
|
+
/**
|
|
178
|
+
* Customers whose first message ever falls in the period.
|
|
179
|
+
*/
|
|
180
|
+
new_customers: number;
|
|
181
|
+
/**
|
|
182
|
+
* Customers who had written before the period.
|
|
183
|
+
*/
|
|
184
|
+
returning_customers: number;
|
|
185
|
+
/**
|
|
186
|
+
* Messages customers sent in the period.
|
|
187
|
+
*/
|
|
188
|
+
messages: number;
|
|
189
|
+
};
|
|
204
190
|
/**
|
|
205
|
-
*
|
|
191
|
+
* The previous period.
|
|
206
192
|
*/
|
|
207
|
-
|
|
193
|
+
previous: {
|
|
194
|
+
/**
|
|
195
|
+
* Conversations with at least one customer message in the period.
|
|
196
|
+
*/
|
|
197
|
+
customers: number;
|
|
198
|
+
/**
|
|
199
|
+
* Customers whose first message ever falls in the period.
|
|
200
|
+
*/
|
|
201
|
+
new_customers: number;
|
|
202
|
+
/**
|
|
203
|
+
* Customers who had written before the period.
|
|
204
|
+
*/
|
|
205
|
+
returning_customers: number;
|
|
206
|
+
/**
|
|
207
|
+
* Messages customers sent in the period.
|
|
208
|
+
*/
|
|
209
|
+
messages: number;
|
|
210
|
+
};
|
|
208
211
|
/**
|
|
209
|
-
* The
|
|
212
|
+
* The period per channel, most customers first.
|
|
210
213
|
*/
|
|
211
|
-
|
|
214
|
+
by_channel: Array<{
|
|
212
215
|
/**
|
|
213
|
-
*
|
|
216
|
+
* Channel.
|
|
214
217
|
*/
|
|
215
|
-
|
|
218
|
+
channel: 'whatsapp' | 'instagram' | 'messenger' | 'webchat';
|
|
216
219
|
/**
|
|
217
|
-
*
|
|
220
|
+
* Conversations with at least one customer message in the period.
|
|
218
221
|
*/
|
|
219
|
-
|
|
222
|
+
customers: number;
|
|
220
223
|
/**
|
|
221
|
-
*
|
|
224
|
+
* Customers whose first message ever falls in the period.
|
|
222
225
|
*/
|
|
223
|
-
|
|
226
|
+
new_customers: number;
|
|
224
227
|
/**
|
|
225
|
-
*
|
|
228
|
+
* Customers who had written before the period.
|
|
226
229
|
*/
|
|
227
|
-
|
|
230
|
+
returning_customers: number;
|
|
228
231
|
/**
|
|
229
|
-
*
|
|
232
|
+
* Messages customers sent in the period.
|
|
230
233
|
*/
|
|
231
|
-
|
|
234
|
+
messages: number;
|
|
235
|
+
}>;
|
|
236
|
+
/**
|
|
237
|
+
* One entry per day of the period, or per hour of a one-day period.
|
|
238
|
+
*/
|
|
239
|
+
series: Array<{
|
|
232
240
|
/**
|
|
233
|
-
*
|
|
241
|
+
* America/Panama day `YYYY-MM-DD`, or hour `YYYY-MM-DDTHH` when the period is one day.
|
|
234
242
|
*/
|
|
235
|
-
|
|
243
|
+
slot: string;
|
|
236
244
|
/**
|
|
237
|
-
*
|
|
245
|
+
* Customers whose first message ever falls in this slot.
|
|
238
246
|
*/
|
|
239
|
-
|
|
247
|
+
new_customers: number;
|
|
240
248
|
/**
|
|
241
|
-
*
|
|
249
|
+
* Customers who wrote in this slot and had written before.
|
|
242
250
|
*/
|
|
243
|
-
|
|
244
|
-
|
|
251
|
+
returning_customers: number;
|
|
252
|
+
previous_customers: number | null;
|
|
253
|
+
}>;
|
|
245
254
|
/**
|
|
246
|
-
*
|
|
255
|
+
* Customer messages of the period per weekday and hour; slots without any are left out.
|
|
247
256
|
*/
|
|
248
|
-
|
|
257
|
+
heatmap: Array<{
|
|
258
|
+
/**
|
|
259
|
+
* 0 is Sunday, 6 is Saturday.
|
|
260
|
+
*/
|
|
261
|
+
day_of_week: number;
|
|
262
|
+
/**
|
|
263
|
+
* Hour of the day, 0–23.
|
|
264
|
+
*/
|
|
265
|
+
hour: number;
|
|
266
|
+
/**
|
|
267
|
+
* Customer messages in that hour of that weekday.
|
|
268
|
+
*/
|
|
269
|
+
messages: number;
|
|
270
|
+
}>;
|
|
249
271
|
/**
|
|
250
|
-
*
|
|
272
|
+
* When Ricky computed the report.
|
|
251
273
|
*/
|
|
252
|
-
|
|
274
|
+
generated_at: string;
|
|
253
275
|
};
|
|
254
276
|
/**
|
|
255
|
-
*
|
|
277
|
+
* Messages received from customers and sent to them in the period, and who sent them, dated when each message was sent.
|
|
278
|
+
*/
|
|
279
|
+
export type MessagesReport = {
|
|
280
|
+
period: ReportPeriod;
|
|
281
|
+
/**
|
|
282
|
+
* The channel filter the report applied.
|
|
283
|
+
*/
|
|
284
|
+
channel: 'all' | 'whatsapp' | 'instagram' | 'messenger' | 'webchat';
|
|
285
|
+
/**
|
|
286
|
+
* The period.
|
|
287
|
+
*/
|
|
288
|
+
totals: {
|
|
289
|
+
/**
|
|
290
|
+
* Messages customers sent.
|
|
291
|
+
*/
|
|
292
|
+
received: number;
|
|
293
|
+
/**
|
|
294
|
+
* Messages sent to customers, by anyone; the sum of `sent_by`.
|
|
295
|
+
*/
|
|
296
|
+
sent: number;
|
|
297
|
+
/**
|
|
298
|
+
* Sent messages by sender; each message counts in one of them.
|
|
299
|
+
*/
|
|
300
|
+
sent_by: {
|
|
301
|
+
/**
|
|
302
|
+
* Sent by a person in Ricky.
|
|
303
|
+
*/
|
|
304
|
+
human: number;
|
|
305
|
+
/**
|
|
306
|
+
* Sent by an AI agent.
|
|
307
|
+
*/
|
|
308
|
+
ai: number;
|
|
309
|
+
/**
|
|
310
|
+
* Sent by an automation.
|
|
311
|
+
*/
|
|
312
|
+
automation: number;
|
|
313
|
+
/**
|
|
314
|
+
* Templates not sent by an automation: broadcasts and templates sent by hand or through the API.
|
|
315
|
+
*/
|
|
316
|
+
campaign: number;
|
|
317
|
+
/**
|
|
318
|
+
* Sent from the channel's own app, with no sender in Ricky: WhatsApp Business app coexistence and imported history.
|
|
319
|
+
*/
|
|
320
|
+
external: number;
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
/**
|
|
324
|
+
* The previous period.
|
|
325
|
+
*/
|
|
326
|
+
previous: {
|
|
327
|
+
/**
|
|
328
|
+
* Messages customers sent.
|
|
329
|
+
*/
|
|
330
|
+
received: number;
|
|
331
|
+
/**
|
|
332
|
+
* Messages sent to customers, by anyone; the sum of `sent_by`.
|
|
333
|
+
*/
|
|
334
|
+
sent: number;
|
|
335
|
+
/**
|
|
336
|
+
* Sent messages by sender; each message counts in one of them.
|
|
337
|
+
*/
|
|
338
|
+
sent_by: {
|
|
339
|
+
/**
|
|
340
|
+
* Sent by a person in Ricky.
|
|
341
|
+
*/
|
|
342
|
+
human: number;
|
|
343
|
+
/**
|
|
344
|
+
* Sent by an AI agent.
|
|
345
|
+
*/
|
|
346
|
+
ai: number;
|
|
347
|
+
/**
|
|
348
|
+
* Sent by an automation.
|
|
349
|
+
*/
|
|
350
|
+
automation: number;
|
|
351
|
+
/**
|
|
352
|
+
* Templates not sent by an automation: broadcasts and templates sent by hand or through the API.
|
|
353
|
+
*/
|
|
354
|
+
campaign: number;
|
|
355
|
+
/**
|
|
356
|
+
* Sent from the channel's own app, with no sender in Ricky: WhatsApp Business app coexistence and imported history.
|
|
357
|
+
*/
|
|
358
|
+
external: number;
|
|
359
|
+
};
|
|
360
|
+
};
|
|
361
|
+
/**
|
|
362
|
+
* The period per channel, most messages first.
|
|
363
|
+
*/
|
|
364
|
+
by_channel: Array<{
|
|
365
|
+
/**
|
|
366
|
+
* Channel.
|
|
367
|
+
*/
|
|
368
|
+
channel: 'whatsapp' | 'instagram' | 'messenger' | 'webchat';
|
|
369
|
+
/**
|
|
370
|
+
* Messages customers sent.
|
|
371
|
+
*/
|
|
372
|
+
received: number;
|
|
373
|
+
/**
|
|
374
|
+
* Messages sent to customers, by anyone; the sum of `sent_by`.
|
|
375
|
+
*/
|
|
376
|
+
sent: number;
|
|
377
|
+
/**
|
|
378
|
+
* Sent messages by sender; each message counts in one of them.
|
|
379
|
+
*/
|
|
380
|
+
sent_by: {
|
|
381
|
+
/**
|
|
382
|
+
* Sent by a person in Ricky.
|
|
383
|
+
*/
|
|
384
|
+
human: number;
|
|
385
|
+
/**
|
|
386
|
+
* Sent by an AI agent.
|
|
387
|
+
*/
|
|
388
|
+
ai: number;
|
|
389
|
+
/**
|
|
390
|
+
* Sent by an automation.
|
|
391
|
+
*/
|
|
392
|
+
automation: number;
|
|
393
|
+
/**
|
|
394
|
+
* Templates not sent by an automation: broadcasts and templates sent by hand or through the API.
|
|
395
|
+
*/
|
|
396
|
+
campaign: number;
|
|
397
|
+
/**
|
|
398
|
+
* Sent from the channel's own app, with no sender in Ricky: WhatsApp Business app coexistence and imported history.
|
|
399
|
+
*/
|
|
400
|
+
external: number;
|
|
401
|
+
};
|
|
402
|
+
}>;
|
|
403
|
+
/**
|
|
404
|
+
* One entry per day of the period, or per hour of a one-day period.
|
|
405
|
+
*/
|
|
406
|
+
series: Array<{
|
|
407
|
+
/**
|
|
408
|
+
* America/Panama day `YYYY-MM-DD`, or hour `YYYY-MM-DDTHH` when the period is one day.
|
|
409
|
+
*/
|
|
410
|
+
slot: string;
|
|
411
|
+
/**
|
|
412
|
+
* Messages customers sent.
|
|
413
|
+
*/
|
|
414
|
+
received: number;
|
|
415
|
+
/**
|
|
416
|
+
* Messages sent to customers, by anyone; the sum of `sent_by`.
|
|
417
|
+
*/
|
|
418
|
+
sent: number;
|
|
419
|
+
/**
|
|
420
|
+
* Sent messages by sender; each message counts in one of them.
|
|
421
|
+
*/
|
|
422
|
+
sent_by: {
|
|
423
|
+
/**
|
|
424
|
+
* Sent by a person in Ricky.
|
|
425
|
+
*/
|
|
426
|
+
human: number;
|
|
427
|
+
/**
|
|
428
|
+
* Sent by an AI agent.
|
|
429
|
+
*/
|
|
430
|
+
ai: number;
|
|
431
|
+
/**
|
|
432
|
+
* Sent by an automation.
|
|
433
|
+
*/
|
|
434
|
+
automation: number;
|
|
435
|
+
/**
|
|
436
|
+
* Templates not sent by an automation: broadcasts and templates sent by hand or through the API.
|
|
437
|
+
*/
|
|
438
|
+
campaign: number;
|
|
439
|
+
/**
|
|
440
|
+
* Sent from the channel's own app, with no sender in Ricky: WhatsApp Business app coexistence and imported history.
|
|
441
|
+
*/
|
|
442
|
+
external: number;
|
|
443
|
+
};
|
|
444
|
+
previous_received: number | null;
|
|
445
|
+
previous_sent: number | null;
|
|
446
|
+
}>;
|
|
447
|
+
/**
|
|
448
|
+
* When Ricky computed the report.
|
|
449
|
+
*/
|
|
450
|
+
generated_at: string;
|
|
451
|
+
};
|
|
452
|
+
/**
|
|
453
|
+
* What the inbox looks like right now; it has no period.
|
|
454
|
+
*/
|
|
455
|
+
export type DashboardReport = {
|
|
456
|
+
/**
|
|
457
|
+
* Now.
|
|
458
|
+
*/
|
|
459
|
+
totals: {
|
|
460
|
+
/**
|
|
461
|
+
* Open conversations.
|
|
462
|
+
*/
|
|
463
|
+
open_now: number;
|
|
464
|
+
/**
|
|
465
|
+
* Open conversations with no member or AI agent assigned.
|
|
466
|
+
*/
|
|
467
|
+
unassigned: number;
|
|
468
|
+
/**
|
|
469
|
+
* Open conversations whose last message, reactions aside, is from the customer.
|
|
470
|
+
*/
|
|
471
|
+
awaiting_reply: number;
|
|
472
|
+
/**
|
|
473
|
+
* Handoffs from an AI agent to a person still waiting.
|
|
474
|
+
*/
|
|
475
|
+
pending_handoffs: number;
|
|
476
|
+
/**
|
|
477
|
+
* Conversations opened or reopened today, America/Panama.
|
|
478
|
+
*/
|
|
479
|
+
opened_today: number;
|
|
480
|
+
/**
|
|
481
|
+
* Conversations closed today, America/Panama.
|
|
482
|
+
*/
|
|
483
|
+
closed_today: number;
|
|
484
|
+
};
|
|
485
|
+
/**
|
|
486
|
+
* Open conversations per channel, most first.
|
|
487
|
+
*/
|
|
488
|
+
by_channel: Array<{
|
|
489
|
+
/**
|
|
490
|
+
* Channel.
|
|
491
|
+
*/
|
|
492
|
+
channel: 'whatsapp' | 'instagram' | 'messenger' | 'webchat';
|
|
493
|
+
/**
|
|
494
|
+
* Open conversations.
|
|
495
|
+
*/
|
|
496
|
+
open: number;
|
|
497
|
+
}>;
|
|
498
|
+
/**
|
|
499
|
+
* Open conversations per assignee, most first.
|
|
500
|
+
*/
|
|
501
|
+
assignees: Array<{
|
|
502
|
+
/**
|
|
503
|
+
* `human` is a member, `ai` an AI agent, `unassigned` nobody.
|
|
504
|
+
*/
|
|
505
|
+
type: 'human' | 'ai' | 'unassigned';
|
|
506
|
+
/**
|
|
507
|
+
* User ID or AI agent ID; null for `unassigned`.
|
|
508
|
+
*/
|
|
509
|
+
id: string | null;
|
|
510
|
+
/**
|
|
511
|
+
* Name; null when it has none and for `unassigned`.
|
|
512
|
+
*/
|
|
513
|
+
name: string | null;
|
|
514
|
+
/**
|
|
515
|
+
* Open conversations they hold.
|
|
516
|
+
*/
|
|
517
|
+
open: number;
|
|
518
|
+
/**
|
|
519
|
+
* Of those, the ones whose last message is from the customer.
|
|
520
|
+
*/
|
|
521
|
+
awaiting_reply: number;
|
|
522
|
+
}>;
|
|
523
|
+
/**
|
|
524
|
+
* The 15 open conversations waiting longest for a reply, oldest first.
|
|
525
|
+
*/
|
|
526
|
+
longest_waiting: Array<{
|
|
527
|
+
/**
|
|
528
|
+
* Conversation ID.
|
|
529
|
+
*/
|
|
530
|
+
conversation_id: string;
|
|
531
|
+
/**
|
|
532
|
+
* Channel.
|
|
533
|
+
*/
|
|
534
|
+
channel: 'whatsapp' | 'instagram' | 'messenger' | 'webchat';
|
|
535
|
+
/**
|
|
536
|
+
* Customer name as the inbox shows it: the contact’s saved name, else the channel profile name, else the contact’s phone.
|
|
537
|
+
*/
|
|
538
|
+
participant_name: string | null;
|
|
539
|
+
/**
|
|
540
|
+
* When the customer message they wait on arrived.
|
|
541
|
+
*/
|
|
542
|
+
waiting_since: string;
|
|
543
|
+
/**
|
|
544
|
+
* `human` is a member, `ai` an AI agent, `unassigned` nobody.
|
|
545
|
+
*/
|
|
546
|
+
assignee_type: 'human' | 'ai' | 'unassigned';
|
|
547
|
+
/**
|
|
548
|
+
* Assignee name; null when there is none.
|
|
549
|
+
*/
|
|
550
|
+
assignee_name: string | null;
|
|
551
|
+
}>;
|
|
552
|
+
/**
|
|
553
|
+
* When Ricky computed the report.
|
|
554
|
+
*/
|
|
555
|
+
generated_at: string;
|
|
556
|
+
};
|
|
557
|
+
/**
|
|
558
|
+
* A conversation a Meta ad opened or brought back in the period, with what happened after. One row per conversation and ad: a conversation two ads brought back has two rows.
|
|
559
|
+
*/
|
|
560
|
+
export type AdConversation = {
|
|
561
|
+
/**
|
|
562
|
+
* The first customer message from this ad in this conversation within the period.
|
|
563
|
+
*/
|
|
564
|
+
ad_referral: AdReferral;
|
|
565
|
+
/**
|
|
566
|
+
* Whether that message started the conversation: no message came before it. False when the ad brought back someone who had written before.
|
|
567
|
+
*/
|
|
568
|
+
opened_conversation: boolean;
|
|
569
|
+
/**
|
|
570
|
+
* Text of that message: what the customer wrote, often the greeting the ad prefilled.
|
|
571
|
+
*/
|
|
572
|
+
message_text: string | null;
|
|
573
|
+
/**
|
|
574
|
+
* Who wrote.
|
|
575
|
+
*/
|
|
576
|
+
contact: {
|
|
577
|
+
id: string | null;
|
|
578
|
+
/**
|
|
579
|
+
* Name saved on the contact, else the name on the channel.
|
|
580
|
+
*/
|
|
581
|
+
name: string | null;
|
|
582
|
+
/**
|
|
583
|
+
* Phone saved on the contact, in E.164.
|
|
584
|
+
*/
|
|
585
|
+
phone: string | null;
|
|
586
|
+
/**
|
|
587
|
+
* Address on the channel: phone digits for WhatsApp, account ID otherwise.
|
|
588
|
+
*/
|
|
589
|
+
external_id: string;
|
|
590
|
+
};
|
|
591
|
+
/**
|
|
592
|
+
* The conversation as it is now.
|
|
593
|
+
*/
|
|
594
|
+
conversation: {
|
|
595
|
+
/**
|
|
596
|
+
* Conversation ID.
|
|
597
|
+
*/
|
|
598
|
+
id: string;
|
|
599
|
+
/**
|
|
600
|
+
* Its state now.
|
|
601
|
+
*/
|
|
602
|
+
status: 'open' | 'closed';
|
|
603
|
+
/**
|
|
604
|
+
* Why it was closed: `sale` when a member closed it as a sale, the only sign of a purchase Ricky records, without an amount. Null while open or when closed without a category.
|
|
605
|
+
*/
|
|
606
|
+
close_category: 'resolved' | 'sale' | 'no_response' | 'spam' | 'other' | null;
|
|
607
|
+
/**
|
|
608
|
+
* When it was closed; null while open.
|
|
609
|
+
*/
|
|
610
|
+
closed_at: string | null;
|
|
611
|
+
/**
|
|
612
|
+
* When Ricky created it.
|
|
613
|
+
*/
|
|
614
|
+
created_at: string;
|
|
615
|
+
};
|
|
616
|
+
/**
|
|
617
|
+
* Messages the customer sent in the conversation from that message on, that one included; reactions do not count.
|
|
618
|
+
*/
|
|
619
|
+
customer_messages: number;
|
|
620
|
+
/**
|
|
621
|
+
* Replies from that message on by a member in Ricky, an AI agent or someone in the channel's own app. Automations, broadcasts, templates and reactions do not count.
|
|
622
|
+
*/
|
|
623
|
+
replies: number;
|
|
624
|
+
/**
|
|
625
|
+
* Seconds from that message to the first reply; null while unanswered.
|
|
626
|
+
*/
|
|
627
|
+
first_reply_seconds: number | null;
|
|
628
|
+
};
|
|
629
|
+
/**
|
|
630
|
+
* A campaign of a connected ad account.
|
|
631
|
+
*/
|
|
632
|
+
export type MetaAdsCampaign = {
|
|
633
|
+
/**
|
|
634
|
+
* Campaign ID at Meta.
|
|
635
|
+
*/
|
|
636
|
+
id: string;
|
|
637
|
+
/**
|
|
638
|
+
* Ad account ID at Meta.
|
|
639
|
+
*/
|
|
640
|
+
account_id: string;
|
|
641
|
+
/**
|
|
642
|
+
* Name in Meta.
|
|
643
|
+
*/
|
|
644
|
+
name: string;
|
|
645
|
+
/**
|
|
646
|
+
* Objective, such as `OUTCOME_ENGAGEMENT`.
|
|
647
|
+
*/
|
|
648
|
+
objective: string | null;
|
|
649
|
+
/**
|
|
650
|
+
* Status the advertiser set: `ACTIVE`, `PAUSED`, …
|
|
651
|
+
*/
|
|
652
|
+
status: string;
|
|
653
|
+
/**
|
|
654
|
+
* Delivery status, including a parent paused: `ACTIVE`, `CAMPAIGN_PAUSED`, …
|
|
655
|
+
*/
|
|
656
|
+
effective_status: string;
|
|
657
|
+
/**
|
|
658
|
+
* `AUCTION` or `RESERVED`.
|
|
659
|
+
*/
|
|
660
|
+
buying_type: string | null;
|
|
661
|
+
/**
|
|
662
|
+
* Bid strategy, when the campaign sets one.
|
|
663
|
+
*/
|
|
664
|
+
bid_strategy: string | null;
|
|
665
|
+
/**
|
|
666
|
+
* Budget as Meta reports it, in the ad account currency.
|
|
667
|
+
*/
|
|
668
|
+
budget: {
|
|
669
|
+
/**
|
|
670
|
+
* Daily budget in the account currency; null when not set.
|
|
671
|
+
*/
|
|
672
|
+
daily: number | null;
|
|
673
|
+
/**
|
|
674
|
+
* Lifetime budget in the account currency; null when not set.
|
|
675
|
+
*/
|
|
676
|
+
lifetime: number | null;
|
|
677
|
+
/**
|
|
678
|
+
* Budget left in the account currency.
|
|
679
|
+
*/
|
|
680
|
+
remaining: number | null;
|
|
681
|
+
};
|
|
682
|
+
/**
|
|
683
|
+
* ISO 8601 time as Meta reports it; null if unset.
|
|
684
|
+
*/
|
|
685
|
+
start_time: string | null;
|
|
686
|
+
/**
|
|
687
|
+
* ISO 8601 time as Meta reports it; null if unset.
|
|
688
|
+
*/
|
|
689
|
+
stop_time: string | null;
|
|
690
|
+
/**
|
|
691
|
+
* ISO 8601 time as Meta reports it; null if unset.
|
|
692
|
+
*/
|
|
693
|
+
created_time: string | null;
|
|
694
|
+
/**
|
|
695
|
+
* ISO 8601 time as Meta reports it; null if unset.
|
|
696
|
+
*/
|
|
697
|
+
updated_time: string | null;
|
|
698
|
+
};
|
|
699
|
+
/**
|
|
700
|
+
* An ad set of a connected ad account.
|
|
701
|
+
*/
|
|
702
|
+
export type MetaAdsAdSet = {
|
|
703
|
+
/**
|
|
704
|
+
* Ad set ID at Meta.
|
|
705
|
+
*/
|
|
706
|
+
id: string;
|
|
707
|
+
/**
|
|
708
|
+
* Ad account ID at Meta.
|
|
709
|
+
*/
|
|
710
|
+
account_id: string;
|
|
711
|
+
/**
|
|
712
|
+
* Campaign ID at Meta.
|
|
713
|
+
*/
|
|
714
|
+
campaign_id: string;
|
|
715
|
+
/**
|
|
716
|
+
* Name in Meta.
|
|
717
|
+
*/
|
|
718
|
+
name: string;
|
|
719
|
+
/**
|
|
720
|
+
* Status the advertiser set: `ACTIVE`, `PAUSED`, …
|
|
721
|
+
*/
|
|
722
|
+
status: string;
|
|
723
|
+
/**
|
|
724
|
+
* Delivery status, including a parent paused: `ACTIVE`, `CAMPAIGN_PAUSED`, …
|
|
725
|
+
*/
|
|
726
|
+
effective_status: string;
|
|
727
|
+
/**
|
|
728
|
+
* What Meta optimizes delivery for.
|
|
729
|
+
*/
|
|
730
|
+
optimization_goal: string | null;
|
|
731
|
+
/**
|
|
732
|
+
* What Meta charges for.
|
|
733
|
+
*/
|
|
734
|
+
billing_event: string | null;
|
|
735
|
+
/**
|
|
736
|
+
* Bid strategy, when the campaign sets one.
|
|
737
|
+
*/
|
|
738
|
+
bid_strategy: string | null;
|
|
739
|
+
/**
|
|
740
|
+
* Budget as Meta reports it, in the ad account currency.
|
|
741
|
+
*/
|
|
742
|
+
budget: {
|
|
743
|
+
/**
|
|
744
|
+
* Daily budget in the account currency; null when not set.
|
|
745
|
+
*/
|
|
746
|
+
daily: number | null;
|
|
747
|
+
/**
|
|
748
|
+
* Lifetime budget in the account currency; null when not set.
|
|
749
|
+
*/
|
|
750
|
+
lifetime: number | null;
|
|
751
|
+
/**
|
|
752
|
+
* Budget left in the account currency.
|
|
753
|
+
*/
|
|
754
|
+
remaining: number | null;
|
|
755
|
+
};
|
|
756
|
+
/**
|
|
757
|
+
* ISO 8601 time as Meta reports it; null if unset.
|
|
758
|
+
*/
|
|
759
|
+
start_time: string | null;
|
|
760
|
+
/**
|
|
761
|
+
* ISO 8601 time as Meta reports it; null if unset.
|
|
762
|
+
*/
|
|
763
|
+
end_time: string | null;
|
|
764
|
+
/**
|
|
765
|
+
* Meta's targeting spec as Meta returns it: ages, locations, interests, …
|
|
766
|
+
*/
|
|
767
|
+
targeting: unknown;
|
|
768
|
+
/**
|
|
769
|
+
* ISO 8601 time as Meta reports it; null if unset.
|
|
770
|
+
*/
|
|
771
|
+
created_time: string | null;
|
|
772
|
+
/**
|
|
773
|
+
* ISO 8601 time as Meta reports it; null if unset.
|
|
774
|
+
*/
|
|
775
|
+
updated_time: string | null;
|
|
776
|
+
};
|
|
777
|
+
/**
|
|
778
|
+
* An ad of a connected ad account, with its creative copy.
|
|
779
|
+
*/
|
|
780
|
+
export type MetaAdsAd = {
|
|
781
|
+
/**
|
|
782
|
+
* Ad ID at Meta.
|
|
783
|
+
*/
|
|
784
|
+
id: string;
|
|
785
|
+
/**
|
|
786
|
+
* Ad account ID at Meta.
|
|
787
|
+
*/
|
|
788
|
+
account_id: string;
|
|
789
|
+
/**
|
|
790
|
+
* Campaign ID at Meta.
|
|
791
|
+
*/
|
|
792
|
+
campaign_id: string;
|
|
793
|
+
/**
|
|
794
|
+
* Ad set ID at Meta.
|
|
795
|
+
*/
|
|
796
|
+
ad_set_id: string;
|
|
797
|
+
/**
|
|
798
|
+
* Name in Meta.
|
|
799
|
+
*/
|
|
800
|
+
name: string;
|
|
801
|
+
/**
|
|
802
|
+
* Status the advertiser set: `ACTIVE`, `PAUSED`, …
|
|
803
|
+
*/
|
|
804
|
+
status: string;
|
|
805
|
+
/**
|
|
806
|
+
* Delivery status, including a parent paused: `ACTIVE`, `CAMPAIGN_PAUSED`, …
|
|
807
|
+
*/
|
|
808
|
+
effective_status: string;
|
|
809
|
+
/**
|
|
810
|
+
* The creative the ad runs; null when Meta returns none.
|
|
811
|
+
*/
|
|
812
|
+
creative: {
|
|
813
|
+
/**
|
|
814
|
+
* Creative ID at Meta.
|
|
815
|
+
*/
|
|
816
|
+
id: string;
|
|
817
|
+
/**
|
|
818
|
+
* Headline.
|
|
819
|
+
*/
|
|
820
|
+
title: string | null;
|
|
821
|
+
/**
|
|
822
|
+
* Primary text.
|
|
823
|
+
*/
|
|
824
|
+
body: string | null;
|
|
825
|
+
/**
|
|
826
|
+
* Button, such as `LEARN_MORE`.
|
|
827
|
+
*/
|
|
828
|
+
call_to_action_type: string | null;
|
|
829
|
+
/**
|
|
830
|
+
* Image URL Meta returns.
|
|
831
|
+
*/
|
|
832
|
+
image_url: string | null;
|
|
833
|
+
/**
|
|
834
|
+
* Thumbnail URL Meta returns; it expires.
|
|
835
|
+
*/
|
|
836
|
+
thumbnail_url: string | null;
|
|
837
|
+
/**
|
|
838
|
+
* The Instagram post it runs.
|
|
839
|
+
*/
|
|
840
|
+
instagram_permalink_url: string | null;
|
|
841
|
+
/**
|
|
842
|
+
* Meta's story spec as Meta returns it: page, link, message and media.
|
|
843
|
+
*/
|
|
844
|
+
object_story_spec: unknown;
|
|
845
|
+
} | null;
|
|
846
|
+
/**
|
|
847
|
+
* ISO 8601 time as Meta reports it; null if unset.
|
|
848
|
+
*/
|
|
849
|
+
created_time: string | null;
|
|
850
|
+
/**
|
|
851
|
+
* ISO 8601 time as Meta reports it; null if unset.
|
|
852
|
+
*/
|
|
853
|
+
updated_time: string | null;
|
|
854
|
+
};
|
|
855
|
+
/**
|
|
856
|
+
* Performance Meta computed for one row of the requested level, period and breakdowns.
|
|
256
857
|
*/
|
|
257
858
|
export type MetaAdsInsight = {
|
|
258
859
|
/**
|
|
@@ -586,6 +1187,14 @@ export type Contact = {
|
|
|
586
1187
|
*/
|
|
587
1188
|
last_activity_preview: string | null;
|
|
588
1189
|
last_conversation_id: string | null;
|
|
1190
|
+
/**
|
|
1191
|
+
* First touch: the earliest Meta ad this contact came from, in any of its conversations; null when none came from an ad.
|
|
1192
|
+
*/
|
|
1193
|
+
first_ad_referral: AdReferral | null;
|
|
1194
|
+
/**
|
|
1195
|
+
* Last touch: the latest Meta ad this contact came from; the same as `first_ad_referral` when only one ad brought them.
|
|
1196
|
+
*/
|
|
1197
|
+
last_ad_referral: AdReferral | null;
|
|
589
1198
|
/**
|
|
590
1199
|
* Last change to the contact.
|
|
591
1200
|
*/
|
|
@@ -736,6 +1345,14 @@ export type Conversation = {
|
|
|
736
1345
|
* The handoff to a person waiting to be resolved; null when there is none.
|
|
737
1346
|
*/
|
|
738
1347
|
active_handoff: ConversationHandoff | null;
|
|
1348
|
+
/**
|
|
1349
|
+
* The earliest Meta ad that brought the contact to this conversation; null when none did.
|
|
1350
|
+
*/
|
|
1351
|
+
first_ad_referral: AdReferral | null;
|
|
1352
|
+
/**
|
|
1353
|
+
* The latest Meta ad that brought the contact back to this conversation; the same as `first_ad_referral` when only one did.
|
|
1354
|
+
*/
|
|
1355
|
+
latest_ad_referral: AdReferral | null;
|
|
739
1356
|
};
|
|
740
1357
|
/**
|
|
741
1358
|
* One message in a conversation.
|
|
@@ -827,6 +1444,10 @@ export type Message = {
|
|
|
827
1444
|
* When the sender deleted it.
|
|
828
1445
|
*/
|
|
829
1446
|
deleted_at: string | null;
|
|
1447
|
+
/**
|
|
1448
|
+
* The Meta ad this customer message came from; null for every other message.
|
|
1449
|
+
*/
|
|
1450
|
+
ad_referral: AdReferral | null;
|
|
830
1451
|
};
|
|
831
1452
|
/**
|
|
832
1453
|
* An outbound message Ricky accepted and is delivering.
|
|
@@ -1282,706 +1903,280 @@ export type KnowledgeFileReading = {
|
|
|
1282
1903
|
sections: Array<{
|
|
1283
1904
|
/**
|
|
1284
1905
|
* PDF page it was read from; null for formats without pages.
|
|
1285
|
-
*/
|
|
1286
|
-
page: number | null;
|
|
1287
|
-
/**
|
|
1288
|
-
* Everything Ricky read from that page, in Markdown: text in reading order, tables, and one line per picture saying what it shows.
|
|
1289
|
-
*/
|
|
1290
|
-
text: string;
|
|
1291
|
-
}>;
|
|
1292
|
-
};
|
|
1293
|
-
/**
|
|
1294
|
-
* A file waiting for its bytes, and where to put them.
|
|
1295
|
-
*/
|
|
1296
|
-
export type KnowledgeFileUpload = {
|
|
1297
|
-
file: KnowledgeFile;
|
|
1298
|
-
/**
|
|
1299
|
-
* Signed URL valid for two hours. `PUT` the file bytes to it with `Content-Type` set to `mime_type`, then call `POST /knowledge/files/{file_id}/complete`.
|
|
1300
|
-
*/
|
|
1301
|
-
upload_url: string;
|
|
1302
|
-
};
|
|
1303
|
-
/**
|
|
1304
|
-
* A webhook subscription.
|
|
1305
|
-
*/
|
|
1306
|
-
export type Webhook = {
|
|
1307
|
-
/**
|
|
1308
|
-
* Webhook ID.
|
|
1309
|
-
*/
|
|
1310
|
-
id: string;
|
|
1311
|
-
/**
|
|
1312
|
-
* HTTPS endpoint Ricky posts to.
|
|
1313
|
-
*/
|
|
1314
|
-
url: string;
|
|
1315
|
-
event_types: Array<'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready'>;
|
|
1316
|
-
status: 'active' | 'disabled';
|
|
1317
|
-
/**
|
|
1318
|
-
* When it was created.
|
|
1319
|
-
*/
|
|
1320
|
-
created_at: string;
|
|
1321
|
-
/**
|
|
1322
|
-
* When it was disabled.
|
|
1323
|
-
*/
|
|
1324
|
-
disabled_at: string | null;
|
|
1325
|
-
};
|
|
1326
|
-
/**
|
|
1327
|
-
* A new webhook subscription with its signing secret.
|
|
1328
|
-
*/
|
|
1329
|
-
export type CreatedWebhook = {
|
|
1330
|
-
/**
|
|
1331
|
-
* Webhook ID.
|
|
1332
|
-
*/
|
|
1333
|
-
id: string;
|
|
1334
|
-
/**
|
|
1335
|
-
* HTTPS endpoint Ricky posts to.
|
|
1336
|
-
*/
|
|
1337
|
-
url: string;
|
|
1338
|
-
event_types: Array<'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready'>;
|
|
1339
|
-
status: 'active' | 'disabled';
|
|
1340
|
-
/**
|
|
1341
|
-
* When it was created.
|
|
1342
|
-
*/
|
|
1343
|
-
created_at: string;
|
|
1344
|
-
/**
|
|
1345
|
-
* When it was disabled.
|
|
1346
|
-
*/
|
|
1347
|
-
disabled_at: string | null;
|
|
1348
|
-
/**
|
|
1349
|
-
* HMAC key for `X-Ricky-Signature`. Returned only here, once.
|
|
1350
|
-
*/
|
|
1351
|
-
signing_secret: string;
|
|
1352
|
-
};
|
|
1353
|
-
/**
|
|
1354
|
-
* One webhook delivery.
|
|
1355
|
-
*/
|
|
1356
|
-
export type WebhookDelivery = {
|
|
1357
|
-
/**
|
|
1358
|
-
* Delivery ID; equals the event `id` and `X-Ricky-Delivery-Id`.
|
|
1359
|
-
*/
|
|
1360
|
-
id: string;
|
|
1361
|
-
event_type: 'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready';
|
|
1362
|
-
status: 'pending' | 'processing' | 'delivered' | 'failed';
|
|
1363
|
-
/**
|
|
1364
|
-
* Delivery attempts so far; Ricky makes at most ten.
|
|
1365
|
-
*/
|
|
1366
|
-
attempts: number;
|
|
1367
|
-
/**
|
|
1368
|
-
* HTTP status of the last attempt.
|
|
1369
|
-
*/
|
|
1370
|
-
last_response_status: number | null;
|
|
1371
|
-
/**
|
|
1372
|
-
* Why the last attempt failed.
|
|
1373
|
-
*/
|
|
1374
|
-
last_error: string | null;
|
|
1375
|
-
/**
|
|
1376
|
-
* When the event happened.
|
|
1377
|
-
*/
|
|
1378
|
-
created_at: string;
|
|
1379
|
-
/**
|
|
1380
|
-
* When Ricky tries next, while pending.
|
|
1381
|
-
*/
|
|
1382
|
-
next_attempt_at: string;
|
|
1383
|
-
/**
|
|
1384
|
-
* When the endpoint answered 2xx.
|
|
1385
|
-
*/
|
|
1386
|
-
delivered_at: string | null;
|
|
1387
|
-
};
|
|
1388
|
-
/**
|
|
1389
|
-
* The JSON body Ricky posts to a webhook endpoint.
|
|
1390
|
-
*/
|
|
1391
|
-
export type WebhookEvent = {
|
|
1392
|
-
/**
|
|
1393
|
-
* Delivery ID. Deduplicate by it.
|
|
1394
|
-
*/
|
|
1395
|
-
id: string;
|
|
1396
|
-
type: 'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready' | 'webhook.test';
|
|
1397
|
-
/**
|
|
1398
|
-
* When it happened.
|
|
1399
|
-
*/
|
|
1400
|
-
occurred_at: string;
|
|
1401
|
-
/**
|
|
1402
|
-
* Organization.
|
|
1403
|
-
*/
|
|
1404
|
-
organization_id: string;
|
|
1405
|
-
data: {
|
|
1406
|
-
/**
|
|
1407
|
-
* Conversation, for `message.*` and `conversation.*` events.
|
|
1408
|
-
*/
|
|
1409
|
-
conversation_id?: string;
|
|
1410
|
-
/**
|
|
1411
|
-
* Message, for `message.*` events.
|
|
1412
|
-
*/
|
|
1413
|
-
message_id?: string;
|
|
1414
|
-
/**
|
|
1415
|
-
* Contact, for `contact.*` events.
|
|
1416
|
-
*/
|
|
1417
|
-
contact_id?: string;
|
|
1418
|
-
/**
|
|
1419
|
-
* Broadcast, for `broadcast.*` events.
|
|
1420
|
-
*/
|
|
1421
|
-
broadcast_id?: string;
|
|
1422
|
-
/**
|
|
1423
|
-
* Template ID at Meta, for `template.status_changed`.
|
|
1424
|
-
*/
|
|
1425
|
-
template_id?: string;
|
|
1426
|
-
/**
|
|
1427
|
-
* Workflow, for `workflow.execution_failed`.
|
|
1428
|
-
*/
|
|
1429
|
-
workflow_id?: string;
|
|
1430
|
-
/**
|
|
1431
|
-
* Execution, for `workflow.execution_failed`.
|
|
1432
|
-
*/
|
|
1433
|
-
workflow_execution_id?: string;
|
|
1434
|
-
/**
|
|
1435
|
-
* Knowledge file, for `knowledge_file.ready`.
|
|
1436
|
-
*/
|
|
1437
|
-
knowledge_file_id?: string;
|
|
1438
|
-
/**
|
|
1439
|
-
* Webhook, for `webhook.test`.
|
|
1440
|
-
*/
|
|
1441
|
-
webhook_id?: string;
|
|
1442
|
-
};
|
|
1443
|
-
};
|
|
1444
|
-
/**
|
|
1445
|
-
* What the endpoint answered to a `webhook.test` event.
|
|
1446
|
-
*/
|
|
1447
|
-
export type WebhookTestResult = {
|
|
1448
|
-
/**
|
|
1449
|
-
* True when the endpoint answered 2xx.
|
|
1450
|
-
*/
|
|
1451
|
-
delivered: boolean;
|
|
1452
|
-
/**
|
|
1453
|
-
* HTTP status the endpoint answered; null if none.
|
|
1454
|
-
*/
|
|
1455
|
-
response_status: number | null;
|
|
1456
|
-
/**
|
|
1457
|
-
* Why it failed: the HTTP status, a timeout or a refused destination.
|
|
1458
|
-
*/
|
|
1459
|
-
error: string | null;
|
|
1460
|
-
/**
|
|
1461
|
-
* Time until the endpoint answered.
|
|
1462
|
-
*/
|
|
1463
|
-
duration_ms: number;
|
|
1464
|
-
};
|
|
1465
|
-
/**
|
|
1466
|
-
* What a tag change did to one contact.
|
|
1467
|
-
*/
|
|
1468
|
-
export type ContactTagChange = {
|
|
1469
|
-
/**
|
|
1470
|
-
* Contact ID.
|
|
1471
|
-
*/
|
|
1472
|
-
contact_id: string;
|
|
1473
|
-
/**
|
|
1474
|
-
* `updated`; `not_found` when the organization has no such contact; `failed` when Ricky could not save it, so retry that contact.
|
|
1475
|
-
*/
|
|
1476
|
-
status: 'updated' | 'not_found' | 'failed';
|
|
1477
|
-
/**
|
|
1478
|
-
* The contact's tags after the change; null unless `updated`.
|
|
1479
|
-
*/
|
|
1480
|
-
tags: Array<Tag> | null;
|
|
1481
|
-
};
|
|
1482
|
-
/**
|
|
1483
|
-
* A message whose text matches the search.
|
|
1484
|
-
*/
|
|
1485
|
-
export type MessageSearchResult = {
|
|
1486
|
-
/**
|
|
1487
|
-
* Message ID.
|
|
1488
|
-
*/
|
|
1489
|
-
message_id: string;
|
|
1490
|
-
/**
|
|
1491
|
-
* Conversation ID.
|
|
1492
|
-
*/
|
|
1493
|
-
conversation_id: string;
|
|
1494
|
-
direction: 'inbound' | 'outbound';
|
|
1495
|
-
/**
|
|
1496
|
-
* Message type: `text`, `image`, `audio`, `template`, …
|
|
1497
|
-
*/
|
|
1498
|
-
type: string;
|
|
1499
|
-
/**
|
|
1500
|
-
* The matching text: the message, or what Ricky derived from a voice note or file.
|
|
1501
|
-
*/
|
|
1502
|
-
text: string;
|
|
1503
|
-
contact: {
|
|
1504
|
-
/**
|
|
1505
|
-
* Contact name, or the name on the channel.
|
|
1506
|
-
*/
|
|
1507
|
-
name: string | null;
|
|
1508
|
-
/**
|
|
1509
|
-
* Address on the channel.
|
|
1510
|
-
*/
|
|
1511
|
-
external_id: string;
|
|
1512
|
-
};
|
|
1513
|
-
/**
|
|
1514
|
-
* AI agent that wrote it; null otherwise.
|
|
1515
|
-
*/
|
|
1516
|
-
agent_name: string | null;
|
|
1517
|
-
/**
|
|
1518
|
-
* When it was sent or received.
|
|
1519
|
-
*/
|
|
1520
|
-
messaged_at: string;
|
|
1906
|
+
*/
|
|
1907
|
+
page: number | null;
|
|
1908
|
+
/**
|
|
1909
|
+
* Everything Ricky read from that page, in Markdown: text in reading order, tables, and one line per picture saying what it shows.
|
|
1910
|
+
*/
|
|
1911
|
+
text: string;
|
|
1912
|
+
}>;
|
|
1521
1913
|
};
|
|
1522
1914
|
/**
|
|
1523
|
-
* A
|
|
1915
|
+
* A file waiting for its bytes, and where to put them.
|
|
1524
1916
|
*/
|
|
1525
|
-
export type
|
|
1526
|
-
|
|
1527
|
-
* Quick reply ID.
|
|
1528
|
-
*/
|
|
1529
|
-
id: string;
|
|
1530
|
-
/**
|
|
1531
|
-
* Name operators pick it by, unique in the organization regardless of case.
|
|
1532
|
-
*/
|
|
1533
|
-
title: string;
|
|
1917
|
+
export type KnowledgeFileUpload = {
|
|
1918
|
+
file: KnowledgeFile;
|
|
1534
1919
|
/**
|
|
1535
|
-
*
|
|
1920
|
+
* Signed URL valid for two hours. `PUT` the file bytes to it with `Content-Type` set to `mime_type`, then call `POST /knowledge/files/{file_id}/complete`.
|
|
1536
1921
|
*/
|
|
1537
|
-
|
|
1922
|
+
upload_url: string;
|
|
1538
1923
|
};
|
|
1539
1924
|
/**
|
|
1540
|
-
*
|
|
1925
|
+
* A webhook subscription.
|
|
1541
1926
|
*/
|
|
1542
|
-
export type
|
|
1927
|
+
export type Webhook = {
|
|
1543
1928
|
/**
|
|
1544
|
-
*
|
|
1929
|
+
* Webhook ID.
|
|
1545
1930
|
*/
|
|
1546
|
-
|
|
1931
|
+
id: string;
|
|
1547
1932
|
/**
|
|
1548
|
-
*
|
|
1933
|
+
* HTTPS endpoint Ricky posts to.
|
|
1549
1934
|
*/
|
|
1550
|
-
|
|
1935
|
+
url: string;
|
|
1936
|
+
event_types: Array<'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready'>;
|
|
1937
|
+
status: 'active' | 'disabled';
|
|
1551
1938
|
/**
|
|
1552
|
-
*
|
|
1939
|
+
* When it was created.
|
|
1553
1940
|
*/
|
|
1554
|
-
|
|
1941
|
+
created_at: string;
|
|
1942
|
+
/**
|
|
1943
|
+
* When it was disabled.
|
|
1944
|
+
*/
|
|
1945
|
+
disabled_at: string | null;
|
|
1555
1946
|
};
|
|
1556
1947
|
/**
|
|
1557
|
-
*
|
|
1948
|
+
* A new webhook subscription with its signing secret.
|
|
1558
1949
|
*/
|
|
1559
|
-
export type
|
|
1560
|
-
/**
|
|
1561
|
-
* First day, inclusive.
|
|
1562
|
-
*/
|
|
1563
|
-
from: string;
|
|
1564
|
-
/**
|
|
1565
|
-
* Last day, inclusive. A `to` after today is today.
|
|
1566
|
-
*/
|
|
1567
|
-
to: string;
|
|
1950
|
+
export type CreatedWebhook = {
|
|
1568
1951
|
/**
|
|
1569
|
-
*
|
|
1952
|
+
* Webhook ID.
|
|
1570
1953
|
*/
|
|
1571
|
-
|
|
1954
|
+
id: string;
|
|
1572
1955
|
/**
|
|
1573
|
-
*
|
|
1956
|
+
* HTTPS endpoint Ricky posts to.
|
|
1574
1957
|
*/
|
|
1575
|
-
|
|
1958
|
+
url: string;
|
|
1959
|
+
event_types: Array<'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready'>;
|
|
1960
|
+
status: 'active' | 'disabled';
|
|
1576
1961
|
/**
|
|
1577
|
-
*
|
|
1962
|
+
* When it was created.
|
|
1578
1963
|
*/
|
|
1579
|
-
|
|
1964
|
+
created_at: string;
|
|
1580
1965
|
/**
|
|
1581
|
-
*
|
|
1966
|
+
* When it was disabled.
|
|
1582
1967
|
*/
|
|
1583
|
-
|
|
1968
|
+
disabled_at: string | null;
|
|
1584
1969
|
/**
|
|
1585
|
-
*
|
|
1970
|
+
* HMAC key for `X-Ricky-Signature`. Returned only here, once.
|
|
1586
1971
|
*/
|
|
1587
|
-
|
|
1972
|
+
signing_secret: string;
|
|
1588
1973
|
};
|
|
1589
1974
|
/**
|
|
1590
|
-
*
|
|
1975
|
+
* One webhook delivery.
|
|
1591
1976
|
*/
|
|
1592
|
-
export type
|
|
1593
|
-
period: ReportPeriod;
|
|
1977
|
+
export type WebhookDelivery = {
|
|
1594
1978
|
/**
|
|
1595
|
-
*
|
|
1979
|
+
* Delivery ID; equals the event `id` and `X-Ricky-Delivery-Id`.
|
|
1596
1980
|
*/
|
|
1597
|
-
|
|
1981
|
+
id: string;
|
|
1982
|
+
event_type: 'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready';
|
|
1983
|
+
status: 'pending' | 'processing' | 'delivered' | 'failed';
|
|
1598
1984
|
/**
|
|
1599
|
-
*
|
|
1985
|
+
* Delivery attempts so far; Ricky makes at most ten.
|
|
1600
1986
|
*/
|
|
1601
|
-
|
|
1602
|
-
/**
|
|
1603
|
-
* Conversations with at least one customer message in the period.
|
|
1604
|
-
*/
|
|
1605
|
-
customers: number;
|
|
1606
|
-
/**
|
|
1607
|
-
* Customers whose first message ever falls in the period.
|
|
1608
|
-
*/
|
|
1609
|
-
new_customers: number;
|
|
1610
|
-
/**
|
|
1611
|
-
* Customers who had written before the period.
|
|
1612
|
-
*/
|
|
1613
|
-
returning_customers: number;
|
|
1614
|
-
/**
|
|
1615
|
-
* Messages customers sent in the period.
|
|
1616
|
-
*/
|
|
1617
|
-
messages: number;
|
|
1618
|
-
};
|
|
1987
|
+
attempts: number;
|
|
1619
1988
|
/**
|
|
1620
|
-
*
|
|
1989
|
+
* HTTP status of the last attempt.
|
|
1621
1990
|
*/
|
|
1622
|
-
|
|
1623
|
-
/**
|
|
1624
|
-
* Conversations with at least one customer message in the period.
|
|
1625
|
-
*/
|
|
1626
|
-
customers: number;
|
|
1627
|
-
/**
|
|
1628
|
-
* Customers whose first message ever falls in the period.
|
|
1629
|
-
*/
|
|
1630
|
-
new_customers: number;
|
|
1631
|
-
/**
|
|
1632
|
-
* Customers who had written before the period.
|
|
1633
|
-
*/
|
|
1634
|
-
returning_customers: number;
|
|
1635
|
-
/**
|
|
1636
|
-
* Messages customers sent in the period.
|
|
1637
|
-
*/
|
|
1638
|
-
messages: number;
|
|
1639
|
-
};
|
|
1991
|
+
last_response_status: number | null;
|
|
1640
1992
|
/**
|
|
1641
|
-
*
|
|
1993
|
+
* Why the last attempt failed.
|
|
1642
1994
|
*/
|
|
1643
|
-
|
|
1644
|
-
/**
|
|
1645
|
-
* Channel.
|
|
1646
|
-
*/
|
|
1647
|
-
channel: 'whatsapp' | 'instagram' | 'messenger' | 'webchat';
|
|
1648
|
-
/**
|
|
1649
|
-
* Conversations with at least one customer message in the period.
|
|
1650
|
-
*/
|
|
1651
|
-
customers: number;
|
|
1652
|
-
/**
|
|
1653
|
-
* Customers whose first message ever falls in the period.
|
|
1654
|
-
*/
|
|
1655
|
-
new_customers: number;
|
|
1656
|
-
/**
|
|
1657
|
-
* Customers who had written before the period.
|
|
1658
|
-
*/
|
|
1659
|
-
returning_customers: number;
|
|
1660
|
-
/**
|
|
1661
|
-
* Messages customers sent in the period.
|
|
1662
|
-
*/
|
|
1663
|
-
messages: number;
|
|
1664
|
-
}>;
|
|
1995
|
+
last_error: string | null;
|
|
1665
1996
|
/**
|
|
1666
|
-
*
|
|
1997
|
+
* When the event happened.
|
|
1667
1998
|
*/
|
|
1668
|
-
|
|
1669
|
-
/**
|
|
1670
|
-
* America/Panama day `YYYY-MM-DD`, or hour `YYYY-MM-DDTHH` when the period is one day.
|
|
1671
|
-
*/
|
|
1672
|
-
slot: string;
|
|
1673
|
-
/**
|
|
1674
|
-
* Customers whose first message ever falls in this slot.
|
|
1675
|
-
*/
|
|
1676
|
-
new_customers: number;
|
|
1677
|
-
/**
|
|
1678
|
-
* Customers who wrote in this slot and had written before.
|
|
1679
|
-
*/
|
|
1680
|
-
returning_customers: number;
|
|
1681
|
-
previous_customers: number | null;
|
|
1682
|
-
}>;
|
|
1999
|
+
created_at: string;
|
|
1683
2000
|
/**
|
|
1684
|
-
*
|
|
2001
|
+
* When Ricky tries next, while pending.
|
|
1685
2002
|
*/
|
|
1686
|
-
|
|
1687
|
-
/**
|
|
1688
|
-
* 0 is Sunday, 6 is Saturday.
|
|
1689
|
-
*/
|
|
1690
|
-
day_of_week: number;
|
|
1691
|
-
/**
|
|
1692
|
-
* Hour of the day, 0–23.
|
|
1693
|
-
*/
|
|
1694
|
-
hour: number;
|
|
1695
|
-
/**
|
|
1696
|
-
* Customer messages in that hour of that weekday.
|
|
1697
|
-
*/
|
|
1698
|
-
messages: number;
|
|
1699
|
-
}>;
|
|
2003
|
+
next_attempt_at: string;
|
|
1700
2004
|
/**
|
|
1701
|
-
* When
|
|
2005
|
+
* When the endpoint answered 2xx.
|
|
1702
2006
|
*/
|
|
1703
|
-
|
|
2007
|
+
delivered_at: string | null;
|
|
1704
2008
|
};
|
|
1705
2009
|
/**
|
|
1706
|
-
*
|
|
2010
|
+
* The JSON body Ricky posts to a webhook endpoint.
|
|
1707
2011
|
*/
|
|
1708
|
-
export type
|
|
1709
|
-
period: ReportPeriod;
|
|
2012
|
+
export type WebhookEvent = {
|
|
1710
2013
|
/**
|
|
1711
|
-
*
|
|
2014
|
+
* Delivery ID. Deduplicate by it.
|
|
1712
2015
|
*/
|
|
1713
|
-
|
|
2016
|
+
id: string;
|
|
2017
|
+
type: 'message.received' | 'message.sent' | 'message.delivered' | 'message.read' | 'message.failed' | 'conversation.opened' | 'conversation.closed' | 'conversation.assignment_changed' | 'conversation.agent_changed' | 'conversation.handoff_requested' | 'conversation.handoff_resolved' | 'contact.created' | 'contact.updated' | 'contact.tags_changed' | 'broadcast.completed' | 'broadcast.failed' | 'template.status_changed' | 'workflow.execution_failed' | 'knowledge_file.ready' | 'webhook.test';
|
|
1714
2018
|
/**
|
|
1715
|
-
*
|
|
2019
|
+
* When it happened.
|
|
1716
2020
|
*/
|
|
1717
|
-
|
|
1718
|
-
/**
|
|
1719
|
-
* Messages customers sent.
|
|
1720
|
-
*/
|
|
1721
|
-
received: number;
|
|
1722
|
-
/**
|
|
1723
|
-
* Messages sent to customers, by anyone; the sum of `sent_by`.
|
|
1724
|
-
*/
|
|
1725
|
-
sent: number;
|
|
1726
|
-
/**
|
|
1727
|
-
* Sent messages by sender; each message counts in one of them.
|
|
1728
|
-
*/
|
|
1729
|
-
sent_by: {
|
|
1730
|
-
/**
|
|
1731
|
-
* Sent by a person in Ricky.
|
|
1732
|
-
*/
|
|
1733
|
-
human: number;
|
|
1734
|
-
/**
|
|
1735
|
-
* Sent by an AI agent.
|
|
1736
|
-
*/
|
|
1737
|
-
ai: number;
|
|
1738
|
-
/**
|
|
1739
|
-
* Sent by an automation.
|
|
1740
|
-
*/
|
|
1741
|
-
automation: number;
|
|
1742
|
-
/**
|
|
1743
|
-
* Templates not sent by an automation: broadcasts and templates sent by hand or through the API.
|
|
1744
|
-
*/
|
|
1745
|
-
campaign: number;
|
|
1746
|
-
/**
|
|
1747
|
-
* Sent from the channel's own app, with no sender in Ricky: WhatsApp Business app coexistence and imported history.
|
|
1748
|
-
*/
|
|
1749
|
-
external: number;
|
|
1750
|
-
};
|
|
1751
|
-
};
|
|
2021
|
+
occurred_at: string;
|
|
1752
2022
|
/**
|
|
1753
|
-
*
|
|
2023
|
+
* Organization.
|
|
1754
2024
|
*/
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
* Messages customers sent.
|
|
1758
|
-
*/
|
|
1759
|
-
received: number;
|
|
2025
|
+
organization_id: string;
|
|
2026
|
+
data: {
|
|
1760
2027
|
/**
|
|
1761
|
-
*
|
|
2028
|
+
* Conversation, for `message.*` and `conversation.*` events.
|
|
1762
2029
|
*/
|
|
1763
|
-
|
|
2030
|
+
conversation_id?: string;
|
|
1764
2031
|
/**
|
|
1765
|
-
*
|
|
2032
|
+
* Message, for `message.*` events.
|
|
1766
2033
|
*/
|
|
1767
|
-
|
|
1768
|
-
/**
|
|
1769
|
-
* Sent by a person in Ricky.
|
|
1770
|
-
*/
|
|
1771
|
-
human: number;
|
|
1772
|
-
/**
|
|
1773
|
-
* Sent by an AI agent.
|
|
1774
|
-
*/
|
|
1775
|
-
ai: number;
|
|
1776
|
-
/**
|
|
1777
|
-
* Sent by an automation.
|
|
1778
|
-
*/
|
|
1779
|
-
automation: number;
|
|
1780
|
-
/**
|
|
1781
|
-
* Templates not sent by an automation: broadcasts and templates sent by hand or through the API.
|
|
1782
|
-
*/
|
|
1783
|
-
campaign: number;
|
|
1784
|
-
/**
|
|
1785
|
-
* Sent from the channel's own app, with no sender in Ricky: WhatsApp Business app coexistence and imported history.
|
|
1786
|
-
*/
|
|
1787
|
-
external: number;
|
|
1788
|
-
};
|
|
1789
|
-
};
|
|
1790
|
-
/**
|
|
1791
|
-
* The period per channel, most messages first.
|
|
1792
|
-
*/
|
|
1793
|
-
by_channel: Array<{
|
|
2034
|
+
message_id?: string;
|
|
1794
2035
|
/**
|
|
1795
|
-
*
|
|
2036
|
+
* Meta's ID of the ad the customer came from, for a `message.received` whose message carries an ad referral. Read the message for the rest of the referral.
|
|
1796
2037
|
*/
|
|
1797
|
-
|
|
2038
|
+
ad_id?: string;
|
|
1798
2039
|
/**
|
|
1799
|
-
*
|
|
2040
|
+
* Contact, for `contact.*` events.
|
|
1800
2041
|
*/
|
|
1801
|
-
|
|
2042
|
+
contact_id?: string;
|
|
1802
2043
|
/**
|
|
1803
|
-
*
|
|
2044
|
+
* Broadcast, for `broadcast.*` events.
|
|
1804
2045
|
*/
|
|
1805
|
-
|
|
2046
|
+
broadcast_id?: string;
|
|
1806
2047
|
/**
|
|
1807
|
-
*
|
|
2048
|
+
* Template ID at Meta, for `template.status_changed`.
|
|
1808
2049
|
*/
|
|
1809
|
-
|
|
1810
|
-
/**
|
|
1811
|
-
* Sent by a person in Ricky.
|
|
1812
|
-
*/
|
|
1813
|
-
human: number;
|
|
1814
|
-
/**
|
|
1815
|
-
* Sent by an AI agent.
|
|
1816
|
-
*/
|
|
1817
|
-
ai: number;
|
|
1818
|
-
/**
|
|
1819
|
-
* Sent by an automation.
|
|
1820
|
-
*/
|
|
1821
|
-
automation: number;
|
|
1822
|
-
/**
|
|
1823
|
-
* Templates not sent by an automation: broadcasts and templates sent by hand or through the API.
|
|
1824
|
-
*/
|
|
1825
|
-
campaign: number;
|
|
1826
|
-
/**
|
|
1827
|
-
* Sent from the channel's own app, with no sender in Ricky: WhatsApp Business app coexistence and imported history.
|
|
1828
|
-
*/
|
|
1829
|
-
external: number;
|
|
1830
|
-
};
|
|
1831
|
-
}>;
|
|
1832
|
-
/**
|
|
1833
|
-
* One entry per day of the period, or per hour of a one-day period.
|
|
1834
|
-
*/
|
|
1835
|
-
series: Array<{
|
|
2050
|
+
template_id?: string;
|
|
1836
2051
|
/**
|
|
1837
|
-
*
|
|
2052
|
+
* Workflow, for `workflow.execution_failed`.
|
|
1838
2053
|
*/
|
|
1839
|
-
|
|
2054
|
+
workflow_id?: string;
|
|
1840
2055
|
/**
|
|
1841
|
-
*
|
|
2056
|
+
* Execution, for `workflow.execution_failed`.
|
|
1842
2057
|
*/
|
|
1843
|
-
|
|
2058
|
+
workflow_execution_id?: string;
|
|
1844
2059
|
/**
|
|
1845
|
-
*
|
|
2060
|
+
* Knowledge file, for `knowledge_file.ready`.
|
|
1846
2061
|
*/
|
|
1847
|
-
|
|
2062
|
+
knowledge_file_id?: string;
|
|
1848
2063
|
/**
|
|
1849
|
-
*
|
|
2064
|
+
* Webhook, for `webhook.test`.
|
|
1850
2065
|
*/
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
*/
|
|
1859
|
-
ai: number;
|
|
1860
|
-
/**
|
|
1861
|
-
* Sent by an automation.
|
|
1862
|
-
*/
|
|
1863
|
-
automation: number;
|
|
1864
|
-
/**
|
|
1865
|
-
* Templates not sent by an automation: broadcasts and templates sent by hand or through the API.
|
|
1866
|
-
*/
|
|
1867
|
-
campaign: number;
|
|
1868
|
-
/**
|
|
1869
|
-
* Sent from the channel's own app, with no sender in Ricky: WhatsApp Business app coexistence and imported history.
|
|
1870
|
-
*/
|
|
1871
|
-
external: number;
|
|
1872
|
-
};
|
|
1873
|
-
previous_received: number | null;
|
|
1874
|
-
previous_sent: number | null;
|
|
1875
|
-
}>;
|
|
2066
|
+
webhook_id?: string;
|
|
2067
|
+
};
|
|
2068
|
+
};
|
|
2069
|
+
/**
|
|
2070
|
+
* What the endpoint answered to a `webhook.test` event.
|
|
2071
|
+
*/
|
|
2072
|
+
export type WebhookTestResult = {
|
|
1876
2073
|
/**
|
|
1877
|
-
*
|
|
2074
|
+
* True when the endpoint answered 2xx.
|
|
1878
2075
|
*/
|
|
1879
|
-
|
|
2076
|
+
delivered: boolean;
|
|
2077
|
+
/**
|
|
2078
|
+
* HTTP status the endpoint answered; null if none.
|
|
2079
|
+
*/
|
|
2080
|
+
response_status: number | null;
|
|
2081
|
+
/**
|
|
2082
|
+
* Why it failed: the HTTP status, a timeout or a refused destination.
|
|
2083
|
+
*/
|
|
2084
|
+
error: string | null;
|
|
2085
|
+
/**
|
|
2086
|
+
* Time until the endpoint answered.
|
|
2087
|
+
*/
|
|
2088
|
+
duration_ms: number;
|
|
1880
2089
|
};
|
|
1881
2090
|
/**
|
|
1882
|
-
* What
|
|
2091
|
+
* What a tag change did to one contact.
|
|
1883
2092
|
*/
|
|
1884
|
-
export type
|
|
2093
|
+
export type ContactTagChange = {
|
|
1885
2094
|
/**
|
|
1886
|
-
*
|
|
2095
|
+
* Contact ID.
|
|
1887
2096
|
*/
|
|
1888
|
-
|
|
1889
|
-
/**
|
|
1890
|
-
* Open conversations.
|
|
1891
|
-
*/
|
|
1892
|
-
open_now: number;
|
|
1893
|
-
/**
|
|
1894
|
-
* Open conversations with no member or AI agent assigned.
|
|
1895
|
-
*/
|
|
1896
|
-
unassigned: number;
|
|
1897
|
-
/**
|
|
1898
|
-
* Open conversations whose last message, reactions aside, is from the customer.
|
|
1899
|
-
*/
|
|
1900
|
-
awaiting_reply: number;
|
|
1901
|
-
/**
|
|
1902
|
-
* Handoffs from an AI agent to a person still waiting.
|
|
1903
|
-
*/
|
|
1904
|
-
pending_handoffs: number;
|
|
1905
|
-
/**
|
|
1906
|
-
* Conversations opened or reopened today, America/Panama.
|
|
1907
|
-
*/
|
|
1908
|
-
opened_today: number;
|
|
1909
|
-
/**
|
|
1910
|
-
* Conversations closed today, America/Panama.
|
|
1911
|
-
*/
|
|
1912
|
-
closed_today: number;
|
|
1913
|
-
};
|
|
2097
|
+
contact_id: string;
|
|
1914
2098
|
/**
|
|
1915
|
-
*
|
|
2099
|
+
* `updated`; `not_found` when the organization has no such contact; `failed` when Ricky could not save it, so retry that contact.
|
|
1916
2100
|
*/
|
|
1917
|
-
|
|
1918
|
-
/**
|
|
1919
|
-
* Channel.
|
|
1920
|
-
*/
|
|
1921
|
-
channel: 'whatsapp' | 'instagram' | 'messenger' | 'webchat';
|
|
1922
|
-
/**
|
|
1923
|
-
* Open conversations.
|
|
1924
|
-
*/
|
|
1925
|
-
open: number;
|
|
1926
|
-
}>;
|
|
2101
|
+
status: 'updated' | 'not_found' | 'failed';
|
|
1927
2102
|
/**
|
|
1928
|
-
*
|
|
2103
|
+
* The contact's tags after the change; null unless `updated`.
|
|
1929
2104
|
*/
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
2105
|
+
tags: Array<Tag> | null;
|
|
2106
|
+
};
|
|
2107
|
+
/**
|
|
2108
|
+
* A message whose text matches the search.
|
|
2109
|
+
*/
|
|
2110
|
+
export type MessageSearchResult = {
|
|
2111
|
+
/**
|
|
2112
|
+
* Message ID.
|
|
2113
|
+
*/
|
|
2114
|
+
message_id: string;
|
|
2115
|
+
/**
|
|
2116
|
+
* Conversation ID.
|
|
2117
|
+
*/
|
|
2118
|
+
conversation_id: string;
|
|
2119
|
+
direction: 'inbound' | 'outbound';
|
|
2120
|
+
/**
|
|
2121
|
+
* Message type: `text`, `image`, `audio`, `template`, …
|
|
2122
|
+
*/
|
|
2123
|
+
type: string;
|
|
2124
|
+
/**
|
|
2125
|
+
* The matching text: the message, or what Ricky derived from a voice note or file.
|
|
2126
|
+
*/
|
|
2127
|
+
text: string;
|
|
2128
|
+
contact: {
|
|
1939
2129
|
/**
|
|
1940
|
-
*
|
|
2130
|
+
* Contact name, or the name on the channel.
|
|
1941
2131
|
*/
|
|
1942
2132
|
name: string | null;
|
|
1943
2133
|
/**
|
|
1944
|
-
*
|
|
1945
|
-
*/
|
|
1946
|
-
open: number;
|
|
1947
|
-
/**
|
|
1948
|
-
* Of those, the ones whose last message is from the customer.
|
|
2134
|
+
* Address on the channel.
|
|
1949
2135
|
*/
|
|
1950
|
-
|
|
1951
|
-
}
|
|
2136
|
+
external_id: string;
|
|
2137
|
+
};
|
|
2138
|
+
/**
|
|
2139
|
+
* AI agent that wrote it; null otherwise.
|
|
2140
|
+
*/
|
|
2141
|
+
agent_name: string | null;
|
|
2142
|
+
/**
|
|
2143
|
+
* When it was sent or received.
|
|
2144
|
+
*/
|
|
2145
|
+
messaged_at: string;
|
|
2146
|
+
};
|
|
2147
|
+
/**
|
|
2148
|
+
* A saved answer operators insert into a message.
|
|
2149
|
+
*/
|
|
2150
|
+
export type QuickReply = {
|
|
2151
|
+
/**
|
|
2152
|
+
* Quick reply ID.
|
|
2153
|
+
*/
|
|
2154
|
+
id: string;
|
|
2155
|
+
/**
|
|
2156
|
+
* Name operators pick it by, unique in the organization regardless of case.
|
|
2157
|
+
*/
|
|
2158
|
+
title: string;
|
|
2159
|
+
/**
|
|
2160
|
+
* Text inserted into the message.
|
|
2161
|
+
*/
|
|
2162
|
+
body: string;
|
|
2163
|
+
};
|
|
2164
|
+
/**
|
|
2165
|
+
* What a bulk assignment did to one conversation.
|
|
2166
|
+
*/
|
|
2167
|
+
export type ConversationAssignmentResult = {
|
|
1952
2168
|
/**
|
|
1953
|
-
*
|
|
2169
|
+
* Conversation ID.
|
|
1954
2170
|
*/
|
|
1955
|
-
|
|
1956
|
-
/**
|
|
1957
|
-
* Conversation ID.
|
|
1958
|
-
*/
|
|
1959
|
-
conversation_id: string;
|
|
1960
|
-
/**
|
|
1961
|
-
* Channel.
|
|
1962
|
-
*/
|
|
1963
|
-
channel: 'whatsapp' | 'instagram' | 'messenger' | 'webchat';
|
|
1964
|
-
/**
|
|
1965
|
-
* Customer name as the inbox shows it: the contact’s saved name, else the channel profile name, else the contact’s phone.
|
|
1966
|
-
*/
|
|
1967
|
-
participant_name: string | null;
|
|
1968
|
-
/**
|
|
1969
|
-
* When the customer message they wait on arrived.
|
|
1970
|
-
*/
|
|
1971
|
-
waiting_since: string;
|
|
1972
|
-
/**
|
|
1973
|
-
* `human` is a member, `ai` an AI agent, `unassigned` nobody.
|
|
1974
|
-
*/
|
|
1975
|
-
assignee_type: 'human' | 'ai' | 'unassigned';
|
|
1976
|
-
/**
|
|
1977
|
-
* Assignee name; null when there is none.
|
|
1978
|
-
*/
|
|
1979
|
-
assignee_name: string | null;
|
|
1980
|
-
}>;
|
|
2171
|
+
conversation_id: string;
|
|
1981
2172
|
/**
|
|
1982
|
-
*
|
|
2173
|
+
* Member it was to be assigned to.
|
|
1983
2174
|
*/
|
|
1984
|
-
|
|
2175
|
+
assigned_user_id: string;
|
|
2176
|
+
/**
|
|
2177
|
+
* `assigned`; `not_found` when the organization has no such conversation; `failed` when Ricky could not save it, so retry that conversation.
|
|
2178
|
+
*/
|
|
2179
|
+
status: 'assigned' | 'not_found' | 'failed';
|
|
1985
2180
|
};
|
|
1986
2181
|
/**
|
|
1987
2182
|
* People and AI agents side by side: what they were assigned, what they sent, what they closed and how fast.
|
|
@@ -3496,70 +3691,6 @@ export type WhatsAppNumber = {
|
|
|
3496
3691
|
profile_picture_url: string | null;
|
|
3497
3692
|
};
|
|
3498
3693
|
};
|
|
3499
|
-
/**
|
|
3500
|
-
* Only `name` is required; it does not connect the agent to any channel.
|
|
3501
|
-
*/
|
|
3502
|
-
export type CreateAgent = {
|
|
3503
|
-
/**
|
|
3504
|
-
* Name the team sees.
|
|
3505
|
-
*/
|
|
3506
|
-
name: string;
|
|
3507
|
-
/**
|
|
3508
|
-
* What the agent is for.
|
|
3509
|
-
*/
|
|
3510
|
-
description?: string | null;
|
|
3511
|
-
/**
|
|
3512
|
-
* How the agent answers customers.
|
|
3513
|
-
*/
|
|
3514
|
-
instructions?: string | null;
|
|
3515
|
-
/**
|
|
3516
|
-
* A voice of `GET /agent-options`. Without one, the default voice.
|
|
3517
|
-
*/
|
|
3518
|
-
voice?: string;
|
|
3519
|
-
/**
|
|
3520
|
-
* The complete set of capability names. Replaces the current ones.
|
|
3521
|
-
*/
|
|
3522
|
-
capabilities?: Array<string>;
|
|
3523
|
-
/**
|
|
3524
|
-
* The complete set of members who receive handed-off conversations. Required with `ricky.handoff.request`.
|
|
3525
|
-
*/
|
|
3526
|
-
handoff_user_ids?: Array<string>;
|
|
3527
|
-
};
|
|
3528
|
-
/**
|
|
3529
|
-
* Only the fields you send change. Send `null` to clear a text.
|
|
3530
|
-
*/
|
|
3531
|
-
export type UpdateAgent = {
|
|
3532
|
-
/**
|
|
3533
|
-
* Name the team sees.
|
|
3534
|
-
*/
|
|
3535
|
-
name?: string;
|
|
3536
|
-
/**
|
|
3537
|
-
* What the agent is for.
|
|
3538
|
-
*/
|
|
3539
|
-
description?: string | null;
|
|
3540
|
-
/**
|
|
3541
|
-
* How the agent answers customers.
|
|
3542
|
-
*/
|
|
3543
|
-
instructions?: string | null;
|
|
3544
|
-
/**
|
|
3545
|
-
* A voice of `GET /agent-options`. Without one, the default voice.
|
|
3546
|
-
*/
|
|
3547
|
-
voice?: string;
|
|
3548
|
-
/**
|
|
3549
|
-
* The complete set of capability names. Replaces the current ones.
|
|
3550
|
-
*/
|
|
3551
|
-
capabilities?: Array<string>;
|
|
3552
|
-
/**
|
|
3553
|
-
* The complete set of members who receive handed-off conversations. Required with `ricky.handoff.request`.
|
|
3554
|
-
*/
|
|
3555
|
-
handoff_user_ids?: Array<string>;
|
|
3556
|
-
};
|
|
3557
|
-
export type AssignConversationAgent = {
|
|
3558
|
-
/**
|
|
3559
|
-
* Agent that answers from now on; null turns the AI off for the conversation.
|
|
3560
|
-
*/
|
|
3561
|
-
agent_id: string | null;
|
|
3562
|
-
};
|
|
3563
3694
|
/**
|
|
3564
3695
|
* How the handoff ends.
|
|
3565
3696
|
*/
|
|
@@ -3939,6 +4070,70 @@ export type RotateWebhookSecret = {
|
|
|
3939
4070
|
*/
|
|
3940
4071
|
expire_previous_after_hours?: number;
|
|
3941
4072
|
};
|
|
4073
|
+
/**
|
|
4074
|
+
* Only `name` is required; it does not connect the agent to any channel.
|
|
4075
|
+
*/
|
|
4076
|
+
export type CreateAgent = {
|
|
4077
|
+
/**
|
|
4078
|
+
* Name the team sees.
|
|
4079
|
+
*/
|
|
4080
|
+
name: string;
|
|
4081
|
+
/**
|
|
4082
|
+
* What the agent is for.
|
|
4083
|
+
*/
|
|
4084
|
+
description?: string | null;
|
|
4085
|
+
/**
|
|
4086
|
+
* How the agent answers customers.
|
|
4087
|
+
*/
|
|
4088
|
+
instructions?: string | null;
|
|
4089
|
+
/**
|
|
4090
|
+
* A voice of `GET /agent-options`. Without one, the default voice.
|
|
4091
|
+
*/
|
|
4092
|
+
voice?: string;
|
|
4093
|
+
/**
|
|
4094
|
+
* The complete set of capability names. Replaces the current ones.
|
|
4095
|
+
*/
|
|
4096
|
+
capabilities?: Array<string>;
|
|
4097
|
+
/**
|
|
4098
|
+
* The complete set of members who receive handed-off conversations. Required with `ricky.handoff.request`.
|
|
4099
|
+
*/
|
|
4100
|
+
handoff_user_ids?: Array<string>;
|
|
4101
|
+
};
|
|
4102
|
+
/**
|
|
4103
|
+
* Only the fields you send change. Send `null` to clear a text.
|
|
4104
|
+
*/
|
|
4105
|
+
export type UpdateAgent = {
|
|
4106
|
+
/**
|
|
4107
|
+
* Name the team sees.
|
|
4108
|
+
*/
|
|
4109
|
+
name?: string;
|
|
4110
|
+
/**
|
|
4111
|
+
* What the agent is for.
|
|
4112
|
+
*/
|
|
4113
|
+
description?: string | null;
|
|
4114
|
+
/**
|
|
4115
|
+
* How the agent answers customers.
|
|
4116
|
+
*/
|
|
4117
|
+
instructions?: string | null;
|
|
4118
|
+
/**
|
|
4119
|
+
* A voice of `GET /agent-options`. Without one, the default voice.
|
|
4120
|
+
*/
|
|
4121
|
+
voice?: string;
|
|
4122
|
+
/**
|
|
4123
|
+
* The complete set of capability names. Replaces the current ones.
|
|
4124
|
+
*/
|
|
4125
|
+
capabilities?: Array<string>;
|
|
4126
|
+
/**
|
|
4127
|
+
* The complete set of members who receive handed-off conversations. Required with `ricky.handoff.request`.
|
|
4128
|
+
*/
|
|
4129
|
+
handoff_user_ids?: Array<string>;
|
|
4130
|
+
};
|
|
4131
|
+
export type AssignConversationAgent = {
|
|
4132
|
+
/**
|
|
4133
|
+
* Agent that answers from now on; null turns the AI off for the conversation.
|
|
4134
|
+
*/
|
|
4135
|
+
agent_id: string | null;
|
|
4136
|
+
};
|
|
3942
4137
|
/**
|
|
3943
4138
|
* Sends an approved template to many numbers, now or at a set time.
|
|
3944
4139
|
*/
|
|
@@ -5521,6 +5716,26 @@ export type ListContactsData = {
|
|
|
5521
5716
|
* Only contacts reachable on this channel.
|
|
5522
5717
|
*/
|
|
5523
5718
|
channel?: 'whatsapp' | 'instagram' | 'messenger' | 'webchat';
|
|
5719
|
+
/**
|
|
5720
|
+
* Only contacts with a customer message, in any of their conversations, from this Meta ad. Ad filters apply together to one customer message: from that ad, campaign or ad set, at that time.
|
|
5721
|
+
*/
|
|
5722
|
+
ad_id?: string;
|
|
5723
|
+
/**
|
|
5724
|
+
* Only contacts with a customer message, in any of their conversations, from an ad of this Meta campaign. Matches the ads Ricky synced from a connected ad account.
|
|
5725
|
+
*/
|
|
5726
|
+
campaign_id?: string;
|
|
5727
|
+
/**
|
|
5728
|
+
* Only contacts with a customer message, in any of their conversations, from an ad of this Meta ad set. Matches the ads Ricky synced from a connected ad account.
|
|
5729
|
+
*/
|
|
5730
|
+
ad_set_id?: string;
|
|
5731
|
+
/**
|
|
5732
|
+
* Only contacts with a customer message, in any of their conversations, from a Meta ad sent at or after this time, ISO 8601.
|
|
5733
|
+
*/
|
|
5734
|
+
referred_after?: string;
|
|
5735
|
+
/**
|
|
5736
|
+
* Only contacts with a customer message, in any of their conversations, from a Meta ad sent before this time, ISO 8601.
|
|
5737
|
+
*/
|
|
5738
|
+
referred_before?: string;
|
|
5524
5739
|
};
|
|
5525
5740
|
url: '/contacts';
|
|
5526
5741
|
};
|
|
@@ -5954,6 +6169,34 @@ export type ListConversationsData = {
|
|
|
5954
6169
|
* `customer`: only conversations whose latest message came from the contact.
|
|
5955
6170
|
*/
|
|
5956
6171
|
last_message_from?: 'customer';
|
|
6172
|
+
/**
|
|
6173
|
+
* Only conversations whose latest message is at or after this time, ISO 8601.
|
|
6174
|
+
*/
|
|
6175
|
+
last_activity_after?: string;
|
|
6176
|
+
/**
|
|
6177
|
+
* Only conversations whose latest message is before this time, ISO 8601.
|
|
6178
|
+
*/
|
|
6179
|
+
last_activity_before?: string;
|
|
6180
|
+
/**
|
|
6181
|
+
* Only conversations with a customer message from this Meta ad. Ad filters apply together to one customer message: from that ad, campaign or ad set, at that time.
|
|
6182
|
+
*/
|
|
6183
|
+
ad_id?: string;
|
|
6184
|
+
/**
|
|
6185
|
+
* Only conversations with a customer message from an ad of this Meta campaign. Matches the ads Ricky synced from a connected ad account.
|
|
6186
|
+
*/
|
|
6187
|
+
campaign_id?: string;
|
|
6188
|
+
/**
|
|
6189
|
+
* Only conversations with a customer message from an ad of this Meta ad set. Matches the ads Ricky synced from a connected ad account.
|
|
6190
|
+
*/
|
|
6191
|
+
ad_set_id?: string;
|
|
6192
|
+
/**
|
|
6193
|
+
* Only conversations with a customer message from a Meta ad sent at or after this time, ISO 8601.
|
|
6194
|
+
*/
|
|
6195
|
+
referred_after?: string;
|
|
6196
|
+
/**
|
|
6197
|
+
* Only conversations with a customer message from a Meta ad sent before this time, ISO 8601.
|
|
6198
|
+
*/
|
|
6199
|
+
referred_before?: string;
|
|
5957
6200
|
};
|
|
5958
6201
|
url: '/conversations';
|
|
5959
6202
|
};
|
|
@@ -8393,6 +8636,81 @@ export type GetMetaAdsInsightsResponses = {
|
|
|
8393
8636
|
};
|
|
8394
8637
|
};
|
|
8395
8638
|
export type GetMetaAdsInsightsResponse = GetMetaAdsInsightsResponses[keyof GetMetaAdsInsightsResponses];
|
|
8639
|
+
export type ListAdConversationsData = {
|
|
8640
|
+
body?: never;
|
|
8641
|
+
path?: never;
|
|
8642
|
+
query?: {
|
|
8643
|
+
/**
|
|
8644
|
+
* First day, `YYYY-MM-DD`, America/Panama, inclusive. Send it with `to`; without both, the report covers the last 7 days including today.
|
|
8645
|
+
*/
|
|
8646
|
+
from?: string;
|
|
8647
|
+
/**
|
|
8648
|
+
* Last day, `YYYY-MM-DD`, America/Panama, inclusive. A day after today counts as today. The period is at most 366 days.
|
|
8649
|
+
*/
|
|
8650
|
+
to?: string;
|
|
8651
|
+
/**
|
|
8652
|
+
* Only this Meta ad.
|
|
8653
|
+
*/
|
|
8654
|
+
ad_id?: string;
|
|
8655
|
+
/**
|
|
8656
|
+
* Only ads of this Meta campaign, among the ads Ricky synced from a connected ad account.
|
|
8657
|
+
*/
|
|
8658
|
+
campaign_id?: string;
|
|
8659
|
+
/**
|
|
8660
|
+
* Only ads of this Meta ad set, among the ads Ricky synced from a connected ad account.
|
|
8661
|
+
*/
|
|
8662
|
+
ad_set_id?: string;
|
|
8663
|
+
/**
|
|
8664
|
+
* Only conversations on this channel.
|
|
8665
|
+
*/
|
|
8666
|
+
channel?: 'whatsapp' | 'instagram' | 'messenger';
|
|
8667
|
+
/**
|
|
8668
|
+
* Items per page.
|
|
8669
|
+
*/
|
|
8670
|
+
page_size?: number;
|
|
8671
|
+
/**
|
|
8672
|
+
* `next_cursor` from the previous page. Use it unchanged.
|
|
8673
|
+
*/
|
|
8674
|
+
cursor?: string;
|
|
8675
|
+
};
|
|
8676
|
+
url: '/ads/conversations';
|
|
8677
|
+
};
|
|
8678
|
+
export type ListAdConversationsErrors = {
|
|
8679
|
+
/**
|
|
8680
|
+
* `invalid_input`: A parameter or body field is invalid; `param` names it when known.
|
|
8681
|
+
*/
|
|
8682
|
+
400: Error;
|
|
8683
|
+
/**
|
|
8684
|
+
* `unauthorized`: The `Authorization` header is missing, malformed, expired or revoked.
|
|
8685
|
+
*/
|
|
8686
|
+
401: Error;
|
|
8687
|
+
/**
|
|
8688
|
+
* `insufficient_scope`: The key lacks the scope this operation requires.
|
|
8689
|
+
*/
|
|
8690
|
+
403: Error;
|
|
8691
|
+
/**
|
|
8692
|
+
* `rate_limited`: More than 120 requests this minute with this key; see `Retry-After`.
|
|
8693
|
+
*/
|
|
8694
|
+
429: Error;
|
|
8695
|
+
/**
|
|
8696
|
+
* `internal_error`: Ricky failed. Retry a read. Before retrying a write, read the resource: the same `Idempotency-Key` answers `request_processing`.
|
|
8697
|
+
*/
|
|
8698
|
+
500: Error;
|
|
8699
|
+
};
|
|
8700
|
+
export type ListAdConversationsError = ListAdConversationsErrors[keyof ListAdConversationsErrors];
|
|
8701
|
+
export type ListAdConversationsResponses = {
|
|
8702
|
+
/**
|
|
8703
|
+
* Success.
|
|
8704
|
+
*/
|
|
8705
|
+
200: {
|
|
8706
|
+
data: Array<AdConversation>;
|
|
8707
|
+
/**
|
|
8708
|
+
* Pass as `cursor` for the next page; null on the last page.
|
|
8709
|
+
*/
|
|
8710
|
+
next_cursor: string | null;
|
|
8711
|
+
};
|
|
8712
|
+
};
|
|
8713
|
+
export type ListAdConversationsResponse = ListAdConversationsResponses[keyof ListAdConversationsResponses];
|
|
8396
8714
|
export type ListAgentsData = {
|
|
8397
8715
|
body?: never;
|
|
8398
8716
|
path?: never;
|