Verify SmartApp Registration?

SmartThings is not able to verify the registration of the WebHook SmartApp. Please make sure your app is available and properly implemented, and verify again.

I’m getting Cinfirmation event responding 200. What else I have to do to get verified the automation app.

app.post("/webhook", async (req, res) => {
    console.log("Received SmartThings Event:", req.body);

    if (req.body.lifecycle === "CONFIRMATION") {
        const confirmationUrl = req.body.confirmationData.confirmationUrl;
        console.log("Confirming SmartApp at:", confirmationUrl);

        try {
            // Make a GET request to the confirmation URL
            await axios.get(confirmationUrl);
            console.log("SmartApp confirmed successfully!");
        } catch (error) {
            console.error("SmartApp confirmation failed:", error);
        }

        // Respond to SmartThings (important)
        return res.json({ status: "OK" });
    }

    res.sendStatus(200);
});

Thanks!

According to the online documentation the response to a CONFIRMATION should be:

{
    "targetUrl": "{TARGET_URL}"
}

I actually respond with:

{
    "target_url": "{TARGET_URL}"
}

I didn’t make that up as that was what was documented at the time. The SmartApp SDK doesn’t seem to define any response at all so it seems likely that it doesn’t actually matter and all it is waiting for is the GET.

Strictly speaking you shouldn’t call the confirmation URL automatically without checking the app ID as it means anyone knowing your target URL can register their own app. Indeed you are encouraged to do it manually. That’s an aside though.

So I can’t see anything missing.

Can SSL Verification matter?

Actually the ngrok server is not able to communicate with secure server.

is it related to this issue?

Hi @Chandrajeet_Singh

Could you confirm if you’re receiving the confirmation request?

Also, what response do you get when making a GET request to the confirmation URL?

The URL must pass the SSL test for SmartThings to successfully send requests.

Hi @Itati , Thanks for your response.
Finally Apps is deployed to test.

Looking for further steps.

I just want to use Device API but PAT gets expired within 24 hrs.
I’m not sure how to achieve this?

I have created an API_ONLY app from smarthings cli and From Workspace I created an smartAPP for automation.

For both the cases just got Client Id and Client secret but I don’t know how to use them to get auth code and tokens to consume smartthings /devices api to control the Smasung Smart TV.

Hi @Chandrajeet_Singh

I saw that you already solved the OAuth issue. Regarding your question OAuth 2 Guide for Automation Connector to be able to control existing devices on smartthings via API - #3 by Chandrajeet_Singh, you can check the following.

Installation limit: OAuth Integrations | Developer Documentation | SmartThings

NOTE: Remember the OAuth integration has a limit of 500 installations by default . Each time a user authorizes access to one of his/her locations, it will count as 1 installation. This means, if a user has 3 locations and authorizes access to each of them, he/she will use 3 installations.

Rate limits: Rate Limits and Guardrails | Developer Documentation | SmartThings

Hi @Itati @orangebucket ,
I have redirect URI with Query params and while authorization and redirection, it removes the query params.

is there any option to keep query params in the my redirect URI after redirection with code?

Thanks

Hi @Chandrajeet_Singh
Are the query parameters created by you? Could you provide more context, please?