Rails 6.1 now
rendering SMS links.
We can use the recently added
sms_to rendering SMS anchor links.
This SMS anchor link when clicked pops open user’s SMS client targetting the specified phone number.
Here are a few ways you can use the
sms_to helper in your Rails views:
We can just pass the phone number. In this case, the phone number is also used as the name of the link.
We can explicitly specify the name of the link.
We can specify the content of the SMS body.
We can also pass a block to the
sms_to helper if we want more control over the content of the rendered SMS anchor tag: