App Registration

You can register either a WebHook or an AWS Lambda function as your Automation or SmartThings Connector.

You can do this via either on the SmartThings Developer Workspace or the SmartThings API.

NOTE

Ensure that your WebHook has an HTTPS URL. You can use free tools such as ngrok or Let’s Encrypt to enable your WebHook with HTTPS (SSL/TLS).

Follow the steps below to register your SmartApp using Developer Workspace.

To register a SmartApp via the SmartThings API, follow the steps below:

Ensure you have a SmartThings account

Obtain a personal access token from SmartThings

  • You will need a personal access token for calling the SmartThings API. Tokens can be obtained on the personal access tokens page. Be sure to authorize permissions to create and read Apps when creating a token.

Register a WebHook

  curl -X POST https://api.smartthings.com/v1/apps \
       -H "Authorization: Bearer " \
       -H "Content-Type: application/json; charset=utf-8" \
       -d $'{"appName": "", "displayName": "", "description": "", "appType": "WEBHOOK_SMART_APP", "webhookSmartApp": {"targetUrl": ""}}'

Important

Make sure to note down the response. You will need it to install your SmartApp.

Whitelist OAuth scopes

Next you must explicitly whitelist OAuth scopes for your SmartApp. See SmartApp token OAuth scopes.


Register an AWS Lambda function

Make a note of the ARN

  • From the Lambda function page on your AWS console, make a note of the ARN for your Lambda function. See here for more on ARNs.
  • For example, for a Lambda function named testuseast1_openlighton the ARN could be of the form arn:aws:lambda:us-east-1:123456789000:function:testuseast1_openlighton.

  • Register the Lambda function. See here for the APPS API.

curl -X POST -H "Authorization: Bearer " -H "Content-Type: application/json" -H "Accept: application/json" -d '{
  "appName": "",
  "displayName": "",
  "description": "",
  "appType": "LAMBDA_SMART_APP",
  "lambdaSmartApp": {
    "functions": [
      ""
    ]
  }
}' "https://api.smartthings.com/v1/apps"

where,

  • is the personal access token you obtained above.
  • is a globally unique name for your SmartApp or SmartThings Connector.
  • is any description you give to your app.
  • is the ARN of the Lambda function, from the Lambda function page of AWS console.

Important

The name you enter above for the appName field must be globally unique.

Whitelist OAuth scopes

Next you must explicitly whitelist OAuth scopes for your SmartApp. See SmartApp token OAuth scopes.