im developing a chatbot whith messenger facebook, i already have the Greeting Text, a menu (no working yet), and a get started button, when i try testing to recive a generic template, it simply does nothing, if i change the response, a simple text, it response that text, but the generic template not, i copy the example from here: https://developers.facebook.com/docs/messenger-platform/thread-settings
i dont know why a cant get the generic template, if i configure to response with an image, buttons, text, all of that is sended, but the template not, this is how i configure the resonse:
$response = '{
"recipient":{
"id":"'.$senderId.'"
},
"message":{
"attachment":{
"type":"template",
"payload":{
"template_type":"generic",
"elements":[
{
"title":"Sin saber, vivió casi un mes entre muertos",
"image_url":"https://diario.mx/imagesnotas/2017/01/LOC1307270af08088b_0.jpg",
"subtitle":"Desde el lunes empezó a hacer oración para el descanso de las almas torturadas y sepultadas, afirma",
"default_action": {
"type": "web_url",
"url": "https://diario.mx/Local/2017-01-05_f62a689b/sin-saber-vivio-casi-un-mes-entre-muertos/",
"messenger_extensions": true,
"webview_height_ratio": "tall",
"fallback_url": "https://diario.mx/"
} ,
"buttons":[
{
"type":"web_url",
"url":"https://diario.mx/",
"title":"Ir a diario.mx"
},{
"type":"postback",
"title":"Start Chatting",
"payload":"DEVELOPER_DEFINED_PAYLOAD"
}
]
}
]
}
}
}
}';
is trigered by a custom payload "masleidas" from quick_replies option
According to the docs subtitle has a character limit of 80 and your example shows 99 characters in subtitle. So I think it's too many characters.
Do you get any error returned from the FB API to your chatbot?
Related
I m trying to use postman
link:https://graph.facebook.com/v6.0/me/messages?access_token=my_token
{
"get_started":{
"payload": "Hi, I am bot"
}
}
in raw JSON body
but getting this response
{
"error": {
"message": "(#100) Tried accessing nonexisting field (messages) on node type (Page)",
"type": "OAuthException",
"code": 100,
"fbtrace_id": "AtFh2_fJ2sxkeU8k-2aNJGl"
}
}
Here is the little rundown how to put get started button , I hope its help:
Using postman:
Start by changing the type by choosing a POST request: (one of the
problems that solve my issue thanks to #misorude
Define a Post request to this URL:
https://graph.facebook.com/v6.0/me/messenger_profile?access_token=<PAGE_ACCESS_TOKEN>
As #misorude notice my another problem check endpoint from here https://developers.facebook.com/docs/messenger-platform/reference/messenger-profile-api
In the BODY section:
.
Paste this code:
{
"get_started":{
"payload": "Hi, I am bot"
}
}
P.S.
Thank you again
I'm testing Actions for Google, so I created some simple Sinatra application which looks something like:
require 'sinatra'
require 'json'
post '/google_assistant_api' do
content_type :json
case intent_name
when "input_welcome"
decorated_response
when "Recipe name"
basic_card
end
end
private
def decorated_response
{
source: "test source",
speech: "speech",
display_text: "something"
}.to_json
end
def intent_name
parsed_request["queryResult"]["intent"]["displayName"]
end
def parsed_request
#parsed_request ||= JSON.parse(request.body.read)
end
def basic_card
{
"fulfillmentText": "ACTIONS_ON_GOOGLE",
"fulfillmentMessages": [
{
"platform": "PLATFORM_UNSPECIFIED",
"text": {
"text": [
"string text"
]
},
"image": {
"imageUri": "https://avatars3.githubusercontent.com/u/119195?
s=400&v=4"
},
"basicCard": {
"title": "title string",
"subtitle": "subtitle",
"formattedText": "formatted text",
"image": {
"imageUri": "https://avatars3.githubusercontent.com/u/119195"
},
"buttons": []
}
}
],
"source": "source string"
}.to_json
end
Please note that I'm using V2 of the API and testing using google assistant:
I tried many other response formats based on https://gist.github.com/manniru/f52af230669bd3ed2e69ffe4a76ab309 with no luck. I keep getting:
Sorry! there was no response from the Agent. Please try later.
Is there anyone who tried non nodejs response with luck? I would appreciate any sample response as the simple response seems to be working, however as for the basic card I'm having no luck.
Dialogflow's v2 API uses a different format for webhook requests and responses which is documented here:
Dialogflow v2 Webhook Request
Dialogflow v2 Webhook Response
It appears that your code is using the old format.
Can somebody explain me what is the difference between start_nickname and start_address in https://developer.uber.com/docs/riders/references/api/v1.2/requests-post ? Maybe in form of examples? I don't know which one to use to provide street and city info.
start_nickname in POST /requests is the label used for the destination in the rider app when you create a request via the api. So please use start[latitude|longitude] or start_place_id to specify Start Location.
So if you try to request a ride with just start_nickname and start_address
{
"product_id": "a1111c8c-c720-46c3-8534-2fcdd730040d",
"start_nickname" : "Uber HQ",
"start_address" : "1455 Market Street, San Francisco",
"end_latitude": 37.795,
"end_longitude": -122.440,
"end_nickname" : "Embarcadero",
"end_address" : "One Embarcadero Center, San Francisco"
}
you will get a response like:
{
"fields": {
"": "Both start_latitude and start_longitude or start_place_id are
required."
},
"message": "Invalid request",
"code": "validation_failed"
}
In order to make a valid ride request you need to add:
"start_latitude": 37.776,
"start_longitude": -122.418,
Or "start_place_id" (This is the name of an Uber saved place. Only “home” or “work” is acceptable.)
I'm generating the reports in JasperServer and using the Rest api to schedule the report. The rest api is given below:
curl
-XPUT "http://hostURL/jasperserver/rest_v2/jobs"
--data '{
"trigger":{
"simpleTrigger":{
"occurrenceCount":"1",
"startType":"1",
"timezone":"Asia/Calcutta",
"misfireInstruction":"0",
"version":"0"
}
},
"outputTimeZone":"Asia/Calcutta",
"username":"jasperadmin",
"outputFormats":{
"outputFormat":[
"PDF"
]
},
"source":{
"parameters":{
"parameterValues":{
"parameter1":[
"value"
],
"parameter2":[
"value"
],
}
},
"reportUnitURI":"/reports/Report"
},
"baseOutputFilename":"MyReport",
"mailNotification":{
"messageText":"<p> Greeting,<br>Please find your statements.<p>",
"toAddresses":{
"address":[
"myemail#xyz.com"
]
},
"includingStackTraceWhenJobFails":"false",
"skipEmptyReports":"false",
"subject":"Account Statement",
"skipNotificationWhenJobFails":"false",
"resultSendType":"SEND_ATTACHMENT"
},
"repositoryDestination":{
"usingDefaultReportOutputFolderURI":"false",
"folderURI":"/Reports/GeneratedReports",
"saveToRepository":"true",
"overwriteFiles":"true",
"sequentialFilenames":"false"
},
"label":"Report_20160929591135"
}'
-H "authorization:Basic amFzcGVyYWRtaW46amFzcGVyYWRtaW4="
-H "content-type:application/job+json"
The API works perfectly. But the HTML content that I send in the messageText is not rendered and shows up as plain string. Is there any way I could send HTML content in the messageText. Do I have to make changes in some property files?
As far as I know, Jaspersoft Server is not capable of sending HTML Emails as it is using basic Java Strings.
You basically have to edit the source code and change it to your liking.
For the line breaks maybe just use \n ?
I'm trying to automatically add a comment to a page in confluence using the REST API.
I am testing using Postman, im pointing at this url: https://###########.atlassian.net/wiki/rest/api/content/
using valid headers, and posting this json:
{
"type":"comment",
"container":"72025106",
"body":{
"storage":{
"value":"auto comment 1",
"representation":"storage"
}
}
}
When I do i get this error back:
{
"statusCode": 500,
"message": "java.lang.IllegalStateException: Must provide id and type for Content"
}
this should work:
{"type":"comment",
"container":{
"id":"[PARENT_ID]",
"type":"page",
"status":"current"
},
"body":{
"storage":{
"value":"[COMMENT_BODY]",
"representation":"storage"
}
}
}