@b-jones-rfd/qualtrics-api-tasks 0.1.1 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -8,6 +8,63 @@ type Failure = {
8
8
  };
9
9
  type Result<T> = Success<T> | Failure;
10
10
  type ResponseFormat = 'csv' | 'json' | 'ndjson' | 'spss' | 'tsv' | 'xml';
11
+ type DistributionRequestType = 'Invite' | 'ThankYou' | 'Reminder' | 'Email' | 'Portal' | 'PortalInvite' | 'GeneratedInvite';
12
+ type Contact = {
13
+ firstName?: string;
14
+ lastName?: string;
15
+ email: string;
16
+ extRef?: string;
17
+ embeddedData?: Record<string, string>;
18
+ language?: string;
19
+ unsubscribed?: boolean;
20
+ transactionData?: object;
21
+ };
22
+ type Distribution = {
23
+ id: string;
24
+ parentDistributionId: string;
25
+ ownerId: string;
26
+ organizationId: string;
27
+ requestStatus: string;
28
+ requestType: DistributionRequestType;
29
+ sendDate: string;
30
+ createdDate: string;
31
+ modifiedDate: string;
32
+ headers: {
33
+ fromEmail: string;
34
+ replyToEmail: string;
35
+ fromName: string;
36
+ subject: string;
37
+ };
38
+ recipients: {
39
+ mailingListId: string;
40
+ contactId: string;
41
+ libraryId: string;
42
+ sampleId: string;
43
+ };
44
+ message: {
45
+ libraryId: string;
46
+ messageId: string;
47
+ messageText: string;
48
+ messageType: string;
49
+ };
50
+ surveyLink: {
51
+ surveyId: string;
52
+ expirationDate: string;
53
+ linkType: 'Individual' | 'Multiple' | 'Anonymous';
54
+ };
55
+ stats: {
56
+ sent: number;
57
+ failed: number;
58
+ started: number;
59
+ bounced: number;
60
+ opened: number;
61
+ skipped: number;
62
+ finished: number;
63
+ complaints: number;
64
+ blocked: number;
65
+ };
66
+ embeddedData: Record<string, string>;
67
+ };
11
68
  type Action<TConfig, TResponse> = (options: TConfig) => Promise<Result<TResponse>>;
12
69
  type ConnectionOptions = {
13
70
  datacenterId: string;
@@ -16,12 +73,39 @@ type ConnectionOptions = {
16
73
  };
17
74
  type ActionFactory<TParams, TResponse> = (options: ConnectionOptions) => Action<TParams, TResponse>;
18
75
  type Connection = {
76
+ createDistribution: Action<CreateDistributionOptions, string>;
77
+ createMailingList: Action<{
78
+ directoryId: string;
79
+ name: string;
80
+ ownerId: string;
81
+ prioritizeListMetadata?: boolean;
82
+ bearerToken?: string;
83
+ }, string>;
84
+ createReminder: Action<CreateReminderOptions, string>;
85
+ distributeSurveys: Action<DistributionOptions, string>;
19
86
  exportResponses: Action<ExportResponsesOptions, Buffer>;
20
87
  getBearerToken: Action<{
21
88
  clientId: string;
22
89
  clientSecret: string;
23
90
  scope: string;
24
91
  }, string>;
92
+ getContactsImportStatus: Action<{
93
+ directoryId: string;
94
+ importId: string;
95
+ mailingListId: string;
96
+ bearerToken?: string;
97
+ }, ContactsImportStatusResponse>;
98
+ getContactsImportSummary: Action<{
99
+ directoryId: string;
100
+ importId: string;
101
+ mailingListId: string;
102
+ bearerToken?: string;
103
+ }, ContactsImportSummaryResponse>;
104
+ getDistribution: Action<{
105
+ distributionId: string;
106
+ surveyId: string;
107
+ bearerToken?: string;
108
+ }, Distribution>;
25
109
  getResponseExportFile: Action<{
26
110
  surveyId: string;
27
111
  fileId: string;
@@ -32,6 +116,40 @@ type Connection = {
32
116
  surveyId: string;
33
117
  bearerToken?: string;
34
118
  }, FileProgressResponse>;
119
+ importContacts: Action<StartContactsImportOptions, ContactsImportSummaryResponse>;
120
+ listDistributions: Action<{
121
+ surveyId: string;
122
+ distributionRequestType: DistributionRequestType;
123
+ mailingListId: string;
124
+ sendStartDate: Date;
125
+ sendEndDate: Date;
126
+ skipToken?: string;
127
+ useNewPaginationScheme?: boolean;
128
+ pageSize?: number;
129
+ bearerToken?: string;
130
+ }, {
131
+ elements: Distribution[];
132
+ nextPage: string | null;
133
+ }>;
134
+ listLibraryMessages: Action<{
135
+ libraryId: string;
136
+ category?: string;
137
+ offset?: number;
138
+ bearerToken?: string;
139
+ }, {
140
+ elements: {
141
+ id: string;
142
+ description: string;
143
+ category: string;
144
+ }[];
145
+ nextPage: string | null;
146
+ }>;
147
+ startContactsImport: Action<StartContactsImportOptions, {
148
+ id: string;
149
+ contacts: Array<Contact>;
150
+ tracking: object;
151
+ status: string;
152
+ }>;
35
153
  startResponseExport: Action<ExportResponsesOptions, {
36
154
  progressId: string;
37
155
  percentComplete: number;
@@ -67,15 +185,152 @@ type ExportResponsesOptions = {
67
185
  sortByLastModifiedDate?: boolean;
68
186
  bearerToken?: string;
69
187
  };
188
+ type CreateDistributionOptions = {
189
+ libraryId: string;
190
+ messageId: string;
191
+ messageText?: string;
192
+ mailingListId: string;
193
+ contactId?: string;
194
+ transactionBatchId?: string;
195
+ fromEmail: string;
196
+ replyToEmail?: string;
197
+ fromName: string;
198
+ subject: string;
199
+ surveyId: string;
200
+ expirationDate: Date;
201
+ type: 'Individual' | 'Multiple' | 'Anonymous';
202
+ embeddedData?: Record<string, string>;
203
+ sendDate: Date;
204
+ bearerToken?: string;
205
+ };
206
+ type CreateReminderOptions = {
207
+ distributionId: string;
208
+ libraryId: string;
209
+ messageId: string;
210
+ fromEmail: string;
211
+ replyToEmail?: string;
212
+ fromName: string;
213
+ subject: string;
214
+ sendDate: Date;
215
+ embeddedData?: Record<string, string>;
216
+ bearerToken?: string;
217
+ };
70
218
  type FileProgressResponse = {
71
219
  fileId: string;
72
220
  percentComplete: number;
73
221
  status: string;
74
222
  continuationToken?: string;
75
223
  };
224
+ type StartContactsImportOptions = {
225
+ directoryId: string;
226
+ mailingListId: string;
227
+ contacts: Array<Contact>;
228
+ transactionMeta?: {
229
+ fields: string[];
230
+ batchId: string;
231
+ };
232
+ bearerToken?: string;
233
+ };
234
+ type ContactsImportSummaryResponse = {
235
+ percentComplete: number;
236
+ contacts: {
237
+ count: {
238
+ added: number;
239
+ updated: number;
240
+ failed: number;
241
+ };
242
+ };
243
+ invalidEmails: string[];
244
+ transactions: {
245
+ count: {
246
+ created: number;
247
+ };
248
+ };
249
+ status: string;
250
+ };
251
+ type ContactsImportStatusResponse = {
252
+ percentComplete: number;
253
+ contacts: {
254
+ count: {
255
+ added: number;
256
+ updated: number;
257
+ failed: number;
258
+ };
259
+ };
260
+ transactions: {
261
+ count: {
262
+ created: number;
263
+ };
264
+ };
265
+ status: string;
266
+ };
267
+ type DistributionOptions = {
268
+ directoryId: string;
269
+ mailingListName: string;
270
+ ownerId: string;
271
+ prioritizeListMetadata?: boolean;
272
+ contacts: Array<Contact>;
273
+ transactionMeta?: {
274
+ fields: string[];
275
+ batchId: string;
276
+ };
277
+ libraryId: string;
278
+ distributionMessageId: string;
279
+ distributionMessageText?: string;
280
+ reminderMessageId: string;
281
+ transactionBatchId?: string;
282
+ fromEmail: string;
283
+ replyToEmail?: string;
284
+ fromName: string;
285
+ subject: string;
286
+ surveyId: string;
287
+ expirationDate: Date;
288
+ type: 'Individual' | 'Multiple' | 'Anonymous';
289
+ embeddedData?: Record<string, string>;
290
+ sendDate: Date;
291
+ bearerToken?: string;
292
+ };
76
293
 
77
294
  declare const createConnection: ConnectionFactory;
78
295
 
296
+ /**
297
+ * Create Distribution
298
+ *
299
+ * Implements Create Distribution
300
+ * @see https://api.qualtrics.com/573e3f0a94888-create-distribution
301
+ */
302
+ declare const createDistribution: ActionFactory<CreateDistributionOptions, string>;
303
+
304
+ /**
305
+ * Create Mailing List
306
+ *
307
+ * Implements Create Mailing List
308
+ * @see https://api.qualtrics.com/3f633e4cea6cd-create-mailing-list
309
+ */
310
+ declare const createMailingList: ActionFactory<{
311
+ directoryId: string;
312
+ name: string;
313
+ ownerId: string;
314
+ prioritizeListMetadata?: boolean;
315
+ bearerToken?: string;
316
+ }, string>;
317
+
318
+ /**
319
+ * Create Reminder
320
+ *
321
+ * Implements Create Reminder Distribution
322
+ * @see https://api.qualtrics.com/764630bb0633a-create-reminder-distribution
323
+ */
324
+ declare const createReminder: ActionFactory<CreateReminderOptions, string>;
325
+
326
+ /**
327
+ * Export Survey Response File
328
+ *
329
+ * Implements Survey Response File Export end to end
330
+ * @see https://api.qualtrics.com/u9e5lh4172v0v-survey-response-export-guide
331
+ */
332
+ declare const distributeSurveys: ActionFactory<DistributionOptions, string>;
333
+
79
334
  /**
80
335
  * Export Survey Response File
81
336
  *
@@ -96,6 +351,44 @@ declare const getBearerToken: ActionFactory<{
96
351
  scope: string;
97
352
  }, string>;
98
353
 
354
+ /**
355
+ * Get Contacts Import Status
356
+ *
357
+ * Implements Get Transaction Contacts Import Status
358
+ * @see https://api.qualtrics.com/c5d22705b1d45-get-transaction-contacts-import-status
359
+ */
360
+ declare const getContactsImportStatus: ActionFactory<{
361
+ directoryId: string;
362
+ importId: string;
363
+ mailingListId: string;
364
+ bearerToken?: string;
365
+ }, ContactsImportStatusResponse>;
366
+
367
+ /**
368
+ * Confirm Add Contacts
369
+ *
370
+ * Implements Create Transaction Contacts Import
371
+ * @see https://api.qualtrics.com/6f0480b307053-get-transaction-contacts-import-summary
372
+ */
373
+ declare const getContactsImportSummary: ActionFactory<{
374
+ directoryId: string;
375
+ importId: string;
376
+ mailingListId: string;
377
+ bearerToken?: string;
378
+ }, ContactsImportSummaryResponse>;
379
+
380
+ /**
381
+ * Get Distribution
382
+ *
383
+ * Implements Get Distribution
384
+ * @see https://api.qualtrics.com/f5b1d8775d803-get-distribution
385
+ */
386
+ declare const getDistribution: ActionFactory<{
387
+ distributionId: string;
388
+ surveyId: string;
389
+ bearerToken?: string;
390
+ }, Distribution>;
391
+
99
392
  /**
100
393
  * Get Response Export File
101
394
  *
@@ -120,6 +413,68 @@ declare const getResponseExportFile: ActionFactory<{
120
413
  bearerToken?: string;
121
414
  }, Buffer>;
122
415
 
416
+ /**
417
+ * Import Contacts
418
+ *
419
+ * Implements import contacts end to end
420
+ * @see https://api.qualtrics.com/1ac99fba8ca5b-contact-imports
421
+ */
422
+ declare const importContacts: ActionFactory<StartContactsImportOptions, ContactsImportSummaryResponse>;
423
+
424
+ /**
425
+ * List Distributions
426
+ *
427
+ * Implements List Distributions
428
+ * @see https://api.qualtrics.com/234bb6b16cf6d-list-distributions
429
+ */
430
+ declare const listDistributions: ActionFactory<{
431
+ surveyId: string;
432
+ distributionRequestType: DistributionRequestType;
433
+ mailingListId: string;
434
+ sendStartDate: Date;
435
+ sendEndDate: Date;
436
+ skipToken?: string;
437
+ useNewPaginationScheme?: boolean;
438
+ pageSize?: number;
439
+ bearerToken?: string;
440
+ }, {
441
+ elements: Distribution[];
442
+ nextPage: string | null;
443
+ }>;
444
+
445
+ /**
446
+ * List Library Messages
447
+ *
448
+ * Implements List Library Messages
449
+ * @see https://api.qualtrics.com/1d60a66b340fa-list-library-messages
450
+ */
451
+ declare const listLibraryMessages: ActionFactory<{
452
+ libraryId: string;
453
+ category?: string;
454
+ offset?: number;
455
+ bearerToken?: string;
456
+ }, {
457
+ elements: {
458
+ id: string;
459
+ description: string;
460
+ category: string;
461
+ }[];
462
+ nextPage: string | null;
463
+ }>;
464
+
465
+ /**
466
+ * Start Contacts Import
467
+ *
468
+ * Implements Create Transaction Contacts Import
469
+ * @see https://api.qualtrics.com/bab13356ac724-create-transaction-contacts-import
470
+ */
471
+ declare const startContactsImport: ActionFactory<StartContactsImportOptions, {
472
+ id: string;
473
+ contacts: Array<Contact>;
474
+ tracking: object;
475
+ status: string;
476
+ }>;
477
+
123
478
  /**
124
479
  * Start Response Export
125
480
  *
@@ -138,4 +493,4 @@ declare const startResponseExport: ActionFactory<ExportResponsesOptions, {
138
493
  */
139
494
  declare const testConnection: (connectionOptions: ConnectionOptions) => (bearerToken?: string) => Promise<Result<string>>;
140
495
 
141
- export { type Action, type ActionFactory, type Connection, type ConnectionFactory, type ConnectionOptions, type ExportResponsesOptions, type Failure, type FileProgressResponse, type ResponseFormat, type Result, type Success, createConnection, exportResponses, getBearerToken, getResponseExportFile, getResponseExportProgress, startResponseExport, testConnection };
496
+ export { type Action, type ActionFactory, type Connection, type ConnectionFactory, type ConnectionOptions, type Contact, type ContactsImportStatusResponse, type ContactsImportSummaryResponse, type CreateDistributionOptions, type CreateReminderOptions, type Distribution, type DistributionOptions, type DistributionRequestType, type ExportResponsesOptions, type Failure, type FileProgressResponse, type ResponseFormat, type Result, type StartContactsImportOptions, type Success, createConnection, createDistribution, createMailingList, createReminder, distributeSurveys, exportResponses, getBearerToken, getContactsImportStatus, getContactsImportSummary, getDistribution, getResponseExportFile, getResponseExportProgress, importContacts, listDistributions, listLibraryMessages, startContactsImport, startResponseExport, testConnection };