Microsoft Bot Framework: buttons not working on facebook channel - facebook

I'm building a bot using Microsoft Bot Framework. The bot is running on Facebook, Telegram and Skype, but in the facebook channel, buttons are not working as expected.
When I click a button on Telegram or Skype, everything works and the bot answers correctly, but when I click a button using facebook, It seems that the bot doesn't receive the message. It isn't a problem of the bot, because if I write explicitly the content of the button, the bot receive the message, but not if I click the button.
How can I fix that?
EDIT: Here it is the code of the buttons
public enum OsOptions { NotSelected = 0, ANDROID, IPHONE, IPAD, PC}
[Prompt("Please, select the target OS or write its name below. {||}")]
public OsOptions Os { get; set; }
public static IForm<LinkForm> BuildForm()
{
var form = new FormBuilder<LinkForm>()
.AddRemainingFields()
.OnCompletion(async (context, state) =>
{
await context.PostAsync("The form has been completed.");
});
return form.Build();
}

Make sure that in the Facebook app settings, in the Messenger/webhook part that you select messages and messaging postback
Image from Facebook Docs

Related

Send text to Viber and Facebook Messenger with Flutter

How can I send a text directly to a specific phone number on Viber? or to a specific person on Facebook messenger?
with whatsapp I'm using url_launcher with whatsapp with below code, and it is working fine.
var whatsapp_url = "whatsapp://send?phone=" + whatsapp_number + "&text=hellooo";
try {
await launchUrl(Uri.parse(whatsapp_url));
} catch (e) {
print('could not launch whatsapp');
}
I tried using the same package with Viber using ("viber://chat?number=") and Facebook messenger using ('m.me/username') but both are just opening a web site and not opening the mobile App and not finding the phone number or the messenger chat.
I need to do a similar thing by clicking an IconButton to open a specific chat on Viber and another IconButton to open a specific Facebook messenger chat.
I found a solution in case someone needed - I used the same url_launcher library.
Viber:
var viber_link = "viber://chat/?number=$Country_Code$Mobile_Number&draft=$Message_to_be_sen”
;
Viber doesn’t need ‘+’ sign when writing the country code
Facebook Messenger:
var facebook_messenger_link = 'https://m.me/$FaceBook_Name?text=$Message_to_be_sent;
Facebook Name can be found by clicking on the profile picture on Facebook and checking the URL, it comes after ‘https://www.facebook.com/{FB_Name}’
Telegram:
var telegram_link = 'https://t.me/+$Country_Code$Mobile_Number&draft=$Message_to_be_sen';
Telegram needs the ‘+’ sign when writing the country code
Then used this code for launching it:
final Uri app_link_uri = Uri.parse(app_link);
try {
await launchUrl(
app_link_uri,
mode: LaunchMode.externalApplication,
);
} catch (error) {
print(‘error’ catching: $error);
}

Tracking buttons on facebook messenger bot

I am trying to track the buttons clicks on facebook messenger bot. Does any one have any experience or tips on doing it.
Here is a portion of my JSON
buttons:[
{
type:'web_url',
url:'<link to my url>',
title:'Click me'
},
{
type:'phone_number',
title:'Call',
payload:'+1' + phoneNumber
}
]
I am primarily unable to track the phone_number, I can get away with few workarounds with the web_url on the target side.
Change the call me one to be a URL then on your website note that they clicked the button and redirect them to tel:+123456789012345

Like option using cordova

I need a web and mobile application which will work on android, iphone and windows as well.
I want to use facebook login for my apps and customer can like my page after login thats why i am using cordova to convert my web app into android app but i need to integrate facebook-like option which i didn't get in plugin.
So i implemented this using oglike
$scope.facebookLike = function() {
if($localStorage.hasOwnProperty("accessToken") === true) {
$http.post("https://graph.facebook.com/me/og.likes?access_token="+$localStorage.accessToken+"&object=https://www.facebook.com/Nxtlife-Technologies-Ltd-UK-180614345644169/?ref=br_rs");
alert("like sucessfully done");
} else {
alert("Not signed in");
$scope.facebookLogin();
}
}
Problem:
The code will not throwing any error but after success message it didin't make any changes to my page. like count is remains same.
og.likes is for Open Graph objects – external URLs, outside of Faceook.
You can not like Facebook pages by any other means than the official Like button.

How to setup Facebook App Request from Unity with Prime31 Social combo plugin?

my problem is this, when the user is asked to select friends from the list and click on Send I receive a Success state from callback but no request is reached from the people selected in the list.
My setup is this:
- my app is a native app for iOS and Android made in Unity
- my app is registered in Facebook developer portal as Game/Puzzle, I set up bundle id, package name, display name and namespace
- my app is not yet published
- I configured the Prime31 Facebook plugin with the appId given from Facebook and Display Name
I send my request like this:
public void AskLifesOnFacebook()
{
var parameters = new Dictionary<string, string>
{
//{ "app_id", "#######my_app_id_number####" },
{ "method", "apprequests" },
{ "title", "My request title" },
{ "message", "My request text" }
};
FacebookCombo.showDialog("apprequests", parameters);
}
But still the friends selector is shown up correctly on an overlay windows, I select friends and send the request but no request is received.
Am I missing something in the configuration of my app on Facebook? Do I need to pass some kind of certification?
From the same app the stream.publish is working correctly and I can publish on user walls.
The setup with Prime31 plugin and the call are correct!
You have to enable "Single Sign On" and "Deep Linking" in Facebook app parameters and add a valid itunes ID for your app (while testing you can put any valid ID, but you should create a itunes connect entry for your app and get the final ID).
When your app is a native iOS app, the users see the notifications only through the Facebook iOS app, so they are guarantee they can open iTunes or run the game.
Global notifications instead (ej: regular browser on PC) are seen if the app is in a Facebook Canvas.

How to make a wall post using windows phone 7 native app

I have created a native app on Windows Phone 7.
The user of the app will provide his login credentials to us when he registers as a new user. What i want to do is to give a handle of share on facebook in my app.
On clicking on the handle the selected image should be posted on to the user's wall and just display a message to the user that the image is posted successfully or not.
The problem is that facebook has not provided with a developent environment for Windows Phone 7 native apps.
I want some alternate solution to this.
thanks for the link. I had already visited the link earlier. I have implemented facebook integration in wp7. Its working properly and i am able to make wall posts.
Here's my code,
//Users clicks on Share on facebook button
private void btnFacebookPost_Click(object sender, RoutedEventArgs e)
{
//Check if access tokens are already set.
if (App.accessTokens == null)
{
GetAccessTokens();
}
else
{
//Use the access tokens to post on facebook
}
}
private void GetAccessTokens()
{
// Navigate user to facebooks login page
// if user has already authenticated your app you'll receive the access tokens directly
webBrowser.Source = new Uri("https://www.facebook.com/dialog/oauth?client_id='your app id'&redirect_uri=https://www.facebook.com/connect/login_success.html&response_type=token&scope='whatever extended permissions you require'");
}
//On The Navigated event of web browser check for access tokens
//Use the facebook c# sdk to get the access tokens from the url
void webBrowser_Navigated(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
FacebookClient fbClient = new FacebookClient();
FacebookOAuthResult oauthResult;
if (fbClient.TryParseOAuthCallbackUrl(e.Uri, out oauthResult))
{
// The url is the result of OAuth 2.0 authentication
if (oauthResult.IsSuccess)
{
App.accessTokens = oauthResult.AccessToken;
}
else
{
var errorDescription = oauthResult.ErrorDescription;
var errorReason = oauthResult.ErrorReason;
}
}
else
{
// The url is NOT the result of OAuth 2.0 authentication.
}
}
Now use the access tokens with the facebook sdk for C#.net to make the wall posts or any other transactions as required.
The problem with this method is that the application user and the facebook's logged in user may be different thus making a transaction to different account.
Since the SSO for WP7 is not available this method should do the trick.