Skip to content

Commit

Permalink
Adding Quick Responses APIs (#807)
Browse files Browse the repository at this point in the history
Added Quick Responses APIs

---------

Co-authored-by: Harrison Ngan <[email protected]>
  • Loading branch information
hngan and Harrison Ngan authored Nov 17, 2023
1 parent 9c233d6 commit 6e4c8fa
Show file tree
Hide file tree
Showing 20 changed files with 45,226 additions and 44,297 deletions.
75 changes: 75 additions & 0 deletions Documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -2195,3 +2195,78 @@ if(voiceConnection.isUnderSupervision()) {
/* Some logic here to indicate disabled call controls to the agent */
}
```
## Quick responses APIs - These APIs are only available **after accepting a chat contact.**
### `QuickResponses.isEnabled()`
Determines if quick responses feature is enabled for a given agent. Returns ``true`` if there is a knowledge base for quick responses configured for the instance. If the first call returns true, the knowledgeBase ID will be cached in local storage for subsequent ``QuickResponse`` API calls.

```js
QuickResponses.isEnabled().then(response => {
...
})
```
### `QuickResponses.searchQuickResponses(params: QuickResponsesQuery)`

Returns a list of Quick responses based on the params given:
```js
QuickResponsesQuery {
query: string; // query string
contactId?: string; // ID of a Contact object. Used to retrieve contact's attributes
nextToken?: string; // The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.
debounceMS?: number; // default value is 250ms. set it to 0 to disable debounced input change
maxResults?: number; //number of results to be returned
}
```

Example usage:
```js
const params = {
query: "Hel",
contactId: "...",
debounceMS: 300,
maxResults: 5
};

QuickResponsesService.searchQuickResponses(params: QuickResponsesQuery).then(response => {
...
});
```

Example response:
```js
{
"nextToken": "token_string",
"results": [
{
"attributesNotInterpolated": [],
"channels": [ "Chat" ],
"contentType": "application/x.quickresponse;format=markdown",
"contents": {
"markdown": {
"content": "Hello"
},
"plainText": {
"content": "Hello"
}
},
"createdTime": 1697812550,
"description": "Test",
"groupingConfiguration": {
"criteria": "RoutingProfileArn",
"values": [ "..." ]
},
"isActive": true,
"knowledgeBaseArn": "...",
"knowledgeBaseId": "...",
"language": "en_US",
"lastModifiedBy": "...",
"lastModifiedTime": 1697812550,
"name": "Test",
"quickResponseArn": "...",
"quickResponseId": "...",
"shortcutKey": "Test",
"status": "CREATED"
},
//... more results
]
}
```
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amazon-connect-streams",
"version": "2.7.4",
"version": "2.8.0",
"description": "Amazon Connect Streams Library",
"engines": {
"node": ">=12.0.0"
Expand Down
2 changes: 1 addition & 1 deletion release/connect-streams-dr-min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release/connect-streams-dr.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion release/connect-streams-min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 6e4c8fa

Please sign in to comment.