First Smartapp, trying to get IFTTT webhook to call it's API


(Phi) #1

Hello, I’m a newb at writing SmartApps but very encouraged with how easy it was to get started in. I’ve written a Smartapp to control a virtual (simulated) motion sensor I have. The end game is to get IFTTT to send a web request to SmartThings (and subsequently my app) after a trigger, and wait a set number of minutes for inactivity. I’ve got the Smart app working fine, and when I created the authorization, I was able to run the following from a shell and have it work as expected:

curl -H “Authorization: Bearer d6149000-c4c6-42af-85d-e5082c872” -X PUT “https://graph-na04-useast2.api.smartthings.com/api/smartapps/installations/d2345f32-4a****-aba0-f0c046b38a41/motion/motion

So in IFTTT, I have a webhook that is a PUT request,
URL: https://graph-na04-useast2.api.smartthings.com/api/smartapps/installations/d2345f32-4a****-aba0-f0c046b38a41/motion/motion
Type: Application/json
Body: -H “Authorization: Bearer d6149000-c4c6-42af-85d-e5082c872”

That gives me a 401 error. Trying the same in Postman gives me back:

{
“error”: “unauthorized”,
“error_description”: “Full authentication is required to access this resource”
}

Can anyone help me create the right URL for an IFTTT webhook to send to my ST Smartapp? Appreciate any help!

Phi


(Phi) #2

Or if anyone has a tutorial they can send my way that would be great. I’ve walked through the SmartThings Developer Docs example, and this is where I am at now.

Thanks!
Phi


(Tyler Durden) #3

I did a quick google search and it looks like the ifttt maker webhook doesn’t allow you to pass custom header data. You may want to read the last post in this thread and try adding your token to the beggining of the url.