Sending a text in WebDirect on iPhone

Five years ago, I was looking for a way to initiate calls from a hosted WebDirect solution. I searched the web and found an approach that worked: embedding the text, "tel: [phone#]" in a WebViewer, where [phone#] refers to a phone field.

There was a thing that I initially experienced as a bug: when calling a land line, I got the expected behavior of a dialog with the option to place a call, but when calling a mobile number, it brought up a dialog that would let you choose from among options (call, text, facetime, etc.). I quickly saw that this bug was actually something of a feature, in that texting was an option, too!

Now, however, while that option is available still on Android, apparently, it isn't on iPhone. I tried making a separate button for texting, and replacing "tel"in that WebViewer with what I thought would be obvious contenders for the job, like "txt" and "sms". That did not work.

I do think that having separate buttons (and exclusive dialogs) for calling and texting would be better. Any suggestions on how to accomplish this, in particular the texting option? That is, the user clicks on a text icon, and they initiate a text message to that number (but obviously do not yet send it). Alternatively, if that isn't possible, making the old way work again on iPhones (i.e. click on phone icon and if mobile one gets the choice of phone, text, etc.)

My preference is for a solution within FileMaker itself, if possible.

Thank you,

Jim Schliestett

1 Like

No reply, so... how about if I simply ask how to send a text on a hosted webdirect solution? Assume the record they are in has a mobile phone number.

You can use a 3rd party SMS plugin, or, if you collect the carrier name for the phone number, the number, followed by @ carrier.text.domain, you can text them directly.
US Cell Providers SMS.fmp12 (192 KB)

Have you searched for apple url schemes? I thought “sms://“ or something similar was among them.

It works for "tel:"
tel
... but not for "sms:"
sms

I was hopin'... but it's nope-n'...

(and I did try "sms://" also, per your suggestion)

Hmm... I imagine there is a table of area code + exchange that would definitively identify the carrier. Like, where I live in area code 207, 475-XXXX is AT&T only, as far as I know. I would think that is generally true... ? I'll look into it.

As for plugins... if there is a nice server-based plugin that would neatly handle both calls and texts- and as a bonus facilitate handling the grabbing of text from a template for the sms- I'd be foolish not to go for it! (Already users have templates for email, because that goes out directly through FMP.)

That's a Mac OS message. Did you try selecting Messages.app using "Choose Application..."?

Not sure how "Choose Application..." would apply, as it is just text in a webviewer that creates a clickable link:

"data:text/html, <a href="sms:"&Filter(Substitute(Contacts::g_cell;["ext";",,"]; ["x";",,"]);"0123456789-,()")&"">" & Filter(Substitute(Contacts::g_cell;["ext";",,"];["x";",,"]);"0123456789-,()")& ""

The stuff above is exactly what works for phoning, other than the "sms" part being "tel". And it is platform-agnostic, requiring no other software.

Maine (207) has got to have more than one cellular service carrier. I know growing up there, we had crank telephones and later, moved to party lines, at least half the homes had running water and most had electricity, but in today's day and age, Verizon must be a player there too. I don't think you could map an exchange to a carrier exclusively.

360Works, Mandlebrot, and a number of other players, have SMS tools to add into FM.

Yes, Maine has a variety of cell services. When I was growing up (in California, I'm "from away", having only lived here for 26 years), we did not have crank telephones, but my sister and I made crank calls! Party lines... yeah I remember the 80s... :wink:

Moving right along... carriers assign new numbers with specific exchanges, but portability is required. So, looking up a specific carrier by exchange isn't going to work. Collecting carrier info is not going to happen, so... no cheese down that tunnel.

Still hoping to avoid a third-party product, but not ruling it out!

Thank you ever so much, Kirk and Malcolm!

At this point, I am off to find a plugin that can do the job. Of course, if an "endogenous" solution were to manifest, that would be great! But it isn't looking like it.

Plus, what would be to say that Apple mightn't change things again, such that the shiny new solution lost its luster? With a plugin, that becomes someone else's problem to solve.

The sms:// URL scheme is for iOS only.

To send a text on macOS (Messages.app), use:
imessage://8885551212
The phone number must match a [0-9] expression. No spaces, no punctuation, etc.

If you want to programmatically set the message content:
imessage://8885551212&body=hello

3 Likes

thank you so much, at least the first example works (protocol + number)
The second one does not though. Body-tag and message text are handled as part of the number.

Do you have any link to the Apple documentation? From putting "URL scheme imessage macos" into the web search of my choice nothing was thrown up to show the appropriate way to add content to the new message.

nothing better than playing with this stuff but I suppose, most of my customers don't have an AppleID connected to their working environment where they want/can send messages.

This link is a Duck Duck Go search that provides links to a number of sources: https://duckduckgo.com/?q=apple+url+scheme&ia=web

shows the same results I've scanned before:
95% for iOS
imessage nowhere to be listed
no explicit usage of parameters described - can only be concluded from mailto example

The "sms:// URL" scheme may be for iOS only, but sms on iOS is the only thing that I'm looking for, and I have tried both that and just "sms: URL", and neither are working for me, via webviewer.

Ideally, of course, there would be just one expression that would work on both iOS and Android phones. That is what I've been lucky enough to have for years. Even more ideally, one cross-platform expression for texting and a separate cross-platform one for phoning.

Because, ya know... simple is good. (But may not be available...)

... and I found the error... not in using "sms" instead of "tel", but in testing method.
So... sms: etc. works as expected on iPhone. Yay!

Next, for Android.
(My initial search shows that "sms:" should work there, too, but it isn't in my testing so far.)

By the way... I called 360Works about their email plugin, and it would work fine, except the deal killer is that the text message would not appear to come from the actual sender, but from some single company-related address. That is great for appointment reminders and such, but doesn't work as well for person-to-person.

Thanks again y'all... I may even find the "imessage://" thing helpful, if users clamor for texting via their Macs. So far, it's just on phones.

The medium article listed "imessage" didn't it?

Could be a Web Direct thing. I'm able to set the number and the message content from the Safari address bar. You'd have to encode it to handle spaces and such:

imessage://8885551212&body=This%20works%20fine.
Screen Shot 2022-01-05 at 2.28.22 PM

No docs. These are just 'note-to-self' snippets I accumulated over the years. Some of my past solutions had a ton of programmatic SMS stuff in them, but I used Twilio to handle that. Wrote a PHP bot on the receiving end that could respond to replies, even.

Haven't done any FileMaker dev lately. I'm a Swift/SwiftUI + DAPI guy the past few years. I have docs for MFMessageComposeViewController, but that's not gonna be any help.

For others who may arrive here later, looking for URL schemes, I have a bunch of them tacked onto my SwiftFM repo. Look in the filemaker-goodies file.

https://github.com/starsite/SwiftFM/tree/master/filemaker-goodies

1 Like

all the medium articles are about URL schemes in iOS, the only "official" source I found is here:

but that one only lists the "sms" scheme which is iOS only again.
Maybe if I really need it as a feature for a customer I will deepdive into developer.apple.com and try to get more info but for the moment it is OK. I can open iMessage and initiate a new conversation/post/message for a given cellphone number.

The openURL scriptstep does not work with the extended content on my FM install (macOS 10.15.7, FM 19.4.2). I didn't find a syntax to extend the call with a body part in that step.

Bildschirmfoto 2022-01-06 um 07.18.52

this call turns up imessage with this effect

Bildschirmfoto 2022-01-06 um 07.17.18

the body becomes part of the number, I tried different variants with "/+?..." but no success :frowning:

I'll just leave it for now, thank you all for input and help