I am having trouble getting a nested menu within a nested menu. Does anyone know if you can only go on level down? Or can you do two?
I have here a menu that is nested within a nest -- but I keep getting this error:
{"error":{"message":"(#100) Requires one of the params: get_started,persistent_menu,target_audience,whitelisted_domains,greeting,account_linking_url,payment_settings,home_url","type":"OAuthException","code":100,"fbtrace_id":"H1RDxO9wOcL"}}
Here is my code
"persistent_menu":[
> {
> "locale":"default",
> "composer_input_disabled": false,
> "call_to_actions":[
> {
> "title":" Menu",
> "type":"nested",
> "call_to_actions":[
> {
> "title":"About",
> "type":"postback",
> "payload":"ABOUT"
> },
> {
> "title":"Tips",
> "type":"nested",
> call_to_actions":[
> {
> "title":"Hours",
> "type":"postback",
> "payload":"Hours"
> },{
> "title":"Restroom",
> "type":"postback",
> "payload":"Restroom"
> },{
> "title":"Other",
> "type":"postback",
> "payload":"Other"
> },
> ]
> },
> {
> "title":"Leaderboard",
> "type":"postback",
> "payload":"Leaderboard"
> }
> ]
> },
> ]
> }
> ]
> }' "https://graph.facebook.com
POST to Messenger Profile API with your own Page Access Token. You should be page admin to do this.
https://graph.facebook.com/v2.6/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>
with following data
{"persistent_menu":[{"locale":"default","composer_input_disabled":false,"call_to_actions":[{"title":" Menu","type":"nested","call_to_actions":[{"title":"About","type":"postback","payload":"ABOUT"},{"title":"Tips","type":"nested","call_to_actions":[{"title":"Hours","type":"postback","payload":"Hours"},{"title":"Restroom","type":"postback","payload":"Restroom"},{"title":"Other","type":"postback","payload":"Other"}]},{"title":"Leaderboard","type":"postback","payload":"Leaderboard"}]}]}]}
I tested it on my own bot, hope this will work for you as well. Thanks.
https://developers.facebook.com/docs/messenger-platform/reference/messenger-profile-api/persistent-menu
Requirements for Persistent Menu:
Set a get started button.
Have the 'Administrator' role for the page associated with the bot.
If you didn't create any get_started button, you should create one like below curl request. get_started button is a requirement to create a persistent_menu.
curl -X POST -H "Content-Type: application/json" -d '{
"get_started":{
"payload":"START_PAYL"
}
}' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=<API_ACCESS_TOKEN>"
If you already have a get_started button, now you can run below curl request to create persistent_menu:
curl -X POST -H "Content-Type: application/json" -d '{
"persistent_menu":[
{
"locale":"default",
"composer_input_disabled": true,
"call_to_actions":[
{
"title":"My Account",
"type":"nested",
"call_to_actions":[
{
"title":"Pay Bill",
"type":"postback",
"payload":"PAYBILL_PAYLOAD"
},
{
"title":"History",
"type":"postback",
"payload":"HISTORY_PAYLOAD"
},
{
"title":"Contact Info",
"type":"postback",
"payload":"CONTACT_INFO_PAYLOAD"
}
]
},
{
"type":"web_url",
"title":"Latest News",
"url":"http://www.messenger.com/",
"webview_height_ratio":"full"
}
]
},
{
"locale":"zh_CN",
"composer_input_disabled":false,
"call_to_actions":[
{
"title":"Pay Bill",
"type":"postback",
"payload":"PAYBILL_PAYLOAD"
}
]
}
]
}' "https://graph.facebook.com/v2.6/me/messenger_profile?access_token=<API_ACCESS_TOKEN>"
Important Note: An array of top-level menu items for the persistent menu. A maximum of 3 items is allowed. A maximum of two nested menus are supported.
You can quickly resolve this issue and more by using Botsnacks. https://github.com/4handheld/botsnacks .
Everything is automated including the get started payload , menu and more.
Related
how convert this command curl $ curl -u app_id:app_secret -X GET {api}/auth_username to http method to use it in flutter
and the result:
"meta": {
"page": 1,
"limit": 10,
"count": 3
},
"data": [
{
"username": "api_user2"
},
{
"username": "api_user1"
},
{
"username": "test"
}
],
"code": 0
}
please help
thanks
if you are using http package ,
you request url become like this
String credentials = "$app_id:$app_secret";
var bytes = utf8.encode(credentials);
var encodedHead = base64.encode(bytes);
CLient().get(Uri.parse('https://$api/auth_username'),headers :
"Authorization: Basic $encodedHead"
)
Goto your postman
Click on Import Button Text & Paste your curl &
Click Continue
Then Click Code just
below (Send / Save) Button
You will see the Generated Code Snippets
https://api.github.com/repos/{org}/{repo}/issues
What query can allow us to find total count of issues?
Using Rest API, you can use the search api:
GET https://api.github.com/search/issues?q=repo:bertrandmartel/tableau-scraping%20is:issue
https://api.github.com/search/issues?q=repo:bertrandmartel/tableau-scraping%20is:issue
Output
{
"total_count": 8,
....
}
You can also use Github graphql API using the following request :
{
repository(owner: "mui-org", name: "material-ui") {
issues {
totalCount
}
}
}
try this in the explorer
With curl:
curl -H "Authorization: token YOUR_TOKEN" \
-H "Content-Type:application/json" \
-d '{
"query": "{ repository(owner: \"mui-org\", name: \"material-ui\") { issues { totalCount } } }"
}' https://api.github.com/graphql
Sample output:
{
"data": {
"repository": {
"issues": {
"totalCount": 12760
}
}
}
}
Hello I am looking to write a script which uses firebase firestore and writes some json to a specific collection in firestore. I have done this with the realtime db but firestore is a tad different below is my Realtime db snippet that works.
curl -X POST \
-d '{"param1":"'"$1"'", "param2":"'"$2"'"}' \
https://xxxx.firebaseio.com/xxxx.json?
Thanks for the help
After Reading the documentation I got to this
curl -X POST \
-H "Content-Type: application/json" \
-d'{
"fields": {
"Field1": {
"stringValue": "'"$var1"'"
},
"Field2": {
"stringValue": "'"$var2"'"
},
"Field3": {
"stringValue": "$var3"
}
}
}'\"https://firestore.googleapis.com/v1beta1/projects/**PROJECT_ID**/databases/(default)/documents/**COLLECTION_ID**?&key=(YOUR API KEY)"
The accepted answer helped me, but it took me a long time to figure out how can I use data types other than stringValues, so I am adding this answer hoping someone finds this helpful in the future.
curl -X POST \
-H "Content-Type: application/json" \
-d' {
"fields": {
"Field1": {
"arrayValue": {
"values": [{
"mapValue": {
"fields": {
"key1": {
"stringValue": "val1"
},
"key2": {
"stringValue": "val2"
}
}
}
}]
}
},
"Field2": {
"integerValue": <intValue>
},
"Field3": {
"stringValue": "var3"
}
}
}'\"https://firestore.googleapis.com/v1beta1/projects/**PROJECT_ID**/databases/(default)/documents/**COLLECTION_ID**?&key=<YOUR WEB API KEY>"
Use this for reference.
example field value
var data = { "fields": { "productName":{"stringValue": dealname.toString()}, "companyname":{"stringValue": companyName.toString()}, "contact":{"stringValue": contact.toString()}, "email":{"stringValue": email.toString()}, "domain":{"stringValue": domain.toString()}, "createdate":{"stringValue": createdate.toString()}, "salesCode":{"stringValue": code.toString()}, "price":{"stringValue": amount.toString()}, "phone":{"stringValue": phone.toString()}, "orderId":{"stringValue": orderId.toString() } } };
more information firestore information
How can I add an icon to a Facebook Persistent Menu? As the image below. Using this Facebook example, what I need to add to the code for the Git Bash execution?
curl -X POST -H "Content-Type: application/json" -d '{
"persistent_menu":[
{
"locale":"default",
"composer_input_disabled":true,
"call_to_actions":[
{
"title":"My Account",
"type":"nested",
"call_to_actions":[
{
"title":"Pay Bill",
"type":"postback",
"payload":"PAYBILL_PAYLOAD"
}]
}]
},
{
"locale":"zh_CN",
"composer_input_disabled":false
}
]
}' "https://graph.facebook.com/v2.6/me/messenger_profile?
access_token=YOUR_ACCESS_TOKEN_HERE"
Example:
You can use facebook emojies -> for example : ✏ 🏤 ...
And here's a link can help to copy emojies:
https://www.piliapp.com/facebook-symbols/chat/
I mean something like this:
{
"persistent_menu":[
{
"locale":"default",
"composer_input_disabled":false,
"call_to_actions":[
{
"title": "📚 bla",
"type":"nested",
"call_to_actions":[
{
"title":"📚 bla",
"type":"postback",
"payload":"SeeCourses_PAYLOAD"
},
{
"title":"🔖 bla",
"type":"postback",
"payload":"SeeMyCourses_PAYLOAD"
},
{
"title":"🔎 bla",
"type":"postback",
"payload":"SearchForCourses_PAYLOAD"
}
]
},
{
"title":"📆 bla",
"type":"postback",
"payload":"SessionsDateAndTimes_PAYLOAD"
},
{
"title":"⚠ bla",
"type":"postback",
"payload":"InsituteInfo_PAYLOAD"
}
]
},
{
"locale":"ar_AR",
"composer_input_disabled":false,
"call_to_actions":[
{
"type":"postback",
"title":"Change Language",
"payload":"Change Language"
}
]
}
]
}
Do quick replies work in Facebook Messenger Bot Welcome Message? This is the message that is displayed after you press the "Get Started" button.
It might not be supported, but if it is, am I doing something wrong?
Here's what I'm trying:
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"message": {
"attachment": {
"type": "template",
"payload": {
"template_type": "generic",
"elements": [{
"title": "Hi dad",
"subtitle": "Hi mom",
"item_url": "www.google.com",
"image_url": "https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png",
}]
}
}
},
"quick_replies":[
{
"content_type":"text",
"title":"option1",
"payload":"option1payload"
},
{
"content_type":"text",
"title":"option2",
"payload":"option2payload"
}
]
}
]
}' "https://graph.facebook.com/v2.6/13333333337/thread_settings?access_token=THISISMYCOOLTOKEN"
The error I'm receiving is:
Invalid Keys \"message, quick_replies\" were found in param \"call_to_actions[0]\"."type":"OAuthException","code":100
Nope. payload is only for string text. see https://developers.facebook.com/docs/messenger-platform/thread-settings/get-started-button
curl -X POST -H "Content-Type: application/json" -d '{
"setting_type":"call_to_actions",
"thread_state":"new_thread",
"call_to_actions":[
{
"payload":"USER_DEFINED_PAYLOAD"
}
]
}' "https://graph.facebook.com/v2.6/me/thread_settings?access_token=PAGE_ACCESS_TOKEN"
call_to_actions is limited to 1 call_to_actions must contain at least
one payload string.
This data will be sent back to you via webhook.