App Registration

You can register either a WebHook or an AWS Lambda function as your Automation or SmartThings Connector. This page explains how to do so using the SmartThings API.

SmartThings account

  • Ensure you have a Samsung 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 <AUTH_TOKEN>" \
       -H "Content-Type: application/json; charset=utf-8" \
       -d $'{"appName": "<GLOBALLY-UNIQUE-APP-NAME>", "displayName": "<my-app-display-name>", "description": "<my-app-description>", "appType": "WEBHOOK_SMART_APP", "classifications": "AUTOMATION", "webhookSmartApp": {"targetUrl": "<TARGET_URL>"}}'

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 <my-auth-token>" -H "Content-Type: application/json" -H "Accept: application/json" -d '{
  "appName": "<GLOBALLY-UNIQUE-APP-NAME>",
  "displayName": "<my-app-display-name>",
  "description": "<my-app-description>",
  "appType": "LAMBDA_SMART_APP",
  "lambdaSmartApp": {
    "functions": [
      "<my-app-arns>"
    ]
  }
}' "https://api.smartthings.com/v1/apps"

where,

  • <my-auth-token> is the personal access token you obtained above.
  • <GLOBALLY-UNIQUE-APP-NAME> is a globally unique name for your SmartApp or SmartThings Connector.
  • <my-app-display-name> is any description you give to your app.
  • <my-app-arns> is the ARN of the Lambda function, from the Lambda function page of AWS console.

Whitelist OAuth scopes

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

See also