Send text to Viber and Facebook Messenger with Flutter - 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);
}

Related

Opening Google calendar from Flutter app (Deep Linking)

I want to open Google calendar app more specifically the create event page in the app from my another flutter app.
I am using the URL launcher package but it opens the app in chrome
What change should I make in the URL so that the add event page opens directly in the google calendar app.
Currently my URL looks like below
https://calendar.google.com/calendar/u/0/r/eventedit?dates=20210226T033000/20210226T040000&ctz=Asia/Calcutta&location&text=Blawsome:+A+Crystal+Alchemy+Healing+Meditation&details=Parth+Pitroda
My code for that part is as below
if (await canLaunchUrl(Uri.parse('https://calendar.google.com/calendar/u/0/r/eventedit?dates=20210226T033000/20210226T040000&ctz=Asia/Calcutta&location&text=Blawsome:+A+Crystal+Alchemy+Healing+Meditation&details=Parth+Pitroda'))) {
await launchUrl(
Uri.parse('https://calendar.google.com/calendar/u/0/r/eventedit?dates=20210226T033000/20210226T040000&ctz=Asia/Calcutta&location&text=Blawsome:+A+Crystal+Alchemy+Healing+Meditation&details=Parth+Pitroda'),
mode: LaunchMode.externalApplication);
} else {
throw 'Could not launch URL';
}
rathe than using a HTTP request, you could use googleapis package from https://pub.dev which has inbuilt methods to create Google Calender events directly within the Calender app.
Check package and documentation here.
Happy coding!

Microsoft Bot Framework: buttons not working on facebook channel

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

Is there any method to share text from mobile web to wechat by sharing button?

I am looking for wechat sharing function like how whatsapp does.
href="whatsapp://send?text=http://www.example.com"
Based on my research, most of them will be encoded in QR code and scan the QR code with wechat scanner. Is there a way to share the text directly to friend when click on sharing button just like how whatsapp does?
Wechat doesn't have any official deep linking URL for sending a text. However, if you can add some JavaScript Code in your mobile web, you can achieve the share functionality.
Check out Send to chat documentation on Wechat JS SDK.
From JS SDK Documentation:-
wx.onMenuShareAppMessage({
title: '', // Sharing title
desc: '', // Sharing description
link: '', // Sharing link
imgUrl: '', // Sharing image URL
type: '', // Sharing type, such as “music”, “video “ or “link”. It is “link” by default.
dataUrl: '', // The data URL should be provided for items of type “music” or “video”. It is null by default.
success: function () {
// Callback function executed after a user confirms sharing
},
cancel: function () {
// Callback function executed after a user cancels sharing
}
});
We do have some unofficial deep linking URL like you mentioned. But it may stop work anytime if Wechat decided to change it.
Here is some of them below, sadly I don't know any URL to share a text to chat.
weixin:// - to open Wechat app (if installed)
weixin://dl/chat - to open chat screen of Wechat
weixin://dl/moments - to open user moements
weixin://dl/profile - to open user profile
weixin://dl/settings - to open settings page

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.

Processing incoming APP link Titanium Studio Iphone

I'm using Titanium's facebook module to show a apprequests dialog. I could send application request and when I get into the facebook app and hit the notification, I could get into my app.
But, how do I process the incoming URL? I went through the link Deep link with requests
that shows how to do it with Objective C. Any help on how to implement it with Titanium Studio would be appreciated. Thanks.
You can get the arguments with this snippet :
var cmd = Ti.App.getArguments();
if ( (getTypeOf(cmd) == 'object') && cmd.hasOwnProperty('url') ) {
Ti.App.launchURL = cmd.url;
Ti.API.info( 'Launched with url = ' + Ti.App.launchURL );
}
this is called the URLScheme, if you are looking for online docs!
Source: http://developer.appcelerator.com/question/120393/custom-url-scheme---iphone--android