I have a bot in Dialogflow CX with Voximplant. I want to play a typing sound while my customer is waiting for response. How do I do it?
Asked
Active
Viewed 49 times
1 Answers
0
To do this:
require(Modules.Player);
let typing = false;
var typingPlayer = VoxEngine.createURLPlayer(
"https://staging.crmsuite.com/media/typing.trimmed.mp3",
{ loop: true, progressivePlayback: true }
);
conversationParticipant.addEventListener(
CCAI.Events.Participant.Response,
function (e) {
var res = e.response || {};
if (
!typing &&
res.recognitionResult?.messageType === "TRANSCRIPT" &&
res.recognitionResult?.isFinal
) {
typingPlayer.sendMediaTo(call);
typing = true;
}
if (res.automatedAgentReply?.responseMessages) {
res.automatedAgentReply.responseMessages.forEach((response) => {
if (response.liveAgentHandoff) transfer = true;
if (response.endInteraction && res.replyText) hangup = true;
else if (response.endInteraction) endConversation();
});
}
}
);
conversationParticipant.addEventListener(
CCAI.Events.Participant.PlaybackReady,
(e) => {
if (typing) {
conversationParticipant.sendMediaTo(call);
typing = false;
}
}
);

Harsh Mangalam
- 1,116
- 1
- 10
- 19

Ksenia Cherkasova
- 101
- 5