Sending sms in air with body - actionscript-3

I was searching to how to send a sms in air. I found this code while googling:
var callURL:String="sms:0-123-456-7890";
var targetURL:URLRequest = new URLRequest(callURL);
navigateToURL(targetURL);
Its working, but how to add a body text to it and can it be used to send sms to multiple numbers???

Here's link to standarts of using URI schemes https://www.rfc-editor.org/rfc/rfc5724#section-2.2.
But unfortunately looks like there is no way to implement this since neither iOS nor Android supports this feature in full way.
Here's link for Android ussue about it http://code.google.com/p/android/issues/detail?id=12142
And here's answer on SO about iOS sms url scheme not working on IOS5

Related

Whatsapp Click-to-Chat "Couldn't open link" Error Chrome Android/iPhone

I'm using Whatsapp Click-to-chat functionality, without a phone number. It previously worked but with the new Chrome version 76.0.3809.132, both on iOS and Android is not working anymore. On Android, it's showing a Toast with Couldn't open link. Tried contacting Whatsapp Support but no answer as of yet. With the latest update their own documentation example is not working, link to docs. Any suggestions or experiences?
Link example:
<a target="_blank" href="https://wa.me/?text=Villa%20stone%20road%20piece%2015%20meters%20from%20the%20asphalt%20street" title="Share on WhatsApp">
Error picture Imgur: picture
A table with my tested devices and versions on Imgur
If you use https://api.whatsapp.com/send instead of https://wa.me/ you don't need to specify a phone number.
e.g
https://api.whatsapp.com/send?text=Your%20Custom%20Text
It seems that chrome does not accept click to chat without a number specified. Once there's a number in the URL it works just fine.
Unfortunately I did not find a hack to get around it. Neither of this worked:
https://wa.me//?text=Hello%20World
https://wa.me/0/?text=Hello%20World
only if a proper number is specified it will open WhatsApp, but has the recipient already pre selected (the number we provide).
I tested it for a client about 2 weeks ago, when it still worked. So the last update of Chrome (from Aug 26) seems to be the problem...
The best is to use the custom url scheme format. Universal links do not work well with native clients
whatsapp://send/?phone=&text&source&data
It will work without phone number also.
My issue on a recent breaking-change: Universal links stopped working
There was a great blog post about the issue, however it is already outdated and proposes a php specific solution (nevertheless might gives you a good idea, how to think about the problem)
const text = "Hello..."
const phoneNumber = "23400000000000"
Linking.openURL(`whatsapp://send?text=${text}&phone=${phoneNumber}`)
First: Official Whatsapp Sharing Documentation. One of the following URLs is recommended for WEB use...
https://api.whatsapp.com/send?text=YourShareTextHere
https://api.whatsapp.com/send?text=YourShareTextHere&phone=123
And these for MOBILE use...
whatsapp://send?text=YourShareTextHere
whatsapp://send?text=YourShareTextHere&phone=123
If you are interested in watching a project that keeps track of these URLs, then check us out!: https://github.com/bradvin/social-share-urls#whatsapp

Objective C - Launch app after tapping link on email

im trying to launch my app when user taps on link on email .. i've seen many posts like this but i can't seem to get it to work .. there's a problem i've been encountering, if the link i send is https://www.google.com (or any other valid websites), when i tap on the link, it works. It launches safari then goes to the site.. but if i replace it with my urlScheme, the body in the email appears to be not read as a link .. by the way.. im creating the email message in the client side .. here is sample code..
Nsstring *htmlBodyWebsite = #“<a href=\”https://www.google.com\”>Click here</a>" < working
Nsstring *htmlBodyUrlScheme = #“<a href=\”myApp://\”>Click here</a>" <not working
// when i enter in safari browser - myApp:// << working
so it seems that i've setup urlscheme correctly since when i entered myApp:// in safari, it prompted me to launch my app.
so the process here is, i create the email message in the client side... then our server receives it and sends it via email to target recipient..
now when the recipient receives the email, here are some observations i've made..
when i send htmlBodyWebsite, it works fine. Using google chrome browser and in the email message itself, when i right click, then inspect, i would be able to find the referenced link with proper tagging
but with htmlBodyUrlScheme it doesn't have proper html tagging
thanks
it seems to work if i tap on the link using the ios built-in Mail app.. neither using safari to open gmail.com nor gmail app doesnt make it resolve this issue..

Does the Win 10 UWP EmailMessage API support having an HTML body?

I have tried the following code to send an email from an Universal Windows Platform app. It works fine when I use EmailMessageBodyKind::PlainText. However, as indicated in the code below, EmailMessageBodyKind::Html seems to launch the email client with no content. Does anyone know what else needs to be set to get this to work - the documentation is sparse 8 (
using namespace Windows::Storage::Streams;
using namespace Windows::ApplicationModel::Email;
using namespace Windows::Security::Cryptography;
auto bin = CryptographicBuffer::ConvertStringToBinary(
L"<html><body>this <b>is</b> text</body></html>",
BinaryStringEncoding::Utf16LE);
auto memStream = ref new InMemoryRandomAccessStream();
concurrency::create_task(memStream->WriteAsync(bin)).then(
[memStream](unsigned)
{
auto email = ref new EmailMessage();
email->To->Append(ref new EmailRecipient(L"test#gmail.com"));
email->Subject = L"Email Report";
auto randomAccessStreamReference = RandomAccessStreamReference::CreateFromStream(memStream);
email->SetBodyStream(EmailMessageBodyKind::Html, randomAccessStreamReference);
EmailManager::ShowComposeNewEmailAsync(email);
}
);
Well, I got some bad news for you.
It is not possible to do so using EmailManager.ShowComposeNewEmailAsync
Regarding using SetBodyStream with EmailMessageBodyKind.Html, we have this from MSDN forum:
Currently, the EmailMessageBodyKind.Html won't work for create a new
HTML e-mail and there is no other way as a workaround, I've checked
the internal resource, this API is used for populating messages from
App server and save e-mail message into local folder.
The thing is: EmailManager.ShowComposeNewEmailAsync uses mailto to send the message and, as stated in some other question already answered here:
Section 2 of RFC 2368 says that the body field is supposed to be in
text/plain format, so you can't do HTML.
However even if you use plain text it's possible that some modern mail
clients would render the resulting link as a clickable link anyway,
though.
That being said, you're relying on the mail client to render that HTML for you.
I've tested this using Windows 10 Mail Client, Gmail and Outlook (both the later on a web browser), and all of them failed to render a simple HTML <b> tag on the mail body, showing it as plain text instead.
Now, for the alternatives (from that same MSDN forum thread):
Note that if I use the ShareDataContract (DataTransferManager), I am
able to set the HTML in the request and it will appear in the email
body if the user chooses to share via Mail. However I would like to
skip the Share UI and go directly with composing an email with
recipient already populated, HTML body, and image attachments.
One alternative is to persist the HTML body to a file and then include
that file as an additional attachment, however that is not ideal
The DataTransferManager successfully formatted the HTML message. Here's a small sample of how your sample code would look like, adapted from MSDN:
void YourView::ShareHtml()
{
DataTransferManager^ dataTransferManager = DataTransferManager::GetForCurrentView();
auto dataRequestedToken = dataTransferManager->DataRequested +=
ref new TypedEventHandler<DataTransferManager^, DataRequestedEventArgs^>(
this, &YourView::OnShareHtml);
DataTransferManager::ShowShareUI();
}
void YourView::OnShareHtml(DataTransferManager^ sender, DataRequestedEventArgs^ e)
{
DataRequest^ request = e->Request;
request->Data->Properties->Title = "Email Report";
String^ html = L"<html><body>this <b>is</b> text</body></html>";
String^ htmlFormat = HtmlFormatHelper::CreateHtmlFormat(html);
request->Data->SetHtmlFormat(htmlFormat);
}
The limitations of this approach are:
You cannot force the user to select e-mail as the sharing option
You cannot previously specify the mail recipient.

Share a link via URL scheme to Telegram

I want to share a link via URL scheme for Telegram.
I have created this:
tg://msg?text = www.example.com?t=12
The link, opens telegram but nothing else happens.
I have used the same code for Viber, and it works:
viber://forward?text = www.example.com?t=12
And it opens a new message in Viber with this text:
www.example.com
In the other words, it cuts my URL.
Any ideas?
You can also use telegram.me share link which falls back to webogram if a telegram app is not installed on the device.
https://telegram.me/share/url?url=<URL>&text=<TEXT>
This works with me:
tg://msg?text=Mi_mensaje&to=+1555999
You have the following options for a URL...
https://t.me/share/url?url={url}&text={text}
https://telegram.me/share/url?url={url}&text={text}
tg://msg_url?url={url}&text={text}
In case you want to confirm, here is the official API source: Core.Telegram.org: Widgets -> Sharing Button.
If you are interested in watching a project that keeps track of these URLs, then check us out!: https://github.com/bradvin/social-share-urls#telegramme
You can use the link telegram.me which will provide a preview page with an alert requesting to open the link in the application.
https://telegram.me/share/url?url=<URL>&text=<TEXT>
The second option is calling the application link directly:
tg://msg_url?url=<url>&text=<encoded-text>
I particularly prefer the second option, which also works on desktop applications.
For Telegram share:
Objective C:
if([UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"tg://msg?text=test"]){
[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tg://msg?text=test"]
}else{
//App not installed.
}
Swift 3.0:
let urlString = "tg://msg?text=test"
let tgUrl = URL.init(string:urlString.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlQueryAllowed)!)
if UIApplication.shared.canOpenURL(tgUrl!)
{
UIApplication.shared.openURL(tgUrl!)
}else
{
//App not installed.
}
If you have used canOpenURL, then need to add in info.plist
<key>LSApplicationQueriesSchemes</key>
<array>
<string>tg</string>
</array>
PHP
Link
JavaScript
<script>TEXT="any text or url";</script>
<a onclick="window.location='tg://msg?text='+encodeURIComponent(TEXT);">Link</a>
Telegram
with this we can open xdg of telegram and if we select contact , by default sending text will come in message field.
Maybe you use localhost therefore it does not show share. try it in live host
To check if the Telegram is installed you can do the following (borrowed from the Whatsapp sharer module of ShareKit):
BOOL isTelegramInstalled = [[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"tg://msg?text=test"]];
iOS checks if there's any app installed which can handle the tg:// scheme, which is Telegram.
Try using tg://share:
Link
Just tested, this way it works both opening telegram app or browser in case it's not installed:
let webURL = NSURL(string: "https://t.me/<YOUR ID>")!
UIApplication.shared.open(webURL as URL)
Your have two problems:
On one hand you are using the wrong scheme for sharing URLs, the correct one is msg_url;
On the other hand you are trying to share a URL with parameters. You need to encode your ? in order to make it work. The percent code is %3F
Extra Tip: Also if you want it to be a link once shared you should include the HTTPS:// encoded of course.
Try this and you'll see it works fine: tg://msg_url?url=https%3A%2F%2Fwww.example.com%3Ft=12
If you want to open chat with bot or people, just write this simple code
<a href="https://t.me/targetedusername">
You should stop using the protocol for the desktop applications because it does not work on the evolving web: it does not work on Web apps, ChromeOS, or some mobile devices.
Always use the NEW way: https://t.me because it will open the Telegram DESKTOP app in Windows\Linux\Mac IF THE USER WANTS\HAS it, otherwise it will open the WEB page\web app which is THE WAY.
https://web.telegram.org/k
https://web.telegram.org/z
Telegram has TWO web apps that have been building out for the past year!
Both are great, adding TONs of parity, and have different approaches.

How to pre-populate the sms body text via an html link

How to use an html link to open the sms app with a pre-filled body?
Everything I have read seems to indicate that sms:18005555555?body=bodyTextHere
Should work, but on the iPhone, this doesn't work. If I take out the ?body=bodyTextHere, and just use sms:phonenumber, it works.
I have seen several instances where QR codes do this through a safari link. How are they able to pre-populate the body text?
It turns out this is 100% possible, though a little hacky.
If you want it to work on Android you need to use this format:
Link
If you want it to work on iOS, you need this:
Link
Live demo here: http://bradorego.com/test/sms.html (note the "Phone and ?body" and "Phone and ;body" should autofill both the to: field and the body text. View the source for more info)
UPDATE:
Apparently iOS8 had to go and change things on us, so thanks to some of the other commenters/responders, there's a new style for iOS:
Link
(phone number is optional)
I know this is an old thread but stumbled upon it and found that some parts are no longer relevant.
I've found that if you want to just per-populate the text without adding a phone number, you can do the following:
sms:?&body=/* message body here */
For iOS 8, try this:
Link
Switching the ";" with a "&" worked for me.
Just put all of the symbols in this order (I only tested it in this order since it makes the most sense code-wise to me).
Notice for the body link... I just put... ;?&body=. Also, notice that I have found I needed to use %20 for any spaces.
I have tested it on my iphone (v. 9.2) and another android and it works just fine.
This will solve the issue with having to hack it for different devices. I have no artifacts when I tested it in the SMS.
Send me SMS
There is not need for two separate anchor tags for Android and iOS.
This should help.
// Without Contact Number
Text Message
// With Contact Number
Text Message
// Works on both Android and iOS
Android and iOS body only:
Only body
Android and iOS one recipient only with body:
one recipient only with body
Only Android multiple recipients with body:
Android multiple recipients with body
Only iOS multiple recipients with body:
iOS multiple recipients with body
Note that the body should be URI encoded.
We found a proposed method and tested:
Send SMS
Here are the results:
iPhone4 - fault (empty body of message);
Nokia N8 - ok (body of message - "Hello my friend", To
"12345678");
HTC Mozart - fault (message "unsupported page" (after click on the
"Send sms" link));
HTC Desire - fault (message "Invalid recipients(s):
<12345678?body=Hellomyfriend>"(after click on the "Send sms" link)).
I therefore conclude it doesn't really work - with this method at least.
For those wanting a solution that works in 2022 I set up a small web app that just uses the correct format for iOS, macOS, and Android automatically.
https://copy.gives/18005555555?body=Body+text+here
The issue in 2022 is that on iOS you * must * use double slashes as well as /&
So the respective working URLs are the following
sms://18005555555/&body=Body%20text%20here - iOS and macOS
sms://18005555555/?body=Body%20text%20here - Android
Notice the /& for Apple devices and /? for Android
You can try some working examples here(doesn't work embedded):
https://jsfiddle.net/thatguysam/swLtjh0q/
To get sms: and mailto: links to work on both iPhone and Android, without any javascript, try this:
click to text
click to email
I tested it on Chrome for Android & iPhone, and Safari on iPhone.
They all worked as expected.
They worked without the phone number or email address as well.
For using Android you use below code
<a href="sms:+32665?body=reg fb1>Send SMS</a>
For iOS you can use below code
<a href="sms:+32665&body=reg fb1>Send SMS</a>
below code working for both iOs and Android
<a href="sms:+32665?&body=reg fb1>Send SMS</a>
Bradorego's solution is what worked for me, but here is a more expanded answer.
A small consideration is that you need to encode the body using %20 instead of +. For PHP, this means using rawurlencode($body) instead of urlencode($body). Otherwise you'll see plus signs in the message on old versions of iOS, instead of spaces.
Here is a jQuery function which will refit your SMS links for iOS devices. Android/other devices should work normally and won't execute the code.
HTML:
SMS "Hello World" to 555-123-1234
jQuery:
(function() {
if ( !navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ) return;
jQuery('a[href^="sms:"]').attr('href', function() {
// Convert: sms:+000?body=example
// To iOS: sms:+000;body=example (semicolon, not question mark)
return jQuery(this).attr('href').replace(/sms:(\+?([0-9]*))?\?/, 'sms:$1;');
});
})();
Consider using a class like a.sms-link instead of a[href^="sms:"] if possible.
<a href="###" data-telno="13800000000" data-smscontent="hello" class="XXXXX XXXXXX XXXXXX sendsms"/>
$('.sendsms').on('click', function(){
var p = $(this).data('telno'),
c = $(this).data('smscontent'),
t = ';';
if (!ios) { // add your own iOS check
t = '?';
}
location.href = 'sms:'+ p + t + c;
})
The iPhone doesn't accept any message text, it will only take in the phone number. You can see this here https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/SMSLinks/SMSLinks.html#//apple_ref/doc/uid/TP40007899-CH7-SW1
Link
This works on my iPhone 5S!
I suspect in most applications you won't know who to text, so you only want to fill the text body, not the number. That works as you'd expect by just leaving out the number - here's what the URLs look like in that case:
sms:?body=message
For iOS same thing except with the ;
sms:;body=message
Here's an example of the code I use to set up the SMS:
var ua = navigator.userAgent.toLowerCase();
var url;
if (ua.indexOf("iphone") > -1 || ua.indexOf("ipad") > -1)
url = "sms:;body=" + encodeURIComponent("I'm at " + mapUrl + " # " + pos.Address);
else
url = "sms:?body=" + encodeURIComponent("I'm at " + mapUrl + " # " + pos.Address);
location.href = url;
Well not only do you have to worry about iOS and Android, there's also which android messaging app. Google messaging app for Note 9 and some new galaxys do not open with text, but the samsung app works. The solution seems to be add // after the sms:
so sms://15551235555
Link
should be
Link
(Just a little bit of topic), but maybe if you searched you could stumble here...
In markdown (tested with parsedown and on iOS / android) you could do :
[Link](sms:phone_number,?&body=URL_encoded_body_text)
//[send sms](sms:1234567890;?&body=my%20very%20interesting%20text)
Was struggling with ability to open SMS app with body only message, no recipients on iOS 11+.
None of the solutions above worked for me, it didn't open at all or opened with something pre-populated in recipients (like ';').
Finally I ended up with this syntax for body only:
sms:///?body=Hello%20World
Used up to iOS 14, worked fine!
?body= //for Android
&body= //for iOS
I found out that, on iPhone 4 with IOS 7, you CAN put a body to the SMS only if you set a phone number in the list of contact of the phone.
So the following will work If 0606060606 is part of my contacts:
Send SMS
By the way, on iOS 6 (iPhone 3GS), it's working with just a body :
Send SMS
Every OS version has a different way of doing it. Take a look at the sms-link library
universal link use tel &? body
link ios+android
https://output.jsbin.com/puqicel
link ios+android
link ios+android
One of the problems with a click-to-text link is solving the desktop scenario where no native texting app exists. A solution is to use Zipwhip's Click-to-Text button creator.
On the desktop, they send you an actual real text message behind the scenes from the user's input.
On iOS or Android you get the native texting functionality instead.
https://www.zipwhip.com/create-sms-button/
Neither Android nor iPhones currently support the body copy element in a Tap to SMS hyperlink.
It can be done programmatically though,
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;
picker.recipients = [NSArray arrayWithObject:#"48151623"];
picker.body = #"Body text.";
[self presentModalViewController:picker animated:YES];
[picker release];