Facebook 'Get Started' Button not showing up anymore in my chatbot - facebook-graph-api

I'm not able to see 'Get Started' button in my messenger bot conversation.
But it DID appear. And for some unknown reasons, it disappeared yesterday.
I've already made this request :
POST https://graph.facebook.com/v2.6/me/messenger_profile?fields=get_started&access_token=XXX
{
"get_started":{
"payload":"getstarted"
}
}
And checked :
GET https://graph.facebook.com/v2.6/me/messenger_profile?fields=get_started&access_token=XXX
Result :
{
"data": [
{
"get_started": {
"payload": "getstarted"
}
}
]
}
I tried to delete the conversation both on facebook web UI, messenger web UI and iOS app.
I am administrator of that app.
Any suggestion ?
Thanks !

Related

Perform a task if post is shared successfully by the user using facebook SDK share button

I have used facebook SDK share button in my website. Is it possible to show a success message or perform a task if a web page is shared successfully by the user?
See example on this docs page:
FB.ui(
{
method: 'share',
href: 'https://developers.facebook.com/docs/',
},
// callback
function(response) {
if (response && !response.error_message) {
alert('Posting completed.');
} else {
alert('Error while posting.');
}
}
);

DialogFlow fulfillment for Facebook Messenger Webview

Button to open web view on Facebook Messenger keeps opening a browser, on mobile and desktop
I've created Facebook Messenger Bot, created a Test Page and a Test App, currently receiving webhooks from every message on DialogFlow, which respond correctly to the first message, in which i return a DialogFlow card, with a button, this button supposed to open a webview, but keeps opening a browser tab, on mobile and desktop, now, i'm aware for open a webview on desktop the are some modifications to the code that need to be made but mobile should be working by now and that is not the case. I'm following this flow:
https://cloud.google.com/dialogflow/docs/images/fulfillment-flow.svg)
This the webhook response sent from my Django instance to DialogFlow:
"fulfillmentMessages": [
{
"card": {
"title": "aaa bbb ccc",
"platform": "facebook",
"subtitle": "card text",
"imageUri": "https://ucarecdn.com/6a3aae10-368b-418f-8afd-ed91ef15e4a4/aaaa_bbb_ccc.png",
"buttons": [
{
"type": "web_url",
"text": "Get Recipe",
"postback": "https://assistant.google.com/",
"webview_height_ratio":"compact",
"messenger_extensions": "true"
}
]
}
}],}
This is the view for responding to postback button:
#csrf_exempt
def get_recipe(request):
"""
"""
response = render(request, "recipe_item.html")
response['X-Frame-Options'] = 'ALLOW-FROM https://messenger.com/ https://www.facebook.com/ https://l.facebook.com/'
response['Content-Type'] = 'text/html'
return response
And this is the Messenger Extensions SDK been installed on the HTML for the view corresponding to the webview:
<html>
<head>
<title>Choose your preferences</title>
</head>
<body>
<script>
(function (d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) {
return;
}
js = d.createElement(s);
js.id = id;
js.src = "//connect.facebook.com/en_US/messenger.Extensions.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'Messenger'));
window.extAsyncInit = function() {
// the Messenger Extensions JS SDK is done loading
MessengerExtensions.getSupportedFeatures(function success(result) {
let features = result.supported_features;
if (features.indexOf("context") != -1) {
MessengerExtensions.getContext('375919546670588',
function success(thread_context) {
// success
document.getElementById("psid").value = thread_context.psid;
// More code to follow
},
function error(err) {
console.log(err);
console.log(err.message);
}
);
}
}, function error(err) {
console.log(err.message);
});
};
</script>
...
</body>
</html>
The end result should be a web view been opening when Get Recipe button is pushed
EDIT: i just try sending this custom payload to DialogFlow and no webview, button keeps opening browser instead.
{
"fulfillmentMessages": [
{
"payload": {
"facebook": {
"attachment": {
"type":"template",
"payload":{
"template_type":"button",
"text":"Try the URL button!",
"buttons":[
{
"type":"web_url",
"url":"https://www.messenger.com/",
"title":"URL Button",
"webview_height_ratio": "full"
}
]
}
}
}}
}]}
Ladies and Gentleman, i'm happy to announce, problem solve, well at least shows a webview, now i'm going to to try show my on view, i try showing a random website (https://www.messenger.com/), and changing again the custom payload to be send to DialogFlow from my Django instance:
{
"fulfillmentMessages": [
{
"payload": {
"facebook": {
"attachment": {
"type":"template",
"payload":{
"template_type":"button",
"text":"Try the URL button!",
"buttons":[
{
"type":"web_url",
"url":"https://www.messenger.com/",
"title":"URL Button",
"webview_height_ratio": "tall"
}
]
}
}
}}
}]}
Basically, the difference is the change on webview_height_ratio from full to tall or compact, this last two are working, but when i set it to full just open a browser, next:
- Try with my custom view for the webview
- Make all this work on desktop
I'll be in touch!!! i can't say how happy i am, sounds corny, but i don't care, i have been stucks on this for about 36 hours.
I made extension works a month ago with Dialogflow but I gave up the idea because of the latest messenger update that no longer supports beginShareFlow :
https://developers.facebook.com/docs/messenger-platform/webview/sharing/v4.0
Starting August 15, 2019, updated versions of the Messenger app will
no longer support Begin share flow on Messenger extension SDK. As a
workaround, developers can provide a way, to copy a link within the
webview, that people can use to share in Messenger conversations.
Refer to June 10, 2019 Announcement
I had few differences with your json :
button.put("webview_height_ratio", "full"); // <compact|tall|full>",
button.put("messenger_extensions", true);
button.put("webview_share_button", "hide");
Regards,

Ionic facebook login for native

I have implemented the facebook login for my ionic application, which works perfectly when run on web. When i build the application, create an apk of the same, and try to run on my mobile device, nothing happens.
The login is:
openFB.login(
function (response) {
if (response.status === 'connected') {
console.log('Facebook login succeeded, got access token: ', response);
openFB.api({
path: '/me',
success: function (data) {
console.log("My Data", data);
userData.name = data.name;
userData.picture = 'http://graph.facebook.com/' + data.id + '/picture?type=small';
localStorageService.set('user', userData);
$timeout(function() {
$state.go('app.home');
}, 0);
},
error: function(error) {
console.log("Error here:", error);
}
});
} else {
console.log('Facebook login failed: ' + response);
}
}, { scope: 'email, public_profile' });
Have used openFB for the login. After clicking, following popup comes up.
After clicking the okay, nothing gets logged. No console message.
Can some one help me for finding out this issue, where i am not able to do the facebook login, when run on actual device.
You need to whitelist the redirect url. You can set it in
Products > Facebook Login > Settings > Client OAuth Settings
Take a look into this question.
please set redirect URI in
Products > Facebook Login > Settings > Client OAuth Settings
http://localhost/callback
please follow the below procedure to register your app in facebook developer site
https://ccoenraets.github.io/ionic-tutorial/ionic-facebook-integration.html
and use the below code to complete the procedure of facebook login
$cordovaOauth.facebook("appId", ["email", "public_profile"]).then(function(result) {
//alert(JSON.stringify(result));
//$localStorage.accessToken = result.access_token;
$http.get("https://graph.facebook.com/v2.2/me", {
params: {
access_token: result.access_token,
fields: "id,name,gender,location,email,picture,relationship_status",
format: "json"
}
}).then(function(result) {
// alert(JSON.stringify(result));
$scope.loginflowusingsociallogin(result.data.email);
}, function(error) {
alert("There was a problem getting your profile. Check the logs for details.");
alert(JSON.stringify(error));
});
});
i used Oauth 2.0 authentication for ionic.
I used this code and worked fine for me

facebook unsupported post request

I have logged in a user to my app from FB.login now I want to post to the user timeline on the behalf of user. I want to upload a video to the user timeline. I am doing something like:
FB.api(
`/${user_id}/videos`,
"POST",
{
"file_url": video,
"description": description,
"thumb": video_thumbnail,
"title": title,
},
function (response) {
console.log("fb response")
console.log(response)
if (response && !response.error) {
/* handle the result */
console.log("video upload response")
console.log(response)
}
}, {scope: ['user_videos', 'user_actions.video']});
When I do this it is giving me error saying code: 100
fbtrace_id: "F1BDJWtcTXl"
message: "Unsupported post request. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api"
type: "GraphMethodException"
Why I am getting this error ??
Help is appriciated ..
Thank you
Use /me/videos instead of /${user_id}/videos and use single (or double) quotes instead of "`".
Also, you need publish_actions only, and you need to use the scope parameter with FB.login. FB.api is just an API call.
Here´s an example for the login: http://www.devils-heaven.com/facebook-javascript-sdk-login/
And here´s the link to the docs for uploading videos: https://developers.facebook.com/docs/graph-api/reference/user/videos/#Creating
Someone suggested that the App may be in sandbox/dev mode, no sure why this should be a problem but here´s the thread: How to fix "Unsupported post request" when posting to FB fan page?

soap based web service in BB 10

I am just started development in BB10 .I need to call soap based web service from URL .I google it and found one weather example .But it not help me.Actually I want to to call a method Example like
getVersionReturn .
from url so that my concept clear .Then I will call my other methods
here is my url.
http://railapps.firstgroup.com/FirstGroupRailApps/services/RailAppsCAWS?wsdl
The return value is response like :1.3 .
can you help me to call one method on button click ?
Ok this isn't full solution, but it will show you the important part (this is cascades solution)
Button {
text: "click"
onClicked: {
dataSource.load();
}
}
and
attachedObjects: [
DataSource {
id: dataSource
source: "http://railapps.firstgroup.com/FirstGroupRailApps/services/RailAppsCAWS?wsdl"
type: DataSourceType.Xml
remote: true
onDataLoaded: {
console.log(JSON.stringify(data))
}
onError: {
console.log(errorMessage)
}
}
]
so all you need to do is to search through that data.