Send free SMS messages via IFTTT

I’d like to thank @shellian_systems whose post Free SMS notifications via MQTT inspired me to explore IFTTT as a means of sending free SMS messages.

OVERVIEW

  • In IFTTT, create an applet that, when triggered by a REST command, sends the received message, via SMS, to a preset telephone number.
  • In Home Assistant, use the RESTful_command component to send a message to IFTTT.

INSTRUCTIONS

STEP 1: Create an applet in IFTTT that sends an SMS message when triggered via a URL.

  • In IFTTT’s main menu (upper right-hand side), select New Applet.
  • Click This in “IfThisThenThat”.
  • For “Choose a Service”, enter Webhooks and click it.
  • For “Choose Trigger”, click Receive a web request.
  • For “Complete Trigger Fields”, enter send_sms for Eventname.
  • Click Create Trigger.
  • Click That in “IfThisThenThat”.
  • For “Choose an Action Service”, enter SMS. Click it.
  • You’ll be taken through an SMS setup procedure. Enter your telephone number. You’ll receive a PIN code via SMS. Reply with the PIN to confirm your phone number.
  • For “Choose Action”, click Send me an SMS.
  • For “Message” replace everything written in the box with {{Value1}}.
  • Click Create Action.
  • Click Finish.

STEP 2: Record your IFTTT Webhooks authorization code.

  • In IFTTT’s main menu (upper right-hand side), select Services.
  • Enter Webhooks. Click it.
  • Click Settings.
  • Copy the authorization code at the end of URL. https://maker.ifttt.com/use/XYZ123ABC

STEP 3: Paste your personal code in secrets.yaml.

# Replace XYZ123ABC with your personal IFTTT Webhooks authorization code
ifttt_send_sms: 'https://maker.ifttt.com/trigger/send_sms/with/key/XYZ123ABC'

NOTE: The word “send_sms” in this URL must match the word used for EventName when you created the applet.

STEP 4: Create a rest_command, called send_sms, in configuration.yaml:

rest_command:
  send_sms:
    url: !secret ifttt_send_sms
    method: POST
    headers: 
      accept: 'application/json'
    payload: '{ "value1": "{{ sms_text }}" }'
    content_type:  'application/json; charset=utf-8'

Done! Restart Home Assistant and now you have a new service called rest_command.send_sms.

USAGE

Here’s a simple script demonstrating how to use it:

In scripts.yaml:

  test_sms:
    alias: Send SMS test message
    sequence:
      - service: rest_command.send_sms
        data:
          sms_text: "Hello world!"

Restart Home Assistant and “Send SMS test message” will appear in the Frontend UI. Click EXECUTE to send the “Hello world!” message.

IFTTT currently allows for 100 SMS messages per month in the USA and Canada (elsewhere it’s 10 per month).

EDIT
Well, I feel foolish! Effectively, I’ve “discovered” something that already exists! https://www.home-assistant.io/components/ifttt/ Oh well, just another way to accomplish the same thing. My way is a bit more tailored for a specific purpose whereas the IFTTT component is more of a generalist. Nonetheless, it was a good learning experience for me.

4 Likes

Thanks for writing up this method. I actually prefer this to the existing component, since that component requires my HA instance to be accessible from the web. I prefer not to expose my instance.

I’m with you, Jefe. I’m not comfortable opening up my HA api to the outside world, or any ports for that matter!

As @123 wrote, IFTTT opens up a lot of functionality with it’s webhooks services as well but those are one way…from your HA out to IFTTT. I like the two way abilities offered by bridging MQTT to Adafruit without opening up any ports. For example, if you have a Google Home, or even Google Assistant on your android device, and you link them to the same gmail account as you use to create your IFTTT account, then you can set up a Google Assistant service on IFTTT to listen for virtually any command you give to your Google Home and IFTTT can then trigger an mqtt post to a topic on Adafruit. If you’re internal mqtt broker is bridged with Adafruit, then whatever command or parameter sent from IFTTT is now in your internal mqtt broker and your HA can respond with scripts, automatons, whatever. It’s virtually unlimited.

For example, I use a few mqtt based switches in my home. I can control any of them with my Google Home devices with voice commands. Google Home -> IFTTT -> Adafruit -> My HA Platform and they seem to be consistently reliable and super fast.

Cheers,
Brian

1 Like

Thank you Brian. This gives me a lot of new territory to explore. Am looking forward to it. :slightly_smiling_face:

alias: Send SMS test message
sequence:
  - service: rest_command.send_sms
    data:
      sms_text: "Hello world!"

Could you kindly show how to include a variable along with the sms text? I tried:
sms_text: “Version {{ states.sensor.hassio_version.state }} is available!”

but it sends it strictly as text.

Thanks.

Replace data: with data_template:.

This worked for me:

  test_sms:
    alias: Send SMS test message
    sequence:
      - service: rest_command.send_sms
        data_template:
          sms_text: "Indoor temperature is {{states.sensor.indoor_temperature.state}} C"

The received SMS message:

Home%20Assistant%20-%20SMS%20Test

1 Like

Thanks so much! I will try that.

Not working now.

“Applets created using the New Applet tool will no longer provide SMS as a trigger or an action.”

I’ve been using this for alarm system as an extra notification. But got email from ifttt yesterday that sms isn’t working anymore. I was very grateful for this sms service you made, thank you, but now it isn’t working at all. Is it possible to get it working again? Any free alternatives?

I’m also affected by the discontinuation of IFTTT’s free SMS service. I’m not aware of any free alternatives.

This is working for me, but I chose the “Android SMS” service. The messages take over a minute to be received. (At least today)

Why does Android SMS indicate:

This service requires the IFTTT app for Android

So if the phone is not equipped with the IFTTT app it cannot receive Android SMS messages?

I think it use android phone to send out SMS, carrier charge will be applied

That won’t work for me because I need Home Assistant to be able to send an SMS directly and not use my phone as a relay to send the message.

The SMS service not working without internet when I turn my mobiledata/wifi off the SMS not receiving on my phone