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

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

Related

Unable to extract log from watson assistant

Please I have struggling with consuming watson assistant log API. currently we use watson assistant log API for fetching daily conversation log between our chatbot and customer and feed the log into NLC for classifying the intents for precision analyst. Recently we observed that IBM has decomission the NLC and advice that we migrate to NLU. since then we've being having issues getting the component running.
right now the assistant log return empty log for this filterĀ 
authenticator = IAMAuthenticator('********')
assistant = AssistantV2(
version='2021-06-14',
authenticator = authenticator
)
assistant.set_service_url('https://api.eu-gb.assistant.watson.cloud.ibm.com')
print("The assistant URL ")
response=assistant.list_logs(
assistant_id='******', page_limit=100, filter='response_timestamp>2022-09-14T00:00:00.000Z',
cursor=cursor).get_result()
response=assistant.list_logs(
assistant_id='*******').get_result()
print(json.dumps(response, indent=2))
#print("the response is ",response)
this is returning an empty data
{
"logs": [],
"pagination": {}
}
Here are some reasons why this may occur.
You are using V2 API which requires an Enterprise account. If you only have Plus then you can use the V1 API. But there is no guarantee it will continue to work as expected in the future.
You don't have any logs for that date range. Check in the Analytics page.
An issue in your code. Try running the sample code on the REST API docs. If this works then compare against your code.
Your filter looks ok, but try this filter (change language and assistant ID):
language::en,request.context.system.assistant_id::<YOUR_ASSISTANT_ID>,response_timestamp>2022-09-14T00:00:00.000Z
Seeing as you have midnight as your time, you can also change that part to:
response_timestamp>2022-09-14

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.

Is there a way to get dialpad input through dialogflow telephony

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.

DialogFlow V2 How set fulfillmentText via node js library?

Following this guide:
https://actions-on-google.github.io/actions-on-google-nodejs/
I created an action for DialogFlow
import { dialogflow, Image, Conversation, BasicCard } from 'actions-on-google';
const app = dialogflow();
app.intent('test', (conv, input) => {
conv.contexts.set('i_see_context_in_web_demo', 1);
conv.ask(`i see this only into actions on google simulator`);
conv.ask(new Image({
url: 'https://developers.google.com/web/fundamentals/accessibility/semantics-builtin/imgs/160204193356-01-cat-500.jpg',
alt: 'cat',
}));
});
I then activated Web Demo integration
I saw that the Web Demo integration does not show the cards, the images. I hypothesize that it only shows text, no rich text
I understand that it elaborates only JSON like this:
{
"fulfillmentText": "Welcome!",
"outputContexts": []
}
But I did not find any method in the library used to enhance fulfillmentText
can you help me?
You're using the actions-on-google library, which is specifically designed to send messages that will be used by the Google Assistant. The Web Demo uses the generic messages that are available for Dialogflow. The actions-on-google library does not send these generic messages.
If you want to be able to create messages that are usable by both, you'll need to look into the dialogflow fulfillment library, which can create messages that are usable by the Google Assistant as well as other platforms. Be aware, however, that not all rich messages are available on all platforms, but that the basic text responses should be.
You also don't need to use a library - you can create the JSON response yourself.

Resources