Skip to content

Commit 58dfbc7

Browse files
authored
Send customer chat (#188)
* Add ability to get user by id * Send customer chat support * Revert "Add ability to get user by id" This reverts commit 77a6532.
1 parent 46a9e0b commit 58dfbc7

File tree

7 files changed

+626
-8
lines changed

7 files changed

+626
-8
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@team-plain/typescript-sdk': minor
3+
---
4+
5+
Added support for sending chats as a customer `sendCustomerChat`

src/client.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
AssignThreadDocument,
1212
type AttachmentUploadUrlPartsFragment,
1313
ChangeThreadPriorityDocument,
14+
type ChatPartsFragment,
1415
CompaniesDocument,
1516
type CompanyPartsFragment,
1617
type CompanyTierMembershipPartsFragment,
@@ -61,6 +62,7 @@ import {
6162
ReplyToThreadDocument,
6263
SearchCompaniesDocument,
6364
SearchTenantsDocument,
65+
SendCustomerChatDocument,
6466
SendNewEmailDocument,
6567
SetCustomerTenantsDocument,
6668
SnoozeThreadDocument,
@@ -1186,4 +1188,17 @@ export class PlainClient {
11861188

11871189
return unwrapData(res, (q) => nonNullable(q.createIndexedDocument.indexedDocument));
11881190
}
1191+
1192+
async sendCustomerChat(
1193+
input: VariablesOf<typeof SendCustomerChatDocument>['input']
1194+
): SDKResult<ChatPartsFragment> {
1195+
const res = await request(this.#ctx, {
1196+
query: SendCustomerChatDocument,
1197+
variables: {
1198+
input,
1199+
},
1200+
});
1201+
1202+
return unwrapData(res, (q) => nonNullable(q.sendCustomerChat.chat));
1203+
}
11891204
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
fragment ChatParts on Chat {
2+
id
3+
text
4+
attachments {
5+
id
6+
}
7+
createdAt {
8+
...DateTimeParts
9+
}
10+
updatedAt {
11+
...DateTimeParts
12+
}
13+
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
mutation sendCustomerChat($input:SendCustomerChatInput!) {
2+
sendCustomerChat(input:$input){
3+
chat {
4+
...ChatParts
5+
}
6+
error {
7+
...MutationErrorParts
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)