VoxImplant with DialogFlow CX Telephony Integration with Background MUSIC Tone - dialogflow-cx

I have been working to integrate DialogFlow CX with VoxImplant Telephony Integration and It works great.
But we experience latency in the conversation response from DialogFlow CX. As we are using DialogFlow CX webhooks which connects to multiple services there always exists some latency. To solve this we decided to play some progress/music tone in the call so that the user knows that something is going on in the backend.
As per the documentation here, https://voximplant.com/docs/references/voxengine/call#startplayback
I tried few options like sendMedia but it disconnected the original call
Would like to know how to play some progress tone/music inbetween the duration of request/response between VoxImplant<=>DialogFlow CX

After multiple conversation with VoxImplant Support team, i was able to finally configure to play background music.
Here the snippet to be used.
conversationParticipant.addEventListener(CCAI.Events.Participant.Response, (e) => {
if (e.response.recognitionResult?.messageType === "TRANSCRIPT" && e.response.recognitionResult?.isFinal) {
call.startPlayback(audio_bg_url);
}
if (e.response.automatedAgentReply) {
conversationParticipant.sendMediaTo(call);
}else{
}
});

Related

Dialogflow CX response after conversation is idile

I would like to know if there is a way using DialogFlow CX to get the chatbot to send a follow up message after a certain x period of time when a customer doesn't respond.
ie: Customer reaches out, chatbot responses, after 2 minutes, the chatbot will send a message like are you still there? message or something like that.
Thanks!
I dont know how to set this up if its possible.
In many ways, it depends on exactly what integration you're using and what that integration supports. While there is some support for this in Dialogflow CX, it probably isn't as automatic as you want.
If you're building using one of the telephony integrations, there are some agent settings that let you set the "No speech timeout" period. At the end of this period (5 seconds by default), if the caller hasn't said anything, then a no-input event will be triggered and you can use this to repeat the message, prompt if they're still there, or take other actions that may be contextually appropriate.
If you are using a text agent, there isn't any such timeout built in. However, if you can keep track of this on the client side (ie - in whatever is sending the messages to Dialogflow), then you can determine if there has been no input for the predetermined amount of time and send an event to Dialogflow that will trigger the reprompt.
For example, if you're using Dialogflow Messenger, you could setup a JavaScript event that sets a timeout when it gets a response from Dialogflow and clears it when the user sends a request. If it ever times out, it could bring up a message re-prompting the user.

How to capture user_country/city in botframework web channel?

I would like to capture end-user location (country/city) in Application insights form azure botframework chatbot running on web chat channel. App insights instrumentation is already in place page view and custom events being collected, but it seems that the client_City and client_CountryOrRegion are not populated correctly. Is there a specific channel or webservice configuration?
Geolocation data can be accessed using the below method. This will provide you with the longitude and latitude providing the user grants access to this data.
You will then need another process or library to convert the location data to a physical location in the real world.
navigator.geolocation.getCurrentPosition( async (position) => {
const { latitude, longitude } = position.coords;
console.log(latitude, longitude)
})
There are some NPM packages that can do some of this for you, as well.
If you look at my posted answer here, you can see an example I provided on how to get location data for use in generating and displaying a map as a feature of the bot.
Please note that, in the above answer, the bot is responding to a request to display a map, is sending the activity which is then picked up by Web Chat. Web Chat, upon receiving the request, is then getting the location data and displaying the map.
In your case, you will want to send the data back to the bot for the bot to then do something with. You can refer to Web Chat's b.piggyback-on-outgoing-activities sample on how to do this.
Hope of help!

Can Botframework add a reaction to a user message?

Can bot add a reaction to a user message?
I tried to send an activity like this:
{
"type": "messageReaction",
"reactionsAdded": [{ "type": "like" }],
"replyToId": 1579278444192
}
on this URL - /v3/conversations/{conversationId}/activities/{activityId}
It depends entirely on the channel you are wanting to implement this on. If channel x (Facebook, Slack, etc.) sends "reactions" as part of the activity and the service allows you to scope to it, then it is possible to return bot responses based on those.
The Botbuilder-Samples GitHub 25.message-reaction Javascript sample demonstrates how this is achieved for Teams. The C# version can be referenced here. You would need to adjust the code to look for the appropriate context/activity data points and filter on those to send a response back.
Hope of help!

Can I call a Microsoft BotBuilder like calling a function?

I am trying to build a bot and use it within a chat app. I think Microsoft Bot Builder is the one for me.
I looked into its documentations and tried them in the emulator.
I noticed that in these examples, you send texts to the bot either using
"consoleconnector" or "chatconnector", as the example shows.
server.post('/api/messages', connector.listen());
// Receive messages from the user and respond by echoing each message
back (prefixed with 'You said:')
var bot = new builder.UniversalBot(connector, function (session) {
session.send("You said: %s", session.message.text);
});
I don't want a new endpoint. I want to call the bot like calling a function: give the incoming message from a user and the function returns bot's response.
Is it possible? If yes, please tell me how to do it.
If it is not possible, then only way is to call it as a rest API as shown above.
In this case, do i still need "MICROSOFT_APP_ID" and "MICROSOFT_APP_PASSWORD"?
Note that, I don't want to deploy the bot to azure or aws now. I want to use it local.
Could anyone help me explain these? Thanks in advance!
The Bot Framework is built to function as an API - it takes a request and sends a response. The framework doesn't provide a callback or promise to capture the response so this approach simply wouldn't work. Take a look at the DirectLine API if you want to embed the framework within another application.
You need to use the MS App id and password for all channels apart from the Emulator. If you use DirectLine API, you will also have to pass a secret token.

Proactive messaging in botframework is very slow

I'm trying to send proactive messages using botframework. I have observed that the rate at which botframework is delivering is very slow(3000req/min). Can someone let me know what exactly I should do to make it faster.
All I'm doing is iterating over my users and sending the message using the below code.
var replyActivity = CustomActivityCreator.CreateMessageActivity(message, id);
var result = connector.Conversations.SendToConversationAsync(replyActivity).Result;
Thanks in advance.
PS: My server is hosted in West US.

Resources