SmartThings Community

[RELEASE] WhatsApp integration to SmartThings (2-way messaging)


#1

Not so much of a RELEASE to be honest, as there is no smartapp or DTH to install. All the information is pretty much out there. More of a simple tutorial :slight_smile:

Getting an integration between WhatsApp and SmartThings was something i have been looking for. The main purpose for this was to get a message whenever the last person leaves the home, to get a whatsapp message notifying if there are any lights or switches left on and with a reply, it can then turn it off.

Another main use was to send a “Status” message and get feedback about my house that i feel is important like the current weather at home, light and switches that were on, who was at home, etc. This integration helps me with this.

This was always doable on the ST app…but for me, the app is just so laggy hence messaging is so much more easier - that way i don’t have to stare at the phone while the app refreshes.

The steps are generally very simple to follow. And if you have been using webCoRe, this gets even more simpler. There are quite a few steps, but pretty easy and straight forward. The best part is that there is no SmartApp or DTH to install!

I’ve written a detailed walk through on how to get this done over on my blog:-

Hope this is useful for you and do share you use cases for this :slight_smile:

Here’s an example of how to do the Web Request and the variables needed to make it work. The full URL is https://api.twilio.com/2010-04-01/Accounts/twilioAccountSID/Messages.json, you can get your Twilio Account SID on your Twilio dashboard under “Settings”.


(www.smartukhome.co.uk) #2

as we can only have one piston linked have you got pistons that already work around this? Or we got to wait till some non lazy person does it for us :rofl:


(Ron Talley) #3

This is cool! I can see how it would be beneficial to a lot of people. I don’t interact much with my SmartHome now-a-days as I have tried to automate everything that I possibly could. Stuff just works without Human interaction.

However, there are times where I might get a nag message that I just want to simply ignore. I can see how this could help.

For example,

If TV is on and motion stays inactive for 10 minutes then send message, “Turning off TV in 5 minutes. To cancel, reply no. To turn it off now, reply yes.”

Or

“Study automation has been off for 4 hours. Should I turn it back on?”

Oh yeah, I am going to be using this!

Thanks.


#4

Here’s my piston. It has these commands:-

Off - will turn all lights and switches off.
Status - weather over at my house and who is at home
Sleeping - check who is sleeping (working with webCoRe presence sensor)
Wake up $name - wakes the sleeping person up (as sometimes my son forgets to activate his wake up automation).

The piston also sends a message to whoever leaves the house about the lights/switches that are still on.


#5

Cool…i like that TV use case, will definitely add that into my piston!!


(www.smartukhome.co.uk) #6

OMG I can get it to finally do
You look like your on your way home do you want me to turn the heating on?


(www.smartukhome.co.uk) #7

@kayvint

I cant get the test pistons to work, I’m confused as what the POST request URL is supposed to be


#8

What goes in “Make a POST request to”


#9

The URL should be

https://api.twilio.com/2010-04-01/Accounts/twilioAccountSID/Messages.json

You can get the Account SID on your twilio dashboard under settings.


#10

Sorry…accidentally removed the URL from the post. Have added it back. The URL is:-

https://api.twilio.com/2010-04-01/Accounts/twilioAccountSID/Messages.json

Where your twilio account SID can be found on your twilio dashboard under Settings.


(www.smartukhome.co.uk) #11

Here’s what I have been working on its not finished yet but may help people have ideas

Examples



(www.smartukhome.co.uk) #12

The limitation of the service is making this not as useful as first thought

A WhatsApp session begins with a user initiated message to your app. Sessions are valid for 24 hours after the most recently received message, during which time you can communicate with them using free form messages. In order to send a message outside the 24 hour Session window, you must use a pre-approved template (see Sending Notifications section above).

So unless I remember to send a message in the morning I don’t get a notification to ask if I want to turn the heating on :disappointed:


#13

That is right. To get around this, what i do is have a “keep-alive” message sent everyday at a specific time using webCoRE.


(www.smartukhome.co.uk) #14

Every 23 hours?


#15

I have mine setup to send a message everyday at 11pm. Every 23 hours should also work.


(www.smartukhome.co.uk) #16

Is that enough or do you have to reply to the message?


#17

Good point. How I am doing it is that I run my goodnight routine using ‘Shortcuts’ on iOS. It’s mainly to interact with stuff that is not connected to ST. The last step in that is to send a WhatsApp message to twilio.

Not too sure if just receiving messages would keep the ‘conversation’ alive or not.


(Bart Bogaerts) #18

Can you please share how you send the automated “keep-alive” message from webCore? Are you using the Twilio number as the To number and your own number as the From? That doesn’t work for me. Any guidance will be appreciated.


(www.smartukhome.co.uk) #19

You need do send a message from your phone
iOS use “shortcuts” can’t help you if that though
Android use “AutoResponder WA”
Make WebCoRE send a message “Keep Alive Message” Every 24 hours
Setup a rule in AutoResponder WA to reply to that message I used “Keep Alive Reply”


I then made WebCoRE look out for that message and reply with “Message Received”


(Bart Bogaerts) #20

OK, that make perfect sense. Thanks will try that!