forked from intercom/intercom-java
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAsyncConversationsClient.java
More file actions
516 lines (484 loc) · 51.1 KB
/
Copy pathAsyncConversationsClient.java
File metadata and controls
516 lines (484 loc) · 51.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
/**
* This file was auto-generated by Fern from our API Definition.
*/
package com.intercom.api.resources.conversations;
import com.intercom.api.core.ClientOptions;
import com.intercom.api.core.RequestOptions;
import com.intercom.api.core.pagination.SyncPagingIterable;
import com.intercom.api.resources.conversations.requests.AttachContactToConversationRequest;
import com.intercom.api.resources.conversations.requests.AutoAssignConversationRequest;
import com.intercom.api.resources.conversations.requests.ConvertConversationToTicketRequest;
import com.intercom.api.resources.conversations.requests.CreateConversationRequest;
import com.intercom.api.resources.conversations.requests.DeleteConversationRequest;
import com.intercom.api.resources.conversations.requests.DetachContactFromConversationRequest;
import com.intercom.api.resources.conversations.requests.FindConversationRequest;
import com.intercom.api.resources.conversations.requests.ListConversationsRequest;
import com.intercom.api.resources.conversations.requests.ManageConversationPartsRequest;
import com.intercom.api.resources.conversations.requests.ReplyToConversationRequest;
import com.intercom.api.resources.conversations.requests.UpdateConversationRequest;
import com.intercom.api.resources.conversations.types.Conversation;
import com.intercom.api.resources.messages.types.Message;
import com.intercom.api.resources.tickets.types.Ticket;
import com.intercom.api.types.ConversationDeleted;
import com.intercom.api.types.RedactConversationRequest;
import com.intercom.api.types.SearchRequest;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
public class AsyncConversationsClient {
protected final ClientOptions clientOptions;
private final AsyncRawConversationsClient rawClient;
public AsyncConversationsClient(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.rawClient = new AsyncRawConversationsClient(clientOptions);
}
/**
* Get responses with HTTP metadata like headers
*/
public AsyncRawConversationsClient withRawResponse() {
return this.rawClient;
}
/**
* You can fetch a list of all conversations.
* <p>You can optionally request the result page size and the cursor to start after to fetch the result.
* {% admonition type="warning" name="Pagination" %}
* You can use pagination to limit the number of results returned. The default is <code>20</code> results per page.
* See the <a href="https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis">pagination section</a> for more details on how to use the <code>starting_after</code> param.
* {% /admonition %}</p>
*/
public CompletableFuture<SyncPagingIterable<Conversation>> list() {
return this.rawClient.list().thenApply(response -> response.body());
}
/**
* You can fetch a list of all conversations.
* <p>You can optionally request the result page size and the cursor to start after to fetch the result.
* {% admonition type="warning" name="Pagination" %}
* You can use pagination to limit the number of results returned. The default is <code>20</code> results per page.
* See the <a href="https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis">pagination section</a> for more details on how to use the <code>starting_after</code> param.
* {% /admonition %}</p>
*/
public CompletableFuture<SyncPagingIterable<Conversation>> list(ListConversationsRequest request) {
return this.rawClient.list(request).thenApply(response -> response.body());
}
/**
* You can fetch a list of all conversations.
* <p>You can optionally request the result page size and the cursor to start after to fetch the result.
* {% admonition type="warning" name="Pagination" %}
* You can use pagination to limit the number of results returned. The default is <code>20</code> results per page.
* See the <a href="https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#pagination-for-list-apis">pagination section</a> for more details on how to use the <code>starting_after</code> param.
* {% /admonition %}</p>
*/
public CompletableFuture<SyncPagingIterable<Conversation>> list(
ListConversationsRequest request, RequestOptions requestOptions) {
return this.rawClient.list(request, requestOptions).thenApply(response -> response.body());
}
/**
* You can create a conversation that has been initiated by a contact (ie. user or lead).
* The conversation can be an in-app message only.
* <p>{% admonition type="info" name="Sending for visitors" %}
* You can also send a message from a visitor by specifying their <code>user_id</code> or <code>id</code> value in the <code>from</code> field, along with a <code>type</code> field value of <code>contact</code>.
* This visitor will be automatically converted to a contact with a lead role once the conversation is created.
* {% /admonition %}</p>
* <p>This will return the Message model that has been created.</p>
*/
public CompletableFuture<Message> create(CreateConversationRequest request) {
return this.rawClient.create(request).thenApply(response -> response.body());
}
/**
* You can create a conversation that has been initiated by a contact (ie. user or lead).
* The conversation can be an in-app message only.
* <p>{% admonition type="info" name="Sending for visitors" %}
* You can also send a message from a visitor by specifying their <code>user_id</code> or <code>id</code> value in the <code>from</code> field, along with a <code>type</code> field value of <code>contact</code>.
* This visitor will be automatically converted to a contact with a lead role once the conversation is created.
* {% /admonition %}</p>
* <p>This will return the Message model that has been created.</p>
*/
public CompletableFuture<Message> create(CreateConversationRequest request, RequestOptions requestOptions) {
return this.rawClient.create(request, requestOptions).thenApply(response -> response.body());
}
/**
* You can fetch the details of a single conversation.
* <p>This will return a single Conversation model with all its conversation parts.</p>
* <p>{% admonition type="warning" name="Hard limit of 500 parts" %}
* The maximum number of conversation parts that can be returned via the API is 500. If you have more than that we will return the 500 most recent conversation parts.
* {% /admonition %}</p>
* <p>For AI agent conversation metadata, please note that you need to have the agent enabled in your workspace, which is a <a href="https://www.intercom.com/help/en/articles/8205718-fin-resolutions#h_97f8c2e671">paid feature</a>.</p>
*/
public CompletableFuture<Conversation> find(FindConversationRequest request) {
return this.rawClient.find(request).thenApply(response -> response.body());
}
/**
* You can fetch the details of a single conversation.
* <p>This will return a single Conversation model with all its conversation parts.</p>
* <p>{% admonition type="warning" name="Hard limit of 500 parts" %}
* The maximum number of conversation parts that can be returned via the API is 500. If you have more than that we will return the 500 most recent conversation parts.
* {% /admonition %}</p>
* <p>For AI agent conversation metadata, please note that you need to have the agent enabled in your workspace, which is a <a href="https://www.intercom.com/help/en/articles/8205718-fin-resolutions#h_97f8c2e671">paid feature</a>.</p>
*/
public CompletableFuture<Conversation> find(FindConversationRequest request, RequestOptions requestOptions) {
return this.rawClient.find(request, requestOptions).thenApply(response -> response.body());
}
/**
* You can update an existing conversation.
* <p>{% admonition type="info" name="Replying and other actions" %}
* If you want to reply to a coveration or take an action such as assign, unassign, open, close or snooze, take a look at the reply and manage endpoints.
* {% /admonition %}</p>
* <p>{% admonition type="info" %}
* This endpoint handles both <strong>conversation updates</strong> and <strong>custom object associations</strong>.</p>
* <p>See <em><code>update a conversation with an association to a custom object instance</code></em> in the request/response examples to see the custom object association format.
* {% /admonition %}</p>
*/
public CompletableFuture<Conversation> update(UpdateConversationRequest request) {
return this.rawClient.update(request).thenApply(response -> response.body());
}
/**
* You can update an existing conversation.
* <p>{% admonition type="info" name="Replying and other actions" %}
* If you want to reply to a coveration or take an action such as assign, unassign, open, close or snooze, take a look at the reply and manage endpoints.
* {% /admonition %}</p>
* <p>{% admonition type="info" %}
* This endpoint handles both <strong>conversation updates</strong> and <strong>custom object associations</strong>.</p>
* <p>See <em><code>update a conversation with an association to a custom object instance</code></em> in the request/response examples to see the custom object association format.
* {% /admonition %}</p>
*/
public CompletableFuture<Conversation> update(UpdateConversationRequest request, RequestOptions requestOptions) {
return this.rawClient.update(request, requestOptions).thenApply(response -> response.body());
}
/**
* You can delete a single conversation.
*/
public CompletableFuture<ConversationDeleted> deleteConversation(DeleteConversationRequest request) {
return this.rawClient.deleteConversation(request).thenApply(response -> response.body());
}
/**
* You can delete a single conversation.
*/
public CompletableFuture<ConversationDeleted> deleteConversation(
DeleteConversationRequest request, RequestOptions requestOptions) {
return this.rawClient.deleteConversation(request, requestOptions).thenApply(response -> response.body());
}
/**
* You can search for multiple conversations by the value of their attributes in order to fetch exactly which ones you want.
* <p>To search for conversations, you need to send a <code>POST</code> request to <code>https://api.intercom.io/conversations/search</code>.</p>
* <p>This will accept a query object in the body which will define your filters in order to search for conversations.
* {% admonition type="warning" name="Optimizing search queries" %}
* Search queries can be complex, so optimizing them can help the performance of your search.
* Use the <code>AND</code> and <code>OR</code> operators to combine multiple filters to get the exact results you need and utilize
* pagination to limit the number of results returned. The default is <code>20</code> results per page and maximum is <code>150</code>.
* See the <a href="https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request">pagination section</a> for more details on how to use the <code>starting_after</code> param.
* {% /admonition %}</p>
* <h3>Nesting & Limitations</h3>
* <p>You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4).
* There are some limitations to the amount of multiple's there can be:</p>
* <ul>
* <li>There's a limit of max 2 nested filters</li>
* <li>There's a limit of max 15 filters for each AND or OR group</li>
* </ul>
* <h3>Accepted Fields</h3>
* <p>Most keys listed in the conversation model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as <code>created_at</code> accepts a date, the <code>value</code> cannot be a string such as <code>"foorbar"</code>).
* The <code>source.body</code> field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a <code>"I need support"</code> body - the query should contain a <code>=</code> operator with the value <code>"support"</code> for such conversation to be returned. A query with a <code>=</code> operator and a <code>"need support"</code> value will not yield a result.</p>
* <p>| Field | Type |
* | :---------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- |
* | id | String |
* | created_at | Date (UNIX timestamp) |
* | updated_at | Date (UNIX timestamp) |
* | source.type | String<br>Accepted fields are <code>conversation</code>, <code>email</code>, <code>facebook</code>, <code>instagram</code>, <code>phone_call</code>, <code>phone_switch</code>, <code>push</code>, <code>sms</code>, <code>twitter</code> and <code>whatsapp</code>. |
* | source.id | String |
* | source.delivered_as | String |
* | source.subject | String |
* | source.body | String |
* | source.author.id | String |
* | source.author.type | String |
* | source.author.name | String |
* | source.author.email | String |
* | source.url | String |
* | contact_ids | String |
* | teammate_ids | String |
* | admin_assignee_id | String |
* | team_assignee_id | String |
* | channel_initiated | String |
* | open | Boolean |
* | read | Boolean |
* | state | String |
* | waiting_since | Date (UNIX timestamp) |
* | snoozed_until | Date (UNIX timestamp) |
* | tag_ids | String |
* | priority | String |
* | statistics.time_to_assignment | Integer |
* | statistics.time_to_admin_reply | Integer |
* | statistics.time_to_first_close | Integer |
* | statistics.time_to_last_close | Integer |
* | statistics.median_time_to_reply | Integer |
* | statistics.first_contact_reply_at | Date (UNIX timestamp) |
* | statistics.first_assignment_at | Date (UNIX timestamp) |
* | statistics.first_admin_reply_at | Date (UNIX timestamp) |
* | statistics.first_close_at | Date (UNIX timestamp) |
* | statistics.last_assignment_at | Date (UNIX timestamp) |
* | statistics.last_assignment_admin_reply_at | Date (UNIX timestamp) |
* | statistics.last_contact_reply_at | Date (UNIX timestamp) |
* | statistics.last_admin_reply_at | Date (UNIX timestamp) |
* | statistics.last_close_at | Date (UNIX timestamp) |
* | statistics.last_closed_by_id | String |
* | statistics.count_reopens | Integer |
* | statistics.count_assignments | Integer |
* | statistics.count_conversation_parts | Integer |
* | conversation_rating.requested_at | Date (UNIX timestamp) |
* | conversation_rating.replied_at | Date (UNIX timestamp) |
* | conversation_rating.score | Integer |
* | conversation_rating.remark | String |
* | conversation_rating.contact_id | String |
* | conversation_rating.admin_d | String |
* | ai_agent_participated | Boolean |
* | ai_agent.resolution_state | String |
* | ai_agent.last_answer_type | String |
* | ai_agent.rating | Integer |
* | ai_agent.rating_remark | String |
* | ai_agent.source_type | String |
* | ai_agent.source_title | String |</p>
* <h3>Accepted Operators</h3>
* <p>The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (<code>"="</code>). The operator has to be compatible with the field's type (eg. you cannot search with <code>></code> for a given string value as it's only compatible for integer's and dates).</p>
* <p>| Operator | Valid Types | Description |
* | :------- | :----------------------------- | :----------------------------------------------------------- |
* | = | All | Equals |
* | != | All | Doesn't Equal |
* | IN | All | In Shortcut for <code>OR</code> queries Values most be in Array |
* | NIN | All | Not In Shortcut for <code>OR !</code> queries Values must be in Array |
* | > | Integer Date (UNIX Timestamp) | Greater (or equal) than |
* | < | Integer Date (UNIX Timestamp) | Lower (or equal) than |
* | ~ | String | Contains |
* | !~ | String | Doesn't Contain |
* | ^ | String | Starts With |
* | $ | String | Ends With |</p>
*/
public CompletableFuture<SyncPagingIterable<Conversation>> search(SearchRequest request) {
return this.rawClient.search(request).thenApply(response -> response.body());
}
/**
* You can search for multiple conversations by the value of their attributes in order to fetch exactly which ones you want.
* <p>To search for conversations, you need to send a <code>POST</code> request to <code>https://api.intercom.io/conversations/search</code>.</p>
* <p>This will accept a query object in the body which will define your filters in order to search for conversations.
* {% admonition type="warning" name="Optimizing search queries" %}
* Search queries can be complex, so optimizing them can help the performance of your search.
* Use the <code>AND</code> and <code>OR</code> operators to combine multiple filters to get the exact results you need and utilize
* pagination to limit the number of results returned. The default is <code>20</code> results per page and maximum is <code>150</code>.
* See the <a href="https://developers.intercom.com/docs/build-an-integration/learn-more/rest-apis/pagination/#example-search-conversations-request">pagination section</a> for more details on how to use the <code>starting_after</code> param.
* {% /admonition %}</p>
* <h3>Nesting & Limitations</h3>
* <p>You can nest these filters in order to get even more granular insights that pinpoint exactly what you need. Example: (1 OR 2) AND (3 OR 4).
* There are some limitations to the amount of multiple's there can be:</p>
* <ul>
* <li>There's a limit of max 2 nested filters</li>
* <li>There's a limit of max 15 filters for each AND or OR group</li>
* </ul>
* <h3>Accepted Fields</h3>
* <p>Most keys listed in the conversation model are searchable, whether writeable or not. The value you search for has to match the accepted type, otherwise the query will fail (ie. as <code>created_at</code> accepts a date, the <code>value</code> cannot be a string such as <code>"foorbar"</code>).
* The <code>source.body</code> field is unique as the search will not be performed against the entire value, but instead against every element of the value separately. For example, when searching for a conversation with a <code>"I need support"</code> body - the query should contain a <code>=</code> operator with the value <code>"support"</code> for such conversation to be returned. A query with a <code>=</code> operator and a <code>"need support"</code> value will not yield a result.</p>
* <p>| Field | Type |
* | :---------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- |
* | id | String |
* | created_at | Date (UNIX timestamp) |
* | updated_at | Date (UNIX timestamp) |
* | source.type | String<br>Accepted fields are <code>conversation</code>, <code>email</code>, <code>facebook</code>, <code>instagram</code>, <code>phone_call</code>, <code>phone_switch</code>, <code>push</code>, <code>sms</code>, <code>twitter</code> and <code>whatsapp</code>. |
* | source.id | String |
* | source.delivered_as | String |
* | source.subject | String |
* | source.body | String |
* | source.author.id | String |
* | source.author.type | String |
* | source.author.name | String |
* | source.author.email | String |
* | source.url | String |
* | contact_ids | String |
* | teammate_ids | String |
* | admin_assignee_id | String |
* | team_assignee_id | String |
* | channel_initiated | String |
* | open | Boolean |
* | read | Boolean |
* | state | String |
* | waiting_since | Date (UNIX timestamp) |
* | snoozed_until | Date (UNIX timestamp) |
* | tag_ids | String |
* | priority | String |
* | statistics.time_to_assignment | Integer |
* | statistics.time_to_admin_reply | Integer |
* | statistics.time_to_first_close | Integer |
* | statistics.time_to_last_close | Integer |
* | statistics.median_time_to_reply | Integer |
* | statistics.first_contact_reply_at | Date (UNIX timestamp) |
* | statistics.first_assignment_at | Date (UNIX timestamp) |
* | statistics.first_admin_reply_at | Date (UNIX timestamp) |
* | statistics.first_close_at | Date (UNIX timestamp) |
* | statistics.last_assignment_at | Date (UNIX timestamp) |
* | statistics.last_assignment_admin_reply_at | Date (UNIX timestamp) |
* | statistics.last_contact_reply_at | Date (UNIX timestamp) |
* | statistics.last_admin_reply_at | Date (UNIX timestamp) |
* | statistics.last_close_at | Date (UNIX timestamp) |
* | statistics.last_closed_by_id | String |
* | statistics.count_reopens | Integer |
* | statistics.count_assignments | Integer |
* | statistics.count_conversation_parts | Integer |
* | conversation_rating.requested_at | Date (UNIX timestamp) |
* | conversation_rating.replied_at | Date (UNIX timestamp) |
* | conversation_rating.score | Integer |
* | conversation_rating.remark | String |
* | conversation_rating.contact_id | String |
* | conversation_rating.admin_d | String |
* | ai_agent_participated | Boolean |
* | ai_agent.resolution_state | String |
* | ai_agent.last_answer_type | String |
* | ai_agent.rating | Integer |
* | ai_agent.rating_remark | String |
* | ai_agent.source_type | String |
* | ai_agent.source_title | String |</p>
* <h3>Accepted Operators</h3>
* <p>The table below shows the operators you can use to define how you want to search for the value. The operator should be put in as a string (<code>"="</code>). The operator has to be compatible with the field's type (eg. you cannot search with <code>></code> for a given string value as it's only compatible for integer's and dates).</p>
* <p>| Operator | Valid Types | Description |
* | :------- | :----------------------------- | :----------------------------------------------------------- |
* | = | All | Equals |
* | != | All | Doesn't Equal |
* | IN | All | In Shortcut for <code>OR</code> queries Values most be in Array |
* | NIN | All | Not In Shortcut for <code>OR !</code> queries Values must be in Array |
* | > | Integer Date (UNIX Timestamp) | Greater (or equal) than |
* | < | Integer Date (UNIX Timestamp) | Lower (or equal) than |
* | ~ | String | Contains |
* | !~ | String | Doesn't Contain |
* | ^ | String | Starts With |
* | $ | String | Ends With |</p>
*/
public CompletableFuture<SyncPagingIterable<Conversation>> search(
SearchRequest request, RequestOptions requestOptions) {
return this.rawClient.search(request, requestOptions).thenApply(response -> response.body());
}
/**
* You can reply to a conversation with a message from an admin or on behalf of a contact, or with a note for admins.
*/
public CompletableFuture<Conversation> reply(ReplyToConversationRequest request) {
return this.rawClient.reply(request).thenApply(response -> response.body());
}
/**
* You can reply to a conversation with a message from an admin or on behalf of a contact, or with a note for admins.
*/
public CompletableFuture<Conversation> reply(ReplyToConversationRequest request, RequestOptions requestOptions) {
return this.rawClient.reply(request, requestOptions).thenApply(response -> response.body());
}
/**
* For managing conversations you can:
* <ul>
* <li>Close a conversation</li>
* <li>Snooze a conversation to reopen on a future date</li>
* <li>Open a conversation which is <code>snoozed</code> or <code>closed</code></li>
* <li>Assign a conversation to an admin and/or team.</li>
* </ul>
*/
public CompletableFuture<Conversation> manage(ManageConversationPartsRequest request) {
return this.rawClient.manage(request).thenApply(response -> response.body());
}
/**
* For managing conversations you can:
* <ul>
* <li>Close a conversation</li>
* <li>Snooze a conversation to reopen on a future date</li>
* <li>Open a conversation which is <code>snoozed</code> or <code>closed</code></li>
* <li>Assign a conversation to an admin and/or team.</li>
* </ul>
*/
public CompletableFuture<Conversation> manage(
ManageConversationPartsRequest request, RequestOptions requestOptions) {
return this.rawClient.manage(request, requestOptions).thenApply(response -> response.body());
}
/**
* You can add participants who are contacts to a conversation, on behalf of either another contact or an admin.
* <p>{% admonition type="warning" name="Contacts without an email" %}
* If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with <code>role</code> set to <code>lead</code>.
* {% /admonition %}</p>
*/
public CompletableFuture<Conversation> attachContactAsAdmin(AttachContactToConversationRequest request) {
return this.rawClient.attachContactAsAdmin(request).thenApply(response -> response.body());
}
/**
* You can add participants who are contacts to a conversation, on behalf of either another contact or an admin.
* <p>{% admonition type="warning" name="Contacts without an email" %}
* If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with <code>role</code> set to <code>lead</code>.
* {% /admonition %}</p>
*/
public CompletableFuture<Conversation> attachContactAsAdmin(
AttachContactToConversationRequest request, RequestOptions requestOptions) {
return this.rawClient.attachContactAsAdmin(request, requestOptions).thenApply(response -> response.body());
}
/**
* You can add participants who are contacts to a conversation, on behalf of either another contact or an admin.
* <p>{% admonition type="warning" name="Contacts without an email" %}
* If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with <code>role</code> set to <code>lead</code>.
* {% /admonition %}</p>
*/
public CompletableFuture<Conversation> detachContactAsAdmin(DetachContactFromConversationRequest request) {
return this.rawClient.detachContactAsAdmin(request).thenApply(response -> response.body());
}
/**
* You can add participants who are contacts to a conversation, on behalf of either another contact or an admin.
* <p>{% admonition type="warning" name="Contacts without an email" %}
* If you add a contact via the email parameter and there is no user/lead found on that workspace with he given email, then we will create a new contact with <code>role</code> set to <code>lead</code>.
* {% /admonition %}</p>
*/
public CompletableFuture<Conversation> detachContactAsAdmin(
DetachContactFromConversationRequest request, RequestOptions requestOptions) {
return this.rawClient.detachContactAsAdmin(request, requestOptions).thenApply(response -> response.body());
}
/**
* You can redact a conversation part or the source message of a conversation (as seen in the source object).
* <p>{% admonition type="info" name="Redacting parts and messages" %}
* If you are redacting a conversation part, it must have a <code>body</code>. If you are redacting a source message, it must have been created by a contact. We will return a <code>conversation_part_not_redactable</code> error if these criteria are not met.
* {% /admonition %}</p>
*/
public CompletableFuture<Conversation> redactConversationPart(RedactConversationRequest request) {
return this.rawClient.redactConversationPart(request).thenApply(response -> response.body());
}
/**
* You can redact a conversation part or the source message of a conversation (as seen in the source object).
* <p>{% admonition type="info" name="Redacting parts and messages" %}
* If you are redacting a conversation part, it must have a <code>body</code>. If you are redacting a source message, it must have been created by a contact. We will return a <code>conversation_part_not_redactable</code> error if these criteria are not met.
* {% /admonition %}</p>
*/
public CompletableFuture<Conversation> redactConversationPart(
RedactConversationRequest request, RequestOptions requestOptions) {
return this.rawClient.redactConversationPart(request, requestOptions).thenApply(response -> response.body());
}
/**
* You can convert a conversation to a ticket.
*/
public CompletableFuture<Optional<Ticket>> convertToTicket(ConvertConversationToTicketRequest request) {
return this.rawClient.convertToTicket(request).thenApply(response -> response.body());
}
/**
* You can convert a conversation to a ticket.
*/
public CompletableFuture<Optional<Ticket>> convertToTicket(
ConvertConversationToTicketRequest request, RequestOptions requestOptions) {
return this.rawClient.convertToTicket(request, requestOptions).thenApply(response -> response.body());
}
/**
* {% admonition type="danger" name="Deprecation of Run Assignment Rules" %}
* Run assignment rules is now deprecated in version 2.12 and future versions and will be permanently removed on December 31, 2026. After this date, any requests made to this endpoint will fail.
* {% /admonition %}
* You can let a conversation be automatically assigned following assignment rules.
* {% admonition type="warning" name="When using workflows" %}
* It is not possible to use this endpoint with Workflows.
* {% /admonition %}
*/
public CompletableFuture<Conversation> runAssignmentRules(AutoAssignConversationRequest request) {
return this.rawClient.runAssignmentRules(request).thenApply(response -> response.body());
}
/**
* {% admonition type="danger" name="Deprecation of Run Assignment Rules" %}
* Run assignment rules is now deprecated in version 2.12 and future versions and will be permanently removed on December 31, 2026. After this date, any requests made to this endpoint will fail.
* {% /admonition %}
* You can let a conversation be automatically assigned following assignment rules.
* {% admonition type="warning" name="When using workflows" %}
* It is not possible to use this endpoint with Workflows.
* {% /admonition %}
*/
public CompletableFuture<Conversation> runAssignmentRules(
AutoAssignConversationRequest request, RequestOptions requestOptions) {
return this.rawClient.runAssignmentRules(request, requestOptions).thenApply(response -> response.body());
}
}