The mirror api's menu items are only displaying 1 of two open URI intents.
Is there a way to get the behavior so that a user can own have two different URI_OPEN payloads on the same card?
I have it properly configured from this referenced question, but it only shows the first available OPEN_URI.
Menu Item for "OPEN_URI" not present in menuItems return
If 'fooApp' shows up first, it is the only one available but if 'barApp' appears first it is shown.
Returns
(Foo App, Reply, Delete)
OR
(Bar App, Reply, Delete)
but not Foo App, Bar App, Reply, Delete (desired)
"menuItems": [
{
"action": "OPEN_URI",
"id": "1",
"payload": "fooApp://",
"values": [{
"displayName": "Foo App",
"iconUrl":"http://www.image.com/x.png"
}]
},
{
"action": "OPEN_URI",
"id": "2",
"payload": "barApp://",
"values": [{
"displayName": "Bar App",
"iconUrl":"http://www.image.com/x.png"
}]
},
{"action": "REPLY"},
{"action": "DELETE"},
],
Both of your menu items seem to have the same id. Try using a different id value for each one.
I had a similar problem but enduring that the menu value had at least a DEFAULT state worked for me. This was mentioned by John Fontaine in his comments.
Related
I have created a chatbot in DialogFlow CX. After a customer identifies themselves, a call is made to the webhook (written in Python) which finds the 3 closest retail stores to the customer, and returns those in the webhook response as parameters:
bot_response = {
"fulfillment_response":
{
"messages": [
{
"text": {
"text": [
f'Thanks {first_name}! I\'ve located your account.'
]
}
}
]
},
"session_info": {
"session": session_name,
"parameters": {
"first_name": first_name,
"email_address": email_address,
"business_partner_id": business_partner_id,
"address_line_1": c['response']['address_line_1'],
"address_line_2": c['response']['address_line_2'],
"suburb": c['response']['suburb'],
"postcode": c['response']['postcode'],
"region": c['response']['state'],
"store_1": locations[0].store_name,
"store_1_id": locations[0].store_id,
"store_1_address": locations[0].address,
"store_2": locations[1].store_name,
"store_2_id": locations[1].store_id,
"store_2_address": locations[1].address,
"store_3": locations[2].store_name,
"store_3_id": locations[2].store_id,
"store_3_address": locations[2].address
}
}
}
My intention is to allow the customer to select 1 of these 3 store locations. In the above model, I've returned them as parameters, which are successfully recorded in dialogflow, however I am stuck on how to provide these values as a list of options to the customer. I am unsure whether I can
a) Provide a list of options back to the user as a Webhook Response (instead of parameters). All documentation I can find suggests only that text and parameters can be returned.
Or
b) Use the returned parameters to create a custom payload to present them as a list for the user to select from. Something like:
{
"richContent": [
[
{
"event": {
"name": "Store1",
"parameters": {},
"languageCode": ""
},
"subtitle": "${store_1_id}",
"title": "${store_1_address}",
"type": "list"
}
]
]
}
But I cannot find any documentation to suggest you can embed parameters into custom payloads.
Does anyone know of a way to solve this situation? Thank you!
As per usual, the mere act of posting a question on Stack Overflow somehow creates a higher statistical likelihood that I will in fact answer my own question. It's simple enough to add it to a custom payload to present in a list, simply using the syntax:
{
"richContent": [
[
{
"event": {
"name": "Store1",
"parameters": {},
"languageCode": ""
},
"subtitle": "$session.params.store_1_address",
"title": "Store 1",
"type": "list"
}
]
]
}
I try to implement delete method for Record delate-record, but its my first time to use python and this api.
The GoDaddy API doesn't have a delete record method, so this functionality is not exposed in the driver.
https://developer.godaddy.com/doc#!/_v1_domains/recordReplace
The driver could offer the 'replace records in zone' method, which would allow you to fetch the current list of records, and then set the new list minus the record you want to remove. But that feature is not implemented and quite risky.
First,
Send a GET request to https://api.godaddy.com/v1/domains/{DOMAIN}/records
Then, Enumerate over all records of API Response (JSON Array) and prepare new data by removing the one that needs to be deleted.
API Response (SAMPLE)
[
{
"data": "192.168.1.1",
"name": "#",
"ttl": 600,
"type": "A"
},
{
"data": "ns1.example.com",
"name": "#",
"ttl": 3600,
"type": "NS"
},
{
"data": "#",
"name": "www",
"ttl": 3600,
"type": "CNAME"
},
{
"data": "mail.example.com",
"name": "#",
"ttl": 3600,
"priority": 1,
"type": "MX"
}
]
New Data (After deleting record) (SAMPLE)
[
{
"data": "192.168.1.1",
"name": "#",
"ttl": 600,
"type": "A"
},
{
"data": "ns1.example.com",
"name": "#",
"ttl": 3600,
"type": "NS"
},
{
"data": "#",
"name": "www",
"ttl": 3600,
"type": "CNAME"
}
]
Now,
Send a PUT request to https://api.godaddy.com/v1/domains/{DOMAIN}/records with new data.
The most important thing is how you identify the records in above array which needs to be deleted. This would not be a difficult task, assuming you have good programming skills.
I managed to worked around it in kind of a hacky - we had bunch of records we wanted to delete, doing it manually seemed weird so I added a Javascript into the Chrome Developer Console, running on an authenticated session from the DNS manage page:
function deleteGoDaddyRecords(recordId) {
$.ajax({
url: 'https://dcc.godaddy.com/api/v3/domains/<YOUR-DOMAIN.com>/records?recordId='+recordId,
type: 'DELETE',
success: function(result) {
console.log(result)
}
});
}
which let me use the same call the UI is calling when you ask to delete a record.
the only thing you need to provide is the AttributeUid which is not available with the public API, but it is in the front-end API:
https://dcc.godaddy.com/api/v2/domains/runahr.com/records
So I managed to create a script that will generate bunch of
deleteGoDaddyRecords('<RECORD-UUID>');
deleteGoDaddyRecords('<RECORD-UUID>');
copy & paste the generated script into the Developers Console and that solved it for now.
I hope GoDaddy will add a public DELETE endpoint to their API in the future :)
I have a form which I am using to edit details via form. Ember does a PUT request like required but I need it to only send particular values and not everything within the JSON object. The object is structured as:
{
consoles: {
"id": "1",
"name": "Street Fighter",
"type":"Beat-em-up"
"versions": "10",
"consoles": [
{
"id": "1",
"name": "Microsoft",
"console": "Xbox 360"
},{
"id": "2",
"name": "Microsoft",
"console": "Xbox One"
},{
"id": "3",
"name": "Sony",
"console": "Playstation 4"
}
],
"Characters":[],
"Reviews":[]
}
}
The only editable values within my form are:
name
type
versions
When I press the update button, everything is sent in a PUT request. Is it possible for ONLY name, type and versions to be sent in the request?
I'm aware of overriding updateRecord but I wouldn't know where to start if this was what I needed to do.
You can write your own Serializer to only send specific attributes up to the server.
See the docs here
I am trying to retrieve all comments of a certain user (not on a specific post but in a general way) using the Graph API.
I have come to understand that I need to query a user's posts and that the result will also contain that user's comments.
I manage to retrieve the list of posts for a specific user and I do see the comments the user posted.
However, the message property is always missing:
{
"id": "100005227004296_112167712300795",
"from": {
"name": "Karen Amebbgkdbif Lausen",
"id": "100005227004296"
},
"story": "\"Karens erster Kommentar zu...\" on Mike Amebkhdchid Letuchysky's photo.",
"story_tags": {
"35": [
{
"id": "100005200843894",
"name": "Mike Amebkhdchid Letuchysky",
"offset": 35,
"length": 27,
"type": "user"
}
]
},
"privacy": {
"value": ""
},
"type": "status",
"application": {
"name": "Photos",
"id": "2305272732"
},
"created_time": "2013-02-17T20:59:52+0000",
"updated_time": "2013-02-17T20:59:52+0000",
"comments": {
"count": 0
}
}
The story property contains a part of the message, but not all of it.
How can I access the full comment (text)?
Thanks in advance!
Alex
You may need to pull back additional properties such as type, status_type and description. If you like a link or comment on something else where and that appears in your timeline it can be returned from the post feed.
Try these fields in the graph API explorer to see what data is returned:
id,created_time,from,message,type,description,story,status_type
i am trying to retrieve a facebook POSTs information (ie: LIKE count) using the facebook API
The URL which used to work was in this format:
https://graph.facebook.com/?ids=[AUTHOR_ID]_[POST_ID]
(author and post ID omitted on purpose)
Now it returns a false data feed. Has the URL structure to retrieve POST information changed?
With October 2013 Breaking Changes, likes.count field is no longer available in the feed.
You need to make a call for each POST_ID with the summary field enabled.
https://graph.facebook.com/POST_ID/likes?summary=true&access_token=XXXXXXXXXXXX
There will be a "summary" element with a "total_count" field.
Nope, that still works for me - just tested with one of my posts:
"id": "<SNIP>",
//removed most fields
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/X/posts/Y"
},
{
"name": "Like",
"link": "https://www.facebook.com/X/posts/Y"
}
],
"type": "photo",
"status_type": "added_photos",
"object_id": "SNIP",
"application": {
"name": "Facebook for Android",
"namespace": "fbandroid",
"id": "350685531728"
},
"created_time": "2012-10-12T06:52:10+0000",
"updated_time": "2012-10-12T07:48:34+0000",
"likes": {
"data": [
// four likers' details
],
"count": 28
},
//snip
Check you still have read_stream Permission from your user, that the post hasn't been deleted, etc