display map in facebook messenger bot - facebook

I need to show map in facebook messenger bot. According to documentation following code should work but I only see message and place icon. Has anyone faced similar issue.
var messageData = {
recipient: {
id: userId
},
message: {
text: msg,
metadata: "DEVELOPER_DEFINED_METADATA",
quick_replies: [
{
"content_type": "location"
}
]
}
};
callSendAPI(messageData);
}

I was able to use this functionality without a problem on the IOS messenger app. The 'location' feature allows the user to send a their location to the bot. By default, it showed a map with 'Your Location' and 'Tap to view on map'.
I tried from the desktop and it gave an error indicating that locations are only usable in the app.
The bot is running at DMS Software Bot. Type 'quick reply' and hit location.
The source is at FB-Robot on github.

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);
}

Generic template image_url does not load in Messenger - Facebook Messenger Platform

I am using the Facebook Messenger Platform to create a generic template. I am currently using ngrok to test locally, and the image_url I input for the generic template never shows in Messenger. The generic template is sent, and the image is just blank. Using Inspect, I can see that the CSS for the image is:
background-image: url("https://external.xx.fbcdn.net/safe_image.php?d=AQA1nM3pKJnllzq0&url=https%3A%2F%2Fdc3858ef.ngrok.io%2Fassets%2Fimages%2Fvideo_image.jpg&_nc_hash=AQAlBOE-vbT8cl-i");
If I open this URL, it is just a black screen with one white pixel in the middle.
Here is the message data that I use:
messageData = {
recipient: {
id: senderID
},
message:{
attachment:{
type: "template",
payload: {
template_type: "generic",
elements: [
{
title:"Test Video Link",
image_url: MY-NGROK_DOMAIN + "/assets/images/video_image.jpg",
subtitle: "Check out this video!",
default_action: {
type: "web_url",
url: "www.google.com"
}
}
]
}
}
}
};
This image_url works fine if I open it in a browser. Similarly, if I create an 'image' type message data rather than 'template', this image is loaded in Messenger.
How can I get my image_url to load properly for a generic template?
I have the same issue. I and the problem appears when the webhook domain is the same as the image url. If you use an image on a different server, it works.
I had the same issue. I've put my local web application behind ngrok. Requesting the image directly in the browser worked fine, but when it's loaded via Facebook's safe_image.php script it would show a blank image. After a lot of debugging it turned out to be the tunnelling service itself. I switched to another service (localtunnel) and there it worked fine.
More information can also be found on this issue registered on FB:
https://developers.facebook.com/support/bugs/2151860088174161/
Update
Contacted ngrok about this and got a quick reply, this is due to Facebook blocking ngrok for this script.

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

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.

Error: cannot invite friends using Facebook SDK for Unity

I was wondering if somebody can help me to solve this problem. I am trying to use FB.AppRequest() in Facebook SDK for Unity to implement an Invite feature . This is the code which I use.
if(FB.IsLoggedIn)
{
FB.AppRequest(
message: "Let's eat and be prosperous!",
title: "Let's eat and be prosperous!",
callback: InviteCallback
);
}
// ...
void InviteCallback(FBResult response)
{
// print response to console
}
The invitation dialog which I get can be seen here (link to Imgur). There is no "Invite" label on those buttons, and unsurprisingly, clicking them does not send any invitation. However, I can see the FBResult data, which is in the following format:
{
"request": "ABCD",
"to":
[
"EFGH",
"IJKL"
]
}
(more or less, since I haven't found a way to print new lines to Firebug console)
Additional information:
The result is the same regardless of the Sandbox setting.
The Unity version is 4.3.0f4
The Facebook SDK for Unity version is 4.3.4
The binary is hosted on an intranet server.
The Invite functionality in the Friend Smash example, hosted on the same server, doesn't work either. However, this is before the latest Friend Smash update (11/11/2013), whose Facebook functionalities I can't get to work yet.
Other Facebook functionalities (e.g. Init, Feed, API) work well.
I can't find any information about this on the internet. There are other questions about the Invite feature not working, but without the Facebook SDK for Unity, so I am not sure how they can be helpful to me.
Thanks a lot!
Just to clarify: the envelope button sends the invite, and it does so immediately when it is clicked.
If your app is in sandbox mode, people won't get notified when the request is sent. Look for the request in https://www.facebook.com/appcenter/requests as the recipient and see if the request shows up there.
If this still doesn't work, can you send me your fbresult data? unity-sdk#fb.com. thanks!