您可以与Alexa技能事件集成,并在用户禁用技能时收到通知。 https://developer.amazon.com/docs/smapi/skill-events-in-alexa-skills.html#skill-disabled-event 。
该 SkillDisabled event仅包含user_id(即没有访问令牌)。所以你还需要倾听 SkillAccountLinked 事件,以便您可以将user_id与您自己的用户标识符链接。
SkillDisabled
SkillAccountLinked
您的智能家居技能清单应如下所示:
{ "manifest": { "publishingInformation": { "locales": { "en-US": { "summary": "...", "examplePhrases": [ "Alexa, ...", "Alexa, ...", "Alexa, ..." ], "keywords": [], "name": "...", "smallIconUri": "...", "description": "...", "largeIconUri": "..." } }, "isAvailableWorldwide": false, "testingInstructions": "...", "category": "SMART_HOME", "distributionCountries": [ "US" ] }, "apis": { "smartHome": { "endpoint": { "uri": "arn:aws:lambda:..." }, "protocolVersion": "3" } }, "manifestVersion": "1.0", "permissions": [ { "name": "alexa::async_event:write" } ], "privacyAndCompliance": { "allowsPurchases": false, "locales": { "en-US": { "termsOfUseUrl": "...", "privacyPolicyUrl": "..." } }, "isExportCompliant": true, "containsAds": false, "isChildDirected": false, "usesPersonalInfo": false }, "events": { "endpoint": { "uri": "arn:aws:lambda:..." }, "subscriptions": [ { "eventName": "SKILL_ENABLED" }, { "eventName": "SKILL_DISABLED" }, { "eventName": "SKILL_PERMISSION_ACCEPTED" }, { "eventName": "SKILL_PERMISSION_CHANGED" }, { "eventName": "SKILL_ACCOUNT_LINKED" } ], "regions": { "NA": { "endpoint": { "uri": "arn:aws:lambda:..." } } } } } }