422 Error for establishing Web-hook

Hi all,

I started working with Smart things a couple of days ago so I am not fully on it yet!

I am trying to connect my dryer to start/stop it through Cloud smart things. Therefore I am trying to register a webhook by operating a POST at api . smartthings. com / v1 / apps

My headers are Authorisation: Bearer token and Content-type: application/json; charset=utf-8

The body is:

  "appName": "ecohome", 
  "displayName": "ecohome", 
  "description": "ecohome", 
  "appType": "WEBHOOK_SMART_APP", 
  "webhookSmartApp": {
    "targetUrl": "https://5a87f490.ngrok.io"

The post request returns the following:

    "requestId": "7758B79A-8743-484D-95C0-473C8CF546BB",
    "error": {
        "code": "ConstraintViolationError",
        "message": "The request is malformed.",
        "details": [
                "code": "TargetTimeoutError",
                "target": "https://5a87f490.ngrok.io",
                "message": "Upstream target timed out",
                "details": []

I am not sure what is happening really. Should the post return the PING challenge? And if yes why isn’t it? Apologies if I am doing some obvious mistake but I would appreciate the help!

At the time of creation, your webhook app needs to be running and available at the URL you specified. It is specifically looking for the PING challenge response and if you respond accordingly, it will successfully create the app.

Ideally, you’d create your automation app on the DevWorkspace – there’s UX there that would help guide you through the process.

Should the post return the PING challenge? And if yes why isn’t it?

Yep – you have to implement that yourself, and it’s pretty easy! Check out our preview SDK’s implementation here.

You didn’t mention the language or framework you are using, but you could try using our preview smartapp SDK for NodeJS or Java.

1 Like