@b-jones-rfd/qualtrics-api-tasks 0.2.0 → 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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @b-jones-rfd/qualtrics-api-tasks
2
2
 
3
+ ## 0.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 3bcc969: Added methods for Contacts and Distributions
8
+
3
9
  ## 0.2.0
4
10
 
5
11
  ### Minor Changes
package/README.md CHANGED
@@ -139,6 +139,64 @@ export type Action<TConfig, TResponse> = (
139
139
 
140
140
  If using the actions directly call the factory method with a ConnectionOptions object to return an action that can be used to execute a Qualtrics action.
141
141
 
142
+ #### createDistribution(options)
143
+
144
+ Implements [Create Distribution](https://api.qualtrics.com/573e3f0a94888-create-distribution).
145
+
146
+ `options`
147
+
148
+ | Property | Type | Description | Required | Default |
149
+ | ------------------ | ---------------------- | ---------------------------------- | -------- | ------- |
150
+ | libraryId | string | Quatrics Library ID | Y | |
151
+ | messageId | string | Qualtrics Message ID | Y | |
152
+ | messageText | string | Message text to send | N | |
153
+ | mailingListId | string | Mailing List ID | Y | |
154
+ | contactId | string | Contact lookup ID for individual | N | |
155
+ | transactionBatchId | string | Transaction Batch ID | N | |
156
+ | fromEmail | string | Originating email | Y | |
157
+ | replyToEmail | string | Email reply-to address | N | |
158
+ | fromName | string | Email from name | Y | |
159
+ | subject | string | Email subject | Y | |
160
+ | surveyId | string | Qualtrics Survey ID | Y | |
161
+ | expirationDate | Date | Distribution expiration date time | Y | |
162
+ | type | enum | Individual, Multiple, or Anonymous | Y | |
163
+ | embeddedData | Record<string, string> | Up to 10 subkeys | N | |
164
+ | sendDate | Date | Date time to send | Y | |
165
+ | bearerToken | string | Valid Bearer Token | N | |
166
+
167
+ #### createMailingList(options)
168
+
169
+ Implements [Create Mailing List](https://api.qualtrics.com/3f633e4cea6cd-create-mailing-list)
170
+
171
+ `options`
172
+
173
+ | Property | Type | Description | Required | Default |
174
+ | ---------------------- | ------- | -------------------------------- | -------- | ------- |
175
+ | directoryId | string | Quatrics Directory ID | Y | |
176
+ | name | string | Mailing List Name | Y | |
177
+ | ownerId | string | Owner ID | Y | |
178
+ | prioritizeListMetadata | boolean | Import metadata as list metadata | N | false |
179
+ | bearerToken | string | Valid Bearer Token | N | |
180
+
181
+ #### createReminder(options)
182
+
183
+ Implements [Create Reminder Distribution](https://api.qualtrics.com/764630bb0633a-create-reminder-distribution).
184
+
185
+ `options`
186
+
187
+ | Property | Type | Description | Required | Default |
188
+ | -------------- | ---------------------- | ------------------------ | -------- | ------- |
189
+ | distributionId | string | Previous Distribution ID | Y | |
190
+ | libraryId | string | Quatrics Library ID | Y | |
191
+ | messageId | string | Qualtrics Message ID | Y | |
192
+ | fromEmail | string | Originating email | Y | |
193
+ | replyToEmail | string | Email reply-to address | N | |
194
+ | fromName | string | Email from name | Y | |
195
+ | subject | string | Email subject | Y | |
196
+ | embeddedData | Record<string, string> | Up to 10 subkeys | N | |
197
+ | sendDate | Date | Date time to send | Y | |
198
+ | bearerToken | string | Valid Bearer Token | N | |
199
+
142
200
  #### exportResponses(options)
143
201
 
144
202
  Implements [Survey Response File Export](https://api.qualtrics.com/u9e5lh4172v0v-survey-response-export-guide) multistep process.
@@ -184,6 +242,44 @@ Implements [OAuth Authentication (Client Credentials)](https://api.qualtrics.com
184
242
  | clientSecret | string | Qualtrics Client Password | Y |
185
243
  | scope | string | Qualtrics Client requested scopes | Y |
186
244
 
245
+ #### getContactsImportStatus(options)
246
+
247
+ Implements [Get Contacts Import Status](https://api.qualtrics.com/c5d22705b1d45-get-transaction-contacts-import-status)
248
+
249
+ `options`
250
+
251
+ | Property | Type | Description | Required |
252
+ | ------------- | ------ | --------------------- | -------- |
253
+ | directoryId | string | Quatrics Directory ID | Y |
254
+ | importId | string | Contacts Import ID | Y |
255
+ | mailingListId | string | Mailing List ID | Y |
256
+ | bearerToken | string | Valid Bearer Token | N |
257
+
258
+ #### getContactsImportSummary(options)
259
+
260
+ Implements [Get Contacts Import Summary](https://api.qualtrics.com/6f0480b307053-get-transaction-contacts-import-summary)
261
+
262
+ `options`
263
+
264
+ | Property | Type | Description | Required |
265
+ | ------------- | ------ | --------------------- | -------- |
266
+ | directoryId | string | Quatrics Directory ID | Y |
267
+ | importId | string | Contacts Import ID | Y |
268
+ | mailingListId | string | Mailing List ID | Y |
269
+ | bearerToken | string | Valid Bearer Token | N |
270
+
271
+ #### getDistribution(options)
272
+
273
+ Implements [Get Distribution](https://api.qualtrics.com/f5b1d8775d803-get-distribution)
274
+
275
+ `options`
276
+
277
+ | Property | Type | Description | Required |
278
+ | -------------- | ------ | ------------------ | -------- |
279
+ | distributionId | string | Distribution ID | Y |
280
+ | surveyId | string | Survey ID | Y |
281
+ | bearerToken | string | Valid Bearer Token | N |
282
+
187
283
  #### getResponseExportFile(options)
188
284
 
189
285
  Implements [Get Response Export File](https://api.qualtrics.com/41296b6f2e828-get-response-export-file)
@@ -208,6 +304,65 @@ Implements [Get Response Export Progress](https://api.qualtrics.com/37e6a66f74ab
208
304
  | exportProgressId | string | Progress ID | Y |
209
305
  | bearerToken | string | Valid Bearer Token | N |
210
306
 
307
+ #### importContacts(options)
308
+
309
+ Implements [Contact Import](https://api.qualtrics.com/1ac99fba8ca5b-contact-imports) multistep process
310
+
311
+ `options`
312
+
313
+ | Property | Type | Description | Required |
314
+ | --------------- | --------- | --------------------- | -------- |
315
+ | directoryId | string | Quatrics Directory ID | Y |
316
+ | mailingListId | string | Mailing List ID | Y |
317
+ | contacts | Contact[] | Contacts array | Y |
318
+ | transactionMeta | object | Transaction meta data | N |
319
+ | bearerToken | string | Valid Bearer Token | N |
320
+
321
+ #### listDistributions(options)
322
+
323
+ Implements [List Distributions](https://api.qualtrics.com/234bb6b16cf6d-list-distributions)
324
+
325
+ `options`
326
+
327
+ | Property | Type | Description | Required | Default |
328
+ | ----------------------- | ------- | ------------------------------- | -------- | ------- |
329
+ | surveyId | string | Quatrics Survey ID | Y | |
330
+ | distributionRequestType | string | Distribution Request Type | Y | |
331
+ | mailingListId | string | Mailing List ID | Y | |
332
+ | sendStartDate | Date | Export start date and time | Y | |
333
+ | sendEndDate | Date | Export end date and time | Y | |
334
+ | skipToken | string | Pagination offset | N | |
335
+ | useNewPaginationScheme | boolean | Use updated pagination | N | false |
336
+ | pageSize | number | Distribution elements to return | N | 100 |
337
+ | bearerToken | string | Valid Bearer Token | N | |
338
+
339
+ #### listLibraryMessages(options)
340
+
341
+ Implements [List Library Messages](https://api.qualtrics.com/1d60a66b340fa-list-library-messages)
342
+
343
+ `options`
344
+
345
+ | Property | Type | Description | Required |
346
+ | ----------- | ------ | ------------------- | -------- |
347
+ | libraryId | string | Quatrics Library ID | Y |
348
+ | category | string | Message category | N |
349
+ | offset | number | Pagination offset | N |
350
+ | bearerToken | string | Valid Bearer Token | N |
351
+
352
+ #### startContactsImport(options)
353
+
354
+ Implements [Create Transaction Contacts Import](https://api.qualtrics.com/bab13356ac724-create-transaction-contacts-import)
355
+
356
+ `options`
357
+
358
+ | Property | Type | Description | Required |
359
+ | --------------- | --------- | --------------------- | -------- |
360
+ | directoryId | string | Quatrics Directory ID | Y |
361
+ | mailingListId | string | Mailing List ID | Y |
362
+ | contacts | Contact[] | Contacts array | Y |
363
+ | transactionMeta | object | Transaction meta data | N |
364
+ | bearerToken | string | Valid Bearer Token | N |
365
+
211
366
  #### startResponseExports(options)
212
367
 
213
368
  Implements [Start Response Exports](https://api.qualtrics.com/6b00592b9c013-start-response-export)
package/dist/index.d.mts 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 };