Hi,
I am trying to test using a chat bot (running on BGS server) to send a simple quick-reply rich message back to the client web chat widget. The documentation (
Documentation:GWC:Deployment:GWCRM:Current - Genesys Documentation) gives the following example JSON code:
{
"type": "Message",
"contentType": "quick-replies",
"messageType": "text",
"text": "Will 3:00PM tomorrow work for you?",
"content": [
{"id": "1", "type": "quick-reply", "action": "message","text": "Sounds Good."},
{"id": "2", "type": "quick-reply", "action": "message","text": "No, sorry."},
{"id": "3", "type": "quick-reply", "action": "message","text": "What else?"}
]
}
I am using the following method to send the message back to the web page widget chat:
sendMessage(ChatMessage message, Enums.Visibility visibility, String receiverId)
I have tried to add this code to my onSessionActivity() method. I see the message in my web chat widget "Will 3:00PM tomorrow work for you?", but I don't see anything after that. My code is as follows:
public void onSessionActivity(ChatEventInfo eventInfo) {
cbpInstance.sendMessage("Hello");
String contentBody = null;
contentBody = "{\"type\": \"Message\"," +
"\"content\": [" +
"{\"id\": 1, \"type\": \"quick-reply\", \"action\": \"message\",\"text\": \"Sounds Good.\"}," +
"{\"id\": 2, \"type\": \"quick-reply\", \"action\": \"message\",\"text\": \"No, sorry.\"}," +
"{\"id\": 3, \"type\": \"quick-reply\", \"action\": \"message\",\"text\": \"What else?\"}]}";
PlatformExtension platformExtension = cbpInstance.getPlatformExtension();
ChatMessage newStructuredMessage = null;
newStructuredMessage = platformExtension.createStructuredMessage("Will 3:00PM tomorrow work for you?");
newStructuredMessage.setMessageType("Message");
newStructuredMessage.addStructuredEntry("facebook-messenger", contentBody, "quick-replies", null);
theLogger.info("About to send structured message");
cbpInstance.sendMessage(newStructuredMessage, Enums.Visibility.ALL, null);
}
Checking the logs, I see the debug message "About to send structured message", but no error after that. (I've copied this part of the log below).
I'm not sure if I've structured the 'contentBody' variable correctly with the sample JSON data. Also, the documentation mentions to use "facebook-messenger" for the mediaOrigin value. I've added this, as well as put this in my web page widget configuration, eg:
webchat: {
dataURL: "http://<my-servers-ip>/gms_port_8010/genesys/2/chat/customer-support",
apikey: "",
userData: {
ChatBotID: "RichMessagingBot",
ChatBotName: "RichMessagingBot",
ChatBotHoldup: "true",
StopBotOnAgentArrival: "true",
StopBotOnCustomerLeft : "true",
Visibility : "ALL",
Nickname : "RichMessagingBot",
MediaOrigin : "facebook-messenger"
},
autoInvite: {
enabled: false,
timeToInviteSeconds: 5,
inviteTimeoutSeconds: 30
},
uploadsEnabled: true
}
Any help or advice would be greatly appreciated.
Thank you.
DMS/BGS Log File:
2019-02-07T15:29:01.677 Std 45301 (CBP.sess-bot).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) INFO [BotLogger] - About to send structured message
2019-02-07T15:29:01.677 Trc 45311 (CBP.sess-int).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) DEBUG [BasicChatClient] - Processing chat event: Chat Event with type=MESSAGE, eventId=10, seconds_from_start=7, userId=00CF5C5C4EB900A9, visibility=ALL, message_text='' [truncated from size (bytes) = 34], msgCheck=NONE, receiverId=null
2019-02-07T15:29:29.411 Trc 45311 (CBP.sess-int).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) DEBUG [BasicChatClient] - Processing chat event: Chat Event with type=NOTICE, eventId=11, seconds_from_start=35, userId=00CF5C5C4EB800A6, visibility=ALL, message_text=null, msgCheck=NONE, noticeText=null, noticeType=TYPING_STARTED, receiverId=null, userData=<output is suppressed>
2019-02-07T15:29:30.129 Trc 45311 (CBP.sess-int).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) DEBUG [BasicChatClient] - Processing chat event: Chat Event with type=MESSAGE, eventId=12, seconds_from_start=36, userId=00CF5C5C4EB800A6, visibility=ALL, message_text='' [truncated from size (bytes) = 3], msgCheck=NONE, receiverId=null
2019-02-07T15:29:30.333 Trc 45311 (CBP.sess-int).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) DEBUG [BasicChatClient] - Processing chat event: Chat Event with type=MESSAGE, eventId=13, seconds_from_start=36, userId=00CF5C5C4EB900A9, visibility=ALL, message_text='' [truncated from size (bytes) = 34], msgCheck=NONE, receiverId=null
2019-02-07T15:29:30.333 Std 45301 (CBP.sess-bot).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) INFO [BotLogger] - About to send structured message
2019-02-07T15:29:30.348 Trc 45311 (CBP.sess-int).(RichMessagingBot-RichMessagingBot.00430aE515KD003D.09AGSK2VBH7BE000) DEBUG [BasicChatClient] - Processing chat event: Chat Event with type=MESSAGE, eventId=14, seconds_from_start=36, userId=00CF5C5C4EB900A9, visibility=ALL, message_text='' [truncated from size (bytes) = 34], msgCheck=NONE, receiverId=null
#DigitalChannels#Unsure/Other------------------------------
Pratik Mehta
------------------------------