OAuth and Notifications

Since wiring Tasker on Android to speak my SmartThings notifications I have become somewhat of a notification junkie, writing a number of SmartApps that handle regular daily and weekly reminders.

So now I am trying to find a way for my Mac (which is currently using iChat to send SMS) to send me SmartThings notifications. Currently the Mac uses OAuth endpoints to control some of my SmartThings, and I am wondering if this method could be used to connect to some form of virtual device for the purpose of sending notifications.

Any thoughts?

I will be writing something similar next week. I will share the code.



Hi there, here is the SmartApp that allows you to trigger push notifications via REST API.

  1. Create a new SmartApp in the IDE with Aouth enabled
  2. Paste the code from here
  3. Obtain End Point URL by following steps 5-9
  4. Trigger push notifications with URL below:
  5. PUSH_MESSAGE can be any text except ‘/’ and ‘?’ characters, if used via browser. URL encoding is required for other purposes.

Enjoy and let me know if you need any help!


1 Like

Thanks Alex,

Unfortunately I need plenty of it…

Firstly… in step 6…

Set … the redirect_uri to a location you have setup to handle these OAuth 2 requests.

What location?



At step 6, use the sample URL from documentation as is and replace “myclient” with your client id. Client id could be found when you view properties of the SmartApp that you created in step 1.


1 Like

Thanks again Alex…

Got my code, then my access token…

“access_token”: “blahBlahBlah”,
“expires_in”: 1576799999,
“scope”: “app”,
“token_type”: “bearer”

Plug everything into the URL you supplied and I get:

{“error”:true,“type”:“AccessDenied”,“message”:“This request is not authorized by the specified access token”}

Maybe I am not clear on what should replace ‘App_ID’?

When you get through step #8, it will return a url like this

“url”: “/api/smartapps/installations/8a2aa0cd3df1a718013df1ca2e3f000c”

AppId is the sequence of characters after “installations/”.

You are almost there!

1 Like

Good Lord… thank you for this!

Why are you using smartThings for Push notifications? I Don’t understand how that is better than using growl. I’m not saying your project doesn’t have merritt, I just feel like I am missing some benefit of doing it via smartThings.

Two reasons. The first being the current version of Growl for Android is not compatible with Growl on Snow Leopard (go figure), and that is what my server is running.

Second… if you’re not already using growl, why run another background service on your phone when you already have one (SmartThings) that will handle it?

1 Like

Alex, I hate to pull up a months old topic, but I am stuck at step 8. I have completed step 7 and I am not sure how to do the next part. The other steps were just entering in url data, but I am stuck figuring out how to get through step 8.

Once you obtain the token in step 7, make a call (enter in address bar f.e.) to this URL


That’s just one way of doing this.

Thanks Alex. That method worked to get the step 8 info.

I’m getting a 500 error that seems to be coming from the redirect

Oh No! Something Went Wrong!

500: Internal Server Error
Reference Id
Thu Jan 08 16:44:57 UTC 2015
Cannot get property ‘scope’ on null object

I’m basically just doing a GET using my client id and using the default oauth redirect handler from SmartThings

Here is my URI


Any idea what might be going wrong

I suggest taking out the “%” and alphanumerics around the words.after “https” and replace them with they designated symbols.

It should look like this after the "redirect_uri="

“%3A” = “:” and “%2F” = “/”

Version posted did not translate well when it was copy/paste from the original source. It took me a bit to realize the error once I really looked at the URL.

Hi guys. I;m trying to do the same thing, but I don’t see where the Endpoint IDs are obtained; that is, the specific device IDs.

I get to the point of calling:


And I receive the INSTALLATION_ID in the URL in the JSON:


So all good there.But in the walk-through, this is step 9:

PUT /api/smartapps/installations/INSTALLATION_ID/switches/8a818a9b39c0de7f0139c0dff1290073

Where is that GUID at the end obtained? That’s a specific switch ID, and I am not seeing that in any of my responses.


I thought as much, I needed to include a listSwitches() routine. But none of the examples I found had any code for this, and as I am new to groovy and ST, I had no idea where to start.

Eventually I found https://gist.github.com/aurman/9813279

And I included this code:

def listSwitches() {

private show(devices, type) {
	def device = devices.find { it.id == params.id }
	if (!device) {
		httpError(404, "Device not found")
	else {
		def attributeName = type == "motionSensor" ? "motion" : type
		def s = device.currentState(attributeName)
		[id: device.id, label: device.displayName, value: s?.value, unitTime: s?.date?.time, type: type]
private device(it, type) {
	it ? [id: it.id, label: it.label, type: type] : null

Which returns a JSON object with all the switch GUIDs you could hope for.

Thank you!

This page isn’t available anymore… Alex’s Step 3


Try this

Web Services - Authorization