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"
}
]
}
]
}
Related
We have local instance of Marklogic recently downloaded from docker hub with the following bash command:
docker run --name marklogic-test -d -it -p 8000:8000 -p 8001:8001 -p 8002:8002 \
-e MARKLOGIC_INIT=true \
-e MARKLOGIC_ADMIN_USERNAME=admin \
-e MARKLOGIC_ADMIN_PASSWORD='Areally!PowerfulPassword1337' \
marklogicdb/marklogic-db:10.0-9.4-centos-1.0.0-ea4
The "Documents" database contains only two documents:
sample1.json
{
"v1": "1234",
"v2": "ABCD",
"v3": "0123456789"
}
and sample2.json
{
"v1": "5678",
"v2": "EFGH",
"v3": "9876543210"
}
In case we will run the following XQuery in Query Console:
xquery version "1.0-ml";
let $query := cts:and-query((
cts:directory-query("/", "infinity"),
cts:json-property-value-query("v3", "01*", ("wildcarded", "whitespace-sensitive", "punctuation-sensitive"))
))
return (xdmp:to-json($query), cts:search(/,$query))
The result will be expected... It will return only one document:
{
"andQuery": {
"queries": [
{
"directoryQuery": {
"uris": [
"/"
],
"depth": "infinity"
}
},
{
"jsonPropertyValueQuery": {
"property": [
"v3"
],
"value": [
"01*"
],
"options": [
"punctuation-sensitive",
"whitespace-sensitive",
"wildcarded",
"lang=en"
]
}
}
]
}
}
json as
JSON
{
"v1": "1234",
"v2": "ABCD",
"v3": "0123456789"
}
But if I will do the REST API request:
curl --location --request POST 'http://localhost:18000/LATEST/search?format=json' --user 'admin:Areally!PowerfulPassword1337' --header 'Content-Type: application/json' --data-binary "#test_api.json"
where the test_api.json has the following content:
{
"search": {
"ctsquery": {
"andQuery": {
"queries": [
{
"directoryQuery": {
"uris": [
"/"
],
"depth": "1"
}
},
{
"jsonPropertyValueQuery": {
"property": [
"v3"
],
"value": [
"01*"
],
"options": [
"punctuation-sensitive",
"wildcarded",
"whitespace-sensitive",
"lang=en"
]
}
}
]
}
},
"options": {
"return-plan": false,
"return-metrics": true,
"return-facets": true,
"return-query": false,
"transform-results": {
"apply": "raw"
},
"page-length": 10
}
}
}
The answer is like that:
{
"snippet-format": "snippet",
"total": 2,
"start": 1,
"page-length": 10,
"results": [
{
"index": 1,
"uri": "/sample1.json",
"path": "fn:doc(\"/sample1.json\")",
"score": 0,
"confidence": 0,
"fitness": 0,
"href": "/v1/documents?uri=%2Fsample1.json",
"mimetype": "application/json",
"format": "json",
"matches": [
{
"path": "fn:doc(\"/sample1.json\")/object-node()",
"match-text": [
"1234 ABCD 0123456789"
]
}
]
},
{
"index": 2,
"uri": "/sample2.json",
"path": "fn:doc(\"/sample2.json\")",
"score": 0,
"confidence": 0,
"fitness": 0,
"href": "/v1/documents?uri=%2Fsample2.json",
"mimetype": "application/json",
"format": "json",
"matches": [
{
"path": "fn:doc(\"/sample2.json\")/object-node()",
"match-text": [
"5678 EFGH 9876543210"
]
}
]
}
],
"metrics": {
"query-resolution-time": "PT0.000624S",
"snippet-resolution-time": "PT0.005684S",
"total-time": "PT0.00713S"
}
}
For some reason both documents are returned as result!
Even though "confidence" is 0.
How to understand that behavior of MarkLogic searching engine?
Is it a bug of Marklogic REST API or is there something we are missing?
In Query Console, look at the difference when applying the "filtered" vs. "unfiltered" option to your search.
MarkLogic REST API is an "unfiltered" query.
cts:search() by default is a "filtered" query.
A filtered search (the default). Filtered searches eliminate any false-positive matches and properly resolve cases where there are multiple candidate matches within the same fragment. Filtered search results fully satisfy the specified cts:query.
https://docs.marklogic.com/guide/performance/unfiltered#id_89797
An unfiltered search omits the filtering step, which validates whether each candidate fragment result actually meets the search criteria. Unfiltered searches, therefore, are guaranteed to be fast, while filtered searches are guaranteed to be accurate. By default, searches are filtered; you must specify the "unfiltered" option to cts:search to return an unfiltered search.
I'm trying integrate PayPal V2 Onboarding in sandbox.
My call is :
curl -v -X POST https://api-m.sandbox.paypal.com/v2/customer/partner-referrals \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <My-Access-Token> " \
-d '{
"tracking_id": "795_123",
"operations": [
{
"operation": "API_INTEGRATION",
"api_integration_preference": {
"rest_api_integration": {
"integration_method": "PAYPAL",
"integration_type": "THIRD_PARTY",
"third_party_details": {
"features": [
"PAYMENT",
"REFUND"
]
}
}
}
}
],
"products": [
"EXPRESS_CHECKOUT",
"PPPLUS"
],
"legal_consents": [
{
"type": "SHARE_DATA_CONSENT",
"granted": true
}
]
}'
And the response is :
{
"name": "INVALID_REQUEST",
"message": "Request is not well-formed, syntactically incorrect, or violates schema.",
"debug_id": "266c1b0e09a8f",
"information_link": "",
"details": [{
"issue": "INVALID_ARRAY_LENGTH",
"description": "The number of items in an array should not be more than 1",
"field": "/products",
"location": "body"
}],
"links": []
}
Has anyone come up to this error message for "products" array, or is this a PayPal v2 Onboarding bug?
I'm trying to add dynamic templates. I've done
curl -XPUT 'localhost:9200/my_index_items?pretty' -H 'Content-Type: application/json' -d'
{
"mappings": {
"item": {
"dynamic_templates": [
{
"sales_price_in_cent_as_long": {
"match": "sales_price_in_cent",
"mapping": {
"type": "long"
}
},
"sales_price_formatted_as_double": {
"match": "sales_price_formatted",
"mapping": {
"type": "double"
}
},
...
}
]
}
}
}
'
So in "my_index_items" i got the type "item", when I now index an item (item has a field "sales_price_formatted" which has a value like "12,34") and lookup with GET 'localhost:9200/my_index_items/item/_mapping' it shows the "sales_price_formatted" as of type "text" instead of "double".
Am I doing something wrong? I thought, if an item has a field which is defined in the "match" property in my dynamic templates, then it wouldn't use its own default mechanism but the one defined here?
You have some missing curly brackets in your command. It should be like this:
{
"mappings": {
"item": {
"dynamic_templates": [
{
"sales_price_in_cent_as_long": {
"match": "sales_price_in_cent",
"mapping": {
"type": "long"
}
}
},
{
"sales_price_formatted_as_double": {
"match": "sales_price_formatted",
"mapping": {
"type": "double"
}
}
}
]
}
}
}
I have been unable to get google-actions sdk for node.js to pass arguments. I installed the https://github.com/actions-on-google/actionssdk-eliza-nodejs sample project and noticed arguments are not working for that project either. Any insight?
In the web simulator I entered "i am feeling sad"
Here is the request I get
{
"query": "i am feeling sad",
"accessToken": "**masked**",
"expectUserResponse": true,
"conversationToken": "CiZDIzU4O..."content_copy,
"debugInfo": {
"assistantToAgentDebug": {
"assistantToAgentJson": {
"user": {
"user_id": "**masked**"
},
"conversation": {
"conversation_id": "1484523995718",
"type": 2,
"conversation_token": "{\"elizaInstance\":{\"noRandom\":false,\"capitalizeFirstLetter\":true,\"debug\":false,\"memSize\":20,\"version\":\"1.1 (original)\",\"quit\":false,\"mem\":[],\"lastchoice\":[[-1],[-1],[-1],[-1],[-1,-1,-1],[-1,-1],[-1],[-1],[-1],[-1,-1,-1],[-1,-1,-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1,0,-1],[-1,-1,-1],[-1],[-1,0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],[-1,-1,-1,-1],[-1],[-1,-1],[-1,-1],[-1],[-1],[-1],[-1],[-1],[-1],[-1,-1,-1],[-1]],\"sentence\":\"i am feeling sad\"}}"
},
"inputs": [
{
"intent": "assistant.intent.action.TEXT",
"raw_inputs": [
{
"input_type": 2,
"query": "i am feeling sad"
}
],
"arguments": [
{
"name": "text",
"raw_text": "i am feeling sad",
"text_value": "i am feeling sad"
}
]
}
]
}
}
}
}
text_value should = "sad", not "i am feeling sad" based on eliza.json which has this:
{
"versionLabel": "Eliza v1",
"agentInfo": {
"languageCode": "en-US",
"projectId": "**masked**",
"invocationNames": [
"eliza"
],
"voiceName": "female_1"
},
"actions": [
{
"description": "Start an Eliza consultation",
"initialTrigger": {
"intent": "assistant.intent.action.MAIN"
},
"httpExecution": {
"url": "https://**masked**"
}
},
{
"description": "Deep link to Eliza consultation",
"initialTrigger": {
"intent": "raw.input",
"queryPatterns": [
{
"queryPattern": "my emotional state is $SchemaOrg_Text:text"
},
{
"queryPattern": "I am concerned about $SchemaOrg_Text:text"
},
{
"queryPattern": "I am feeling $SchemaOrg_Text:text"
},
{
"queryPattern": "I need to talk about my feelings"
}
]
},
"httpExecution": {
"url": "**masked**"
}
}
],
"deploymentStatus": {
"state": "NEW"
},
"versionId": "1"
}
The Google Actions SDK will parse patterns and correctly bind arguments for intents that activate your action. For example, if you say
At my action I am feeling sad
You will recieve arguments that look like this
"arguments": [
{
"name": "text",
"raw_text": "sad",
"text_value": "sad"
},
{
"name": "trigger_query",
"raw_text": "i am feeling sad",
"text_value": "i am feeling sad"
}
]
However, if you request input from the action by setting expect_user_response to true, the arguments are always returned in raw form using the intent "assistant.intent.action.TEXT". It is up to you to parse those raw arguments as indicated in the other answer to this question.
Also note that as far as I can tell, the Schema_Org types are not returned per the documentation. More information here.
If you are using the Actions SDK, then you have to use your own NLP for understanding the raw user query and for extracting arguments. If you don't have you own NLP, then we recommend that you use API.AI.
I test on https://developers.facebook.com/tools/explorer/
My query: /v2.8/11111111/leadgen_forms?fields=leads_count,leads
Response:
{ "data": [
{
"name": "My Form",
"leads_count": 37,
"leads": {
"data": [
{
"created_time": "2016-12-21T14:50:56+0000",
"id": "10000000000000",
"field_data": [
{
"name": "email",
"values": [
"hidden#gmail.com"
]
},
{
"name": "first_name",
"values": [
"Hidden"
]
},
{
"name": "last_name",
"values": [
"Hidden"
]
}
]
}
],
"paging": {
"cursors": {
"before": "MTc0ODU4Mjg2MjEyODQ1MgZDZD",
"after": "MTc0ODU4Mjg2MjEyODQ1MgZDZD"
}
}
},
"id": "10000000000000"
}
}
Why I get only one lead in data, when I have 37 in leads_count field?
I actually don't see the way you are accessing leads documented anywhere.
In your request, you are accessing the edge of a page, requesting the forms, and within that, requesting the leads.
You should probably be using the edge of the form ID instead to retrieve leads:
curl -G \
-d 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.8/<FORM_ID>/leads
You can also filter them:
curl -G \
-d "filtering=[{'field':'time_created','operator':'GREATER_THAN','value':<TIMESTAMP>}]" \
-d "access_token=<ACCESS_TOKEN>" \
https://graph.facebook.com/<API_VERSION>/<AD_ID>/leads