Is there a way to get dialpad input through dialogflow telephony - node.js

I had written a node js server code so that dialog-flow can connect to my server through web-hook and integrated dialog-flow phone gateway. I am able to get the voice transcript text when made call to that number. But if i type any number on dial-pad i am not getting it. Is there any thing i should do to get the number input from dial-pad on call.
The response is something like this if i say 'hello' on call.
{
"responseId":"b5644842-75bf-41f3-bf84-cf7b4f02c71f",
"queryResult": :{
"queryText":"Hello.","action":
"input.welcome",
"parameters":{},
"allRequiredParamsPresent":true,
"intent":{
"name":"projects/maps-ec9e1/agent/intents/54f5f623-2011-4d95-92a7-b8e873cd55a7",
"displayName":"Default Welcome Intent"
},
"intentDetectionConfidence":1,
"languageCode":"en-us"
},
"originalDetectIntentRequest":{
"source":"GOOGLE_TELEPHONY",
"payload":{
"telephony":{
"caller_id":"REDACTED_IN_STANDARD_TIER_AGENT"
}
}
},
"session":"projects/maps-ec9e1/agent/sessions/l0vQqOpaSsq9rvJc0sMMYA"
}
}

You are looking for DTMF detection. Google's Dialogflow Phone Gateway does not support this, but you can get this capability from some third party Dialogflow Gateway products like Voximplant, Audiocodes' VoiceAI Gateway, and drachtio.org.
There is no standard method for how to do this, but generally the telephony gateway needs to detect a digit and then sends a text query or event to Dialogflow where your bot can handle it.
I wrote reviews at cogint.ai with details on how to do this for Voximplant and Audiocodes.

Related

Google Dialogflow Quick Replies formatting issues in Telegram

I had create a chatbot using Dialogflow and integrated it with Facebook Messenger & Telegram. I noticed that for the Quick Replies in Telegram (Link 1) appears differently in FB Messenger (Link 2). Is there any way to make it nicer and more presentable in Telegram?
Telegram
Facebook Messenger
This is my Quick Replies settings in Dialogflow.
Dialogflow
in DialogFlow you can indeed (as Marc pointed out) use a Custom Payload for Telegram, here it is an example:
{
"telegram": {
"text": "What would you like help with?",
"reply_markup": {
"inline_keyboard": [
[
{
"text": "Daily News",
"callback_data": "news"
}
],
[
{
"text": "New Features",
"callback_data": "features"
}
]
]
}
}
}
The quick replies appear a buttons you can click (notice the actual response is sent but not displayed within the chat).
All the best!
Beppe
SHORT ANSWER:
That is NOT possible.
DETAILED ANSWER:
Each Channel (Facebook Messenger, Telegram etc.) has its own UI components and its own styling. Those can't be changed as they are rendered/controlled by the channel it self.
What Dialogflow doing is giving you the ability to show these UI components in each channel without making you handle the different implementation needed for each channel.
Dialogflow also gives you the ability to send Custom Payloads where you can send a custom JSON (that should be compatible with the channel you are connected to) That can be used if the channel for example has a UI component that is not yet supported by Dialogflow.
If the channel gives you an option to change a property in the UI components you are using, you could do that using Custom JSON, But still you are always limited to how each channel renders the UI components and what features they provide us

I want to send platform specific responses using dialogflow fullfilment

I built a bot that is integrated to messenger and default bot on website using dialogflow now the bot have default response and messenger response but when I go to the fullfilment i cant set a specific response for each
here is my code
function time(agent) {
if (currentlyOpen()) {
agent.add(`Hi, We're open now! We close at 11pm today.`);
} else {
agent.add(`We're currently closed, but we open every day at 6am!`);
}
}
I want to have a diffrent response if I am using messenger as the default response goes to the default bot
"I know I can inrtegrate messenger in the website but I want to know this way as I use it for more bots"
You can do that using the same library that you are using for agent. To send specific platform response just add the platform to the response. For example, if you want send a text specifically to Google Assistant then you can do that using agent.add(new Text({ text: 'text_here', platform: 'ACTIONS_ON_GOOGLE'}));.
The full Dialogflow fulfillment code is available on GitHub. https://github.com/dialogflow/dialogflow-fulfillment-nodejs. I have also modified some code to set some other responses that are not available in this library such as telephony transfer and speech responses. So, if you want you can do that too.

Dialogflow Web Integration not showing Quick Replies and Multiple Replies

I've created a chatbot using Dialogflow and integrated it with Telegram, Facebook Messenger and Web.
The response for Dialogflow is created via Fulfillment written in Python.
In Telegram and Facebook Messenger I am getting replies as expected for each message from user.
But now when I am trying integration for Web, I've noticed that the replies from chatbot does not show multiple reply messages/lines and Quick Replies.
Below is screenshot when user say 'Hi' to the chat bot in Telegram, Facebook Messenger, Web and Dialogflow console respectively. Why is this happening and how can I fix this?
Below is the Fulfillment response JSON:
{
"fulfillmentMessages": [
{
"text": {
"text": [
"Greetings from Tulsi Village!!!",
"My name is Appu. I am your virtual assistant.",
"How can I help you?"
]
}
},
{
"quickReplies": {
"quickReplies": [
"Book",
"Rooms",
"Contact",
"Other"
]
}
}
]
}
The rendering of response depends on the client you are using.
Telegram, Facebook Messenger, are able to render the quick-replies and multi-line replies.
But the web-demo which you are using does not support these, hence you are not able to see quick-replies and multi-line replies.
If you want to integrate it with a website, you need to design it in such a way that it can render the json response and show it correctly. Web-demo is not designed to render these.

DIalogflow Telephony integration is interpreting SSML response from webhook as normal text

I am using dialogflow-fulfillment nodejs library to send response(eg: agent.add("<speak>hello</speak>")) back to the dialogflow agent. It works fine with dialogflow agent and google simulator. However, when I use the same response with telephony integration. It does not recognize it as "ssml" and speak it as "greater than speak less than....hello less than slash ..greater than>. Also. I checked SDK supported platforms and it looks like version 0.6.1 does not support telephony Platform yet.
You are correct that the client API doesn't include methods for the telephony gateway, so you'll need to craft the JSON response yourself. This is an example of what you can put for "fulfillmentMessages":
fulfillmentMessages: [
{
platform: 'TELEPHONY',
telephonySynthesizeSpeech: {
ssml: `<speak>YOUR MESSAGE GOES HERE</speak>`
}
}
]
Here's the link to the relevant API v2 beta 1 documentation (scroll down to TelephonySynthesizeSpeech): https://cloud.google.com/dialogflow-enterprise/docs/reference/rpc/google.cloud.dialogflow.v2beta1#telephonysynthesizespeech

In a chatbot conversation using dialogflow, Is there a way to make the bot speak first?

Is it possible to format a conversation so that the bot initiates conversation using dialogflow in a web demo integration?
The objective is to say something like “Hi, I’m a bot, I can do x” to establish that it’s a chatbot rather than a human.
Can anyone suggest any idea for this?
You can set a welcome intent, then send a /query request containing an event parameter. Set the event parameter to WELCOME and your chatbot will respond with whatever conversation opening you set.
More info here: https://dialogflow.com/docs/events
If you are using something other than the API for interacting with your Dialogflow agent (Slack, Facebook Messenger, etc.) you will need to add an appropriate event under "intents" in your console (such as the "Facebook Welcome" event).
For interacting with your Dialogflow agent via the API, see below.
In the API interaction quickstart documentation, Dialogflow gives you the SessionClient's detectIntent method for sharing messages with your bot.
Each language has a different solution. But on an abstract level, you want to change the request object that you send to Dialogflow to include a "Welcome" event (no input message required), as Omegastick described.
For example, in Node.js, your request object would look like this:
// The text query request.
const request = {
session: sessionPath,
queryInput: {
event: {
name: "Welcome",
languageCode: languageCode
}
},
};
This assumes you have an appropriate intent set up in your Dialogflow console to handle Welcome events. One is provided by default that you can observe.
You can also add contexts, so that your agent gives a different greeting message based on some condition.

Resources