Hyperlink That Sends an SMS Message
With a bit of HTML, it’s possible to create a hyperlink that sends an SMS message. You can even prepopulate the SMS body text via the link! Here’s how.
Sending SMS Texts from a Link
Links need no introduction. They’re everywhere on the internet, literally. In HTML, links are defined with the <a> tag. They also contain an href attribute that specifies where the link should, well, link to. Many developers know that they can launch an email using “href=”mailto:someone@example.com.” You can also start a phone call using “href=”tel:+1954123555.” But few people know that you can launch the SMS app on your website visitors’ phones with an HTML link. This is perfect for starting conversations with your customers, especially when you consider that you can add a Click to Text link to more than just text.
Add Click to Text to the following places, or anywhere you may include an HTML link:
- Your site’s drop-down menu or main navigation
- Your contact page
- Images
- Call to Action text
- Buttons
- Email signatures
It only take a couple of minutes to create an HTML link that sends a text. And you can even pre-populate the SMS body text via the HTML link. Here’s how:
1. Write Your Link Text
This is the text that your website visitors will read and click on. Keep it simple, and be sure to make it clear what will happen when they click. For example, “Click here to send us a text.”
2. Write Your Default SMS Message
When visitors click on your link, their SMS app will be launched with a pre-written message. Consider who your users are, what they’re looking for, and why they’re communicating with you. Then go ahead and write your default message. A restaurant, for example, may want to use the message, “Hi there, I’d like to place an order for…” Be sure to place your message through a URL encoder.
3. Create Your Hyperlink
Now that you have the link text and SMS message written, it’s time to put the two together. If you’ve ever added an HTML link to your website, the process for creating a Click to Text link is exactly the same. Set up your href attribute like this:
<a href="sms:+18664504185&body=Hi%2520there%252C%2520I%2527d%2520like%2520to%2520place%2520an%2520order%2520for...">Click here to text us!</a>
💡DashSend Tip: Gmail and Outlook strip HREF tags, so in order to circumvent any SMS protocol related speed bumps, try to use an email service like MailChimp!
You can also use this link to generate an HTML Button: https://codepen.io/rkimberlyc/pen/MJjYar