I am setting up a Chatbot for my Facebook page with Google Dialogflow handling the conversations.
For a specific Intent, I need to send 2 responses.
A regular statement with User's name put in.
A Persistent menu with 3 buttons
I understand that for a single Intent, I can't send the first response via Fulfillment code and the 2nd response setup through Dialogflow console UI. Hence, I need to write code to send both the responses.
I am able to send the first Response. But couldn't get to send a Rich message content. The DialogFlow documents show snippets of code, but it is unclear how the snippets of code from different pages fit it.
Here is my code (just posting actionHandlers) in an attempt to send a statement and an Audio (https://dialogflow.com/docs/rich-messages#custom_payload)
const actionHandlers = {
'input.welcome': () => {
const speechText = 'Hi ' + userProfile['first_name'] + ', This is Eva, digital assistant of LMES Academy. Since my people are busy working on the content for the next video, I\'d like to help you with your needs 😃';
const responsePayload = {
'speech': speechText,
'outputContexts': [{
'user-name': userProfile.first_name
}],
"data": {
"facebook": {
"attachment": {
"type": "audio",
"payload": {
"url": "http://incompetech.com/music/royalty-free/mp3-royaltyfree/Funk%20Game%20Loop.mp3"
}
}
}
}
};
sendResponse(responsePayload);
},
// The default fallback intent has been matched, try to recover (https://dialogflow.com/docs/intents#fallback_intents)
'input.unknown': () => {
sendResponse('I\'m having trouble, can you try that again?'); // Send simple response to user
}
};
The text response is working but the Audio is not. Am I doing the right way? Any help appreciated.
Update 1: Audio is working, after changing the mp3 link. But text response is not working.
Log of the object that is sent to response.json() in my Cloud function.
{
"speech": "Hi Saiyasodharan, This is Eva, digital assistant of LMES Academy. Since my people are busy working on the content for the next video, I'd like to help you with your needs 😃",
"displayText": "Hi Saiyasodharan, This is Eva, digital assistant of LMES Academy. Since my people are busy working on the content for the next video, I'd like to help you with your needs 😃",
"data": {
"facebook": {
"attachment": {
"type": "audio",
"payload": {
"url": "http://66.90.93.122/ost/death-note-original-soundtrack/bowkqzxs/01%20Death%20note.mp3"
}
}
}
},
"contextOut": [{
"user-name": "Saiyasodharan"
}]
}
In above code, I expect
displayText to be displayed immediately -> which is not working
audio response to happen -> This is now working, after changing the mp3 link
I believe I need to give the text response, audio response via data property. Let me try and update here.
If you use a payload for a given integration, the text of the response will be ignored. You'll need to add your message with the attribute text to the facebook payload for it to be surfaced in Facebook messenger. For example:
{
"contextOut": [
{
"user-name": "Saiyasodharan"
}
],
"data": {
"facebook": {
"attachment": {
"payload": {
"url": "http://66.90.93.122/ost/death-note-original-soundtrack/bowkqzxs/01%20Death%20note.mp3"
},
"type": "audio"
},
"text": "Hi Saiyasodharan, This is Eva, digital assistant of LMES Academy. Since my people are busy working on the content for the next video, I'd like to help you with your needs 😃"
}
},
"displayText": "Hi Saiyasodharan, This is Eva, digital assistant of LMES Academy. Since my people are busy working on the content for the next video, I'd like to help you with your needs 😃",
"speech": "Hi Saiyasodharan, This is Eva, digital assistant of LMES Academy. Since my people are busy working on the content for the next video, I'd like to help you with your needs 😃"
}
Related
Question: how to remove an application logo.
Solution: previous solution from this answer, https://stackoverflow.com/a/57168008/1992004, is no longer working.
Google changed the format of "iconUrl" to "icon", and uses now the Base64-encoded data stream, like "icon":"iVBORw0KGgoAAAAN..., instead of the image URL, previously written as "iconUrl":"https://...".
I've tried "icon":"" and many Base64-encoded values like "icon":"IA", "icon":"Lw", and some of other - no success. I get console messages like
for "icon":""
{
"error": {
"code": 400,
"message": "The request failed because one of the field of the resource is invalid.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.PreconditionFailure",
"violations": [
{
"type": "client_auth_config",
"subject": "?error_code=9&error_field_name=UpdateIconRequest.icon&error_field_value=%3CByteString#3eeee81e+size%3D0+contents%3D%22%22%3E"
}
]
}
]
}
}
or
{
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.identity.clientauthconfig.v1.ClientAuthConfigError",
"code": "ICON_STORAGE_FAILURE"
},
{
"#type": "type.googleapis.com/google.identity.clientauthconfig.v1.IconStorageError",
"reason": "INVALID_IMAGE"
}
]
}
}
or
{
"error": {
"code": 400,
"message": "Invalid value at 'icon' (TYPE_BYTES), Base64 decoding failed for \" \"",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.BadRequest",
"fieldViolations": [
{
"field": "icon",
"description": "Invalid value at 'icon' (TYPE_BYTES), Base64 decoding failed for \" \""
}
]
}
]
}
}
Does somebody know, what should be inserted here to remove the logo image from the app?
Answer:
Unfortunately, there is no way for this to be done.
More Information:
Once an OAuth Application Logo has been uploaded there isn't a supported way of removing it - in the question that you linked the way that this was done is a bit hacky, inspecting the network requests and building a new request from the previous JSON object sent via the UI really shows this.
As the icon URL has changed to need a Base-64 encoded value this has been deprecated. Whether this was intentional by Google or not is hard to say, but now an empty value will always return INVALID_ARGUMENT. Any data in the value for icon will also just replace the image data and so this isn't a viable workaround, as as far as the validation process goes, image data exists and so will need to be verified.
If it's not too much of a arduous process, the only workaround here is to create a new GCP project with a new OAuth consent screen without uploading an image. Of course, you will need to reactivate all the relevant APIs and link the relevant scripts and projects to the new set-up.
Feature Request:
You can however let Google know that this is a feature that is important and that you would like to request they implement it. Google's Issue Tracker is a place for developers to report issues and make feature requests for their development services. I would suggest using the feature request template for G Suite Add-ons as this is a component for which GCP Projects could be used.
Update: The feature request for this is viewable here, to increase visibility on this, hit the ☆ at the top of the page.
Relevant Questions:
OAuth consent screen - ability to remove application logo [Obsolete]
May 2021 - It is still possible to completely delete the consent screen (and thus allowing to create it again). See my updated answer in https://stackoverflow.com/a/57168008/1992004
I'm having problems writing a custom payload on DialogFlow to get a Kik bot to send video's. I wrote my own custom payload, but will not send no matter where the videourl is coming from. Here's what I already have:
{
"kik": {
"type": "video",
"videoUrl": "https://6oifeq.bn.files.1drv.com/y4m2tTfznJjwSNUR5OknxluI1LUdv5-EFVdpSNDNouEaEEA6ftWVOBoJ20jsrln7xXb0BrUZ_PC2EuUSCVq1l4P2h1z3TbZLD2vqvCmNY0ebgwUTVRrvF5qyvQ6eUJbvIgPlTtQW6rHcIDDl4IU5lqCw62kBfFv2R4j7zYgV6fz-aev4jXqgivj6QR5MrcelkeZ/5fcf21c1-b250-4366-9810-3f98c716026a.mp4?psid=1?",
"video-should-be-muted":false
}
}
Using Dialog Flow to send Videos on Kik with a custom payload.
The custom payload on Dialog Flow to send videos on Kik is solved. Follow this format:
"kik": {
"type": "video",
"videoUrl": "https://6oifeq.bn.files.1drv.com/y4mPnHGxDM_GoQ4oo9nEBx27nqrnfA3H_uRQPY0m2WI91qoPy75o1Y3RHpV3TXta_CM3mMpWpP20VzEmUS9_ruiEmrU7c8G15oclWBH7BmfZgzPoa38B63pT86RdJOkv8V9FvEIu4wYjGiyzE0IZT4nWhlIL9bE4T2wgDzBf7U5haulPNTBBH8DkLY7_MzkL0iu/5fcf21c1-b250-4366-9810-3f98c716026a.mp4?psid=1?",
"autoplay": true
}
}
I'm using cryptocurrency mining website NanoPool.org
I should check the Data of this site for example Hashrate, workers and other things like that
I want to know how can I connect this site to my telegram.
Actually I don't know nothing about that, the only thing I aware about is that, the site have API with json but I searched a lot on Google couldn't find accurate training about that.
This is API link of this website.
Would you please help me how can I do that?
Thanks
User Data example code:
{
"account": "4AHBwkKjWT2jHv83V6ahZXUWCYe9JmyNygQJ7ueQUMhHJrJQJrWnYHHUMuaZhCGSnvKTjodddyxqwdz8y2o7aKRV6C1xntS",
"unconfirmed_balance": "0.36812920",
"balance": "5.87838746",
"hashrate": "2767380.0",
"avgHashrate": {
"h1": "2777915.0",
"h3": "2773365.0",
"h6": "2726529.2",
"h12": "2648470.4",
"h24": "2764918.3"
},
"workers": [
{
"id": "is",
"hashrate": "1861860.0",
"lastShare": 1505534231,
"rating": 322640212,
"avg_h1": "1855980.0",
"avg_h3": "1860296.7",
"avg_h6": "1858237.5",
"avg_h12": "1854944.6",
"avg_h24": "1854664.6"
},
{
"id": "china",
"hashrate": "905520.0",
"lastShare": 1505534231,
"rating": 118148712,
"avg_h1": "921935.0",
"avg_h3": "913068.3",
"avg_h6": "868291.7",
"avg_h12": "793525.8",
"avg_h24": "910253.8"
}
]
}
You can implement it with use of python json, telepot and requests libs
1. Receive json file from nanopool api via requests lib
2. Parse it via json lib
3. Create bot via botfather
4. Send it via telepot library as message to yourself from created bot
I have a problem with my chatfuel JSON API from my node JS app.
I try to catch an error and return a message + a redirect_to_block to be able to ask the user again.
My error detection works well and if I try to display a message only it works. My JSON is :
[{"text":"Please type again"}]
But I can't add a redirect_to_blocks to this (and I even loose the text message display).
I tried those solutions (and probably some more) but I think I didn't get the JSON structure :
// Solution 1
[{ "message": { "text": "Please type again" }, "redirect_to_blocks": ["When?"] }]
// Solution 2
[{ "messages": { "text": "Please type again" }, "block_names": ["When?"], "type": "show_block", "title": "go" }]
// Solution 3
[{ "text": "Please type again" }, "redirect_to_blocks": ["When?"] }]
And here is the block I want to add (i'm not even sure the name I have to give to the JSON)
Thanks !
Julian, workaround that works for me is returning from API following JSON:
{
"set_attributes": {
"redirectBlock": <your block name>
}
}
and build structure in Chatfuel as below:
Chatfuel flow
Now you have a dispatcher that allows you to map values from API to block titles.
I had your same issues,
I created a json request in my Flow that returns this json:
{ "redirect_to_blocks": ["Block name"] }
but Chatfuel never redirects to it.
I solved it creating a new block in "Automate" pane with same name and It works.
I know that it's passed much time since your question,
but I hope it can helps future issues.
I use this api: Ask Fast, to communicate with my customers. I use this to call my customers to update them on the status of their order. I need to know if the customer has picked up the phone, or that I have reached their voice mail. In the documentation there is no such a method. Is there a way to know this? In both the scenarios the servers gives a 200 code back.
I make this call:
url: http://api.aks-fast.com/dialoghandler/rpc
{
"method": "outboundCallWithMap",
"params": {
"addressMap": {
"003110xxxxxxx": "me"
},
"url": "my url",
"accountID": "xxxxxxxxxxxxx",
"senderName": "me",
"subject": "test message"
}
}
There is no such method because the carries thinks that in both situations the phone is picked up. A work around would be to create interaction. For example: before giving the information ask the question: "I do not know if you are human can you press a button" if there is not button pressed for 10 seconds you know it is a voice mail. A way of achieving this would be:
Initial question json
{
"question_id":<some_id>,
"question_text":"I do not know if you are human can you press a button",
"type":" closed",
"url":"<referral url>",
"answers":[
{
"answer_id":<some_id>,
"answer_text":"Press one if you are human",
"callback":"The real question url"
}
],
"event_callbacks":[
{
"event":"timeout",
"callback":"i am not a human url or leave empty if you want to hang up"
},
],
"media_properties": [
{
"medium": "BROADSOFT",
"properties":
{
"TIMEOUT": "10s"
}
}
]
}
Here you ask if the customer would like to respond. If this does not happen the phone will be hang up and your url with the right action will be called.
In the TIMEOUT you can specify how long it will take for the timeout method to be called.
Hope this helps.