Skip to content

Commit 7f60e85

Browse files
committed
1 parent 432317b commit 7f60e85

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+3190
-0
lines changed
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy of
4+
this software and associated documentation files (the "Software"), to deal in
5+
the Software without restriction, including without limitation the rights to
6+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
7+
the Software, and to permit persons to whom the Software is furnished to do so.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
10+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
11+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
12+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
13+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
14+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# A Lambda function code hook for Amazon Connect Chat Interactive Messaging [Lex V2]
2+
3+
Set up this AWS Lambda code hook to provide interactive message responses to an Amazon Lex chat bot
4+
5+
![Lex Lambda Hook Diagram](./AmazonConnectLexLambdaArchitecture.png)
6+
7+
## Overview
8+
This repository contains code for the Lambda Function, described in the AWS Contact Center blog post [How to enable interactive messages in Amazon Connect chat](https://aws.amazon.com/blogs/contact-center/easily-set-up-interactive-messages-for-your-amazon-connect-chatbot/).
9+
10+
![Interactive Message Diagram](./interactive-message-diagram.png)
11+
12+
![Interactive Message Flow Chart](InteractiveMessageUIExample_FlowChart.png)
13+
14+
## Setup
15+
Set up the Lambda function code hook as described below
16+
17+
* Login to the [AWS Console](https://console.aws.amazon.com/console/home) and choose a region such as `us-west-2`
18+
* On the Services menu in the upper left, search for and then choose *AWS Lambda*
19+
* On the *AWS Lambda* page, choose *Create Function* on the upper right corner.
20+
* Under Create function, choose the radio button for *Browse serverless app repository*
21+
* Under the *Public applications* tab, search for `amazon-connect-interactive-messages-example` and click on it. Deep link [here](https://serverlessrepo.aws.amazon.com/applications/us-west-2/841676849665/amazon-connect-interactive-messages-example)
22+
* On the *Review, configure, and deploy* page, review the *Application details* and click *Deploy*.
23+
* Set up an Amazon Lex chat bot and connect it to the AWS Lambda function as decribed in the AWS Contact Center blog post [How to enable interactive messages in Amazon Connect chat](https://aws.amazon.com/blogs/contact-center/easily-set-up-interactive-messages-for-your-amazon-connect-chatbot/)
24+
25+
## License Summary
26+
27+
This sample code is made available under the MIT-0 license. See the LICENSE file.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
{
2+
"requestAttributes": {
3+
"x-amz-lex:accept-content-types": "PlainText"
4+
},
5+
"sessionId": "5d11c7ca-6eb1-48d1-b5f2-58510e9ae6c3",
6+
"inputTranscript": "help",
7+
"interpretations": [
8+
{
9+
"intent": {
10+
"slots": {
11+
"action": null,
12+
"appointment": null,
13+
"department": null,
14+
"interactiveOption": null
15+
},
16+
"confirmationState": "None",
17+
"name": "InteractiveMessageIntent",
18+
"state": "InProgress"
19+
},
20+
"nluConfidence": 1
21+
},
22+
{
23+
"intent": {
24+
"slots": {},
25+
"confirmationState": "None",
26+
"name": "FallbackIntent",
27+
"state": "InProgress"
28+
}
29+
}
30+
],
31+
"responseContentType": "text/plain; charset=utf-8",
32+
"sessionState": {
33+
"sessionAttributes": {},
34+
"activeContexts": [],
35+
"intent": {
36+
"slots": {
37+
"action": null,
38+
"appointment": null,
39+
"department": null,
40+
"interactiveOption": null
41+
},
42+
"confirmationState": "None",
43+
"name": "InteractiveMessageIntent",
44+
"state": "InProgress"
45+
},
46+
"originatingRequestId": "abc2cbc8-4e60-4649-83c7-c317d4d21824"
47+
},
48+
"invocationSource": "DialogCodeHook",
49+
"messageVersion": "1.0",
50+
"bot": {
51+
"aliasName": "TestBotAlias",
52+
"aliasId": "TSTALIASID",
53+
"name": "interactive-messaging-lexv2",
54+
"version": "DRAFT",
55+
"localeId": "en_US",
56+
"id": "VGKIKY0S9G"
57+
},
58+
"inputMode": "Text"
59+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"requestAttributes": {
3+
"x-amz-lex:accept-content-types": "PlainText"
4+
},
5+
"sessionId": "5d11c7ca-6eb1-48d1-b5f2-58510e9ae6c3",
6+
"inputTranscript": "Check self-service options",
7+
"interpretations": [
8+
{
9+
"intent": {
10+
"slots": {
11+
"action": {
12+
"shape": "Scalar",
13+
"value": {
14+
"originalValue": "Check self-service options",
15+
"resolvedValues": [
16+
"Check self-service options"
17+
],
18+
"interpretedValue": "Check self-service options"
19+
}
20+
},
21+
"appointment": null,
22+
"department": null,
23+
"interactiveOption": null
24+
},
25+
"confirmationState": "None",
26+
"name": "InteractiveMessageIntent",
27+
"state": "InProgress"
28+
},
29+
"nluConfidence": 1
30+
},
31+
{
32+
"intent": {
33+
"slots": {},
34+
"confirmationState": "None",
35+
"name": "FallbackIntent",
36+
"state": "InProgress"
37+
}
38+
}
39+
],
40+
"responseContentType": "text/plain; charset=utf-8",
41+
"sessionState": {
42+
"sessionAttributes": {},
43+
"activeContexts": [],
44+
"intent": {
45+
"slots": {
46+
"action": {
47+
"shape": "Scalar",
48+
"value": {
49+
"originalValue": "Check self-service options",
50+
"resolvedValues": [
51+
"Check self-service options"
52+
],
53+
"interpretedValue": "Check self-service options"
54+
}
55+
},
56+
"appointment": null,
57+
"department": null,
58+
"interactiveOption": null
59+
},
60+
"confirmationState": "None",
61+
"name": "InteractiveMessageIntent",
62+
"state": "InProgress"
63+
},
64+
"originatingRequestId": "abc2cbc8-4e60-4649-83c7-c317d4d21824"
65+
},
66+
"invocationSource": "DialogCodeHook",
67+
"messageVersion": "1.0",
68+
"bot": {
69+
"aliasName": "TestBotAlias",
70+
"aliasId": "TSTALIASID",
71+
"name": "interactive-messaging-lexv2",
72+
"version": "DRAFT",
73+
"localeId": "en_US",
74+
"id": "VGKIKY0S9G"
75+
},
76+
"inputMode": "Text"
77+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
{
2+
"requestAttributes": {
3+
"x-amz-lex:accept-content-types": "PlainText"
4+
},
5+
"sessionId": "5d11c7ca-6eb1-48d1-b5f2-58510e9ae6c3",
6+
"inputTranscript": "Choose a department",
7+
"interpretations": [
8+
{
9+
"intent": {
10+
"slots": {
11+
"action": {
12+
"shape": "Scalar",
13+
"value": {
14+
"originalValue": "Check self-service options",
15+
"resolvedValues": [
16+
"Check self-service options"
17+
],
18+
"interpretedValue": "Check self-service options"
19+
}
20+
},
21+
"appointment": null,
22+
"department": null,
23+
"interactiveOption": {
24+
"shape": "Scalar",
25+
"value": {
26+
"originalValue": "Choose a department",
27+
"resolvedValues": [
28+
"Choose a department"
29+
],
30+
"interpretedValue": "Choose a department"
31+
}
32+
}
33+
},
34+
"confirmationState": "None",
35+
"name": "InteractiveMessageIntent",
36+
"state": "InProgress"
37+
},
38+
"nluConfidence": 1
39+
},
40+
{
41+
"intent": {
42+
"slots": {},
43+
"confirmationState": "None",
44+
"name": "FallbackIntent",
45+
"state": "InProgress"
46+
}
47+
}
48+
],
49+
"responseContentType": "text/plain; charset=utf-8",
50+
"sessionState": {
51+
"sessionAttributes": {},
52+
"activeContexts": [],
53+
"intent": {
54+
"slots": {
55+
"action": {
56+
"shape": "Scalar",
57+
"value": {
58+
"originalValue": "Check self-service options",
59+
"resolvedValues": [
60+
"Check self-service options"
61+
],
62+
"interpretedValue": "Check self-service options"
63+
}
64+
},
65+
"appointment": null,
66+
"department": null,
67+
"interactiveOption": {
68+
"shape": "Scalar",
69+
"value": {
70+
"originalValue": "Choose a department",
71+
"resolvedValues": [
72+
"Choose a department"
73+
],
74+
"interpretedValue": "Choose a department"
75+
}
76+
}
77+
},
78+
"confirmationState": "None",
79+
"name": "InteractiveMessageIntent",
80+
"state": "InProgress"
81+
},
82+
"originatingRequestId": "abc2cbc8-4e60-4649-83c7-c317d4d21824"
83+
},
84+
"invocationSource": "DialogCodeHook",
85+
"messageVersion": "1.0",
86+
"inputMode": "Text",
87+
"bot": {
88+
"aliasName": "TestBotAlias",
89+
"aliasId": "TSTALIASID",
90+
"name": "interactive-messaging-lexv2",
91+
"version": "DRAFT",
92+
"localeId": "en_US",
93+
"id": "VGKIKY0S9G"
94+
}
95+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
{
2+
"requestAttributes": {
3+
"x-amz-lex:accept-content-types": "PlainText"
4+
},
5+
"sessionId": "5d11c7ca-6eb1-48d1-b5f2-58510e9ae6c3",
6+
"inputTranscript": "Billing",
7+
"interpretations": [
8+
{
9+
"intent": {
10+
"slots": {
11+
"action": {
12+
"shape": "Scalar",
13+
"value": {
14+
"originalValue": "Check self-service options",
15+
"resolvedValues": [
16+
"Check self-service options"
17+
],
18+
"interpretedValue": "Check self-service options"
19+
}
20+
},
21+
"appointment": null,
22+
"department": {
23+
"shape": "Scalar",
24+
"value": {
25+
"originalValue": "Billing",
26+
"resolvedValues": [
27+
"Billing"
28+
],
29+
"interpretedValue": "Billing"
30+
}
31+
},
32+
"interactiveOption": {
33+
"shape": "Scalar",
34+
"value": {
35+
"originalValue": "Choose a department",
36+
"resolvedValues": [
37+
"Choose a department"
38+
],
39+
"interpretedValue": "Choose a department"
40+
}
41+
}
42+
},
43+
"confirmationState": "None",
44+
"name": "InteractiveMessageIntent",
45+
"state": "InProgress"
46+
},
47+
"nluConfidence": 1
48+
},
49+
{
50+
"intent": {
51+
"slots": {},
52+
"confirmationState": "None",
53+
"name": "FallbackIntent",
54+
"state": "InProgress"
55+
}
56+
}
57+
],
58+
"responseContentType": "text/plain; charset=utf-8",
59+
"sessionState": {
60+
"sessionAttributes": {},
61+
"activeContexts": [],
62+
"intent": {
63+
"slots": {
64+
"action": {
65+
"shape": "Scalar",
66+
"value": {
67+
"originalValue": "Check self-service options",
68+
"resolvedValues": [
69+
"Check self-service options"
70+
],
71+
"interpretedValue": "Check self-service options"
72+
}
73+
},
74+
"appointment": null,
75+
"department": {
76+
"shape": "Scalar",
77+
"value": {
78+
"originalValue": "Billing",
79+
"resolvedValues": [
80+
"Billing"
81+
],
82+
"interpretedValue": "Billing"
83+
}
84+
},
85+
"interactiveOption": {
86+
"shape": "Scalar",
87+
"value": {
88+
"originalValue": "Choose a department",
89+
"resolvedValues": [
90+
"Choose a department"
91+
],
92+
"interpretedValue": "Choose a department"
93+
}
94+
}
95+
},
96+
"confirmationState": "None",
97+
"name": "InteractiveMessageIntent",
98+
"state": "InProgress"
99+
},
100+
"originatingRequestId": "abc2cbc8-4e60-4649-83c7-c317d4d21824"
101+
},
102+
"invocationSource": "DialogCodeHook",
103+
"messageVersion": "1.0",
104+
"inputMode": "Text",
105+
"bot": {
106+
"aliasName": "TestBotAlias",
107+
"aliasId": "TSTALIASID",
108+
"name": "interactive-messaging-lexv2",
109+
"version": "DRAFT",
110+
"localeId": "en_US",
111+
"id": "VGKIKY0S9G"
112+
}
113+
}

0 commit comments

Comments
 (0)