4

What I would like to do is pre populate an SMS similar to how you can populate the subject line of an email with ?subject on mailto: links.

I don't want to automatically send the SMS, or the recipients, just the copy (which the user could edit). From what I've read it looks like sms: only allows by specifying the recipients, or nothing at all.

Can this be done with sms:? Or does it require native code (for iOS/Android)?

brendo
  • 2,914
  • 1
  • 19
  • 22

2 Answers2

3

The answer to this question is now yes. This:

sms://+19875550198;?&body=This%20is%20a%20test%20message.

works just fine in Messages on both iOS and macOS. Copy and paste that link into your browser to test it on your system. I haven't tested this on other systems, but based on this answer, ;?& seems useful for cross-device compatibility.

An example of how we're using this can be seen in this answer. Unfortunately I couldn't figure out a way to populate the optional subject field in iOS.

Vincent
  • 2,689
  • 3
  • 24
  • 40
2

Short answer: No.

Although this would be helpful for web developers, neither Android nor iOS allows this to be done through urls.

Apple has a list of recognized url schemes here.

If you're developing an app with phonegap however, this can be done programmatically using plugins like SMSComposer for iOS and SMSPlugin for Android.

Scorpius
  • 999
  • 1
  • 10
  • 22