【问题标题】:Alexa skill not asking for permission (notification) when enabling the skill via voice通过语音启用技能时,Alexa 技能未请求许可(通知)
【发布时间】:2020-09-20 11:24:06
【问题描述】:

在 Web 或应用程序中启用时,相关技能要求一项权限(出站通知)。但是,当实现Skill Enabled Event 时,它并没有要求用户给予通知权限。技能启用本身有效,但默认权限为否。通过语音启用时如何让alexa请求权限?

Alexa 能否通过语音提示他们启用出站通知?

技能.json

{
"manifest": {
    "publishingInformation": {
        "locales": {
            "en-US": {
                "summary": "test skill summary",
                "examplePhrases": [
                    "Alexa, launch test skill",
                    "Alexa, open test skill",
                    "Alexa, start test skill"
                ],
                "keywords": [
                    "test skill"
                ],
                "name": "test skill",
                "description": "test skill Description",
                "smallIconUri": "",
                "largeIconUri": "",
                "updatesDescription": ""
            }
        },
        "isAvailableWorldwide": true,
        "testingInstructions": "n/a",
        "category": "EVENT_FINDERS",
        "distributionCountries": [],
        "automaticDistribution": {
            "isActive": false
        }
    },
    "apis": {
        "custom": {
            "endpoint": {
                "uri": "arn:aws:lambda:us-east-1:"
            },
            "interfaces": []
        }
    },
    "manifestVersion": "1.0",
    "privacyAndCompliance": {
        "allowsPurchases": false,
        "locales": {
            "en-US": {
                "privacyPolicyUrl": "",
                "termsOfUseUrl": ""
            }
        },
        "isExportCompliant": true,
        "containsAds": false,
        "isChildDirected": false,
        "usesPersonalInfo": false
    },
    "events": {
        "endpoint": {
            "uri": "arn:aws:lambda:us-east-1:"
        },
        "publications": [
            {
                "eventName": "AMAZON.MessageAlert.Activated"
            },
            {
                "eventName": "AMAZON.MediaContent.Available"
            }
        ],
        "regions": {
            "NA": {
                "endpoint": {
                    "uri": "arn:aws:lambda:us-east-1:",
                    "sslCertificateType": "Trusted"
                }
            }
        },
        "subscriptions": [
            {
                "eventName": "SKILL_PROACTIVE_SUBSCRIPTION_CHANGED"
            },
            {
                "eventName": "SKILL_ENABLED"
            },
            {
                "eventName": "SKILL_DISABLED"
            },
            {
                "eventName": "SKILL_PERMISSION_ACCEPTED"
            },
            {
                "eventName": "SKILL_PERMISSION_CHANGED"
            },
            {
                "eventName": "SKILL_ACCOUNT_LINKED"
            }
        ]
    },
    "permissions": [
        {
            "name": "alexa::devices:all:notifications:write"
        }
    ]
}

}

感谢您的帮助

【问题讨论】:

    标签: alexa alexa-skills-kit alexa-skill alexa-voice-service jovo-framework


    【解决方案1】:

    可能有不同的方式,但一旦你掌握了这项技能,我相信你需要发送一张请求权限卡。据我了解,这个想法是确保亚马逊作为第三方权限授予者参与其中。这将在用户手机上的 Alexa 应用程序中弹出一个权限请求。这一增加的安全层只是确保客户准确地看到他们授予的权限。

    您可以根据自己的技能以几种不同的方式做到这一点。您可以检查用户第一次连接的时间,并在持久的客户数据层中跟踪第一次连接。或者,您可以在使用该部分技能时检查用户是否具有权限。如果他们没有回复,请告诉客户您向他们发送了一张卡片以授予权限。

    以下是有关许可卡的更多信息: https://developer.amazon.com/en-US/docs/alexa/custom-skills/request-customer-contact-information-for-use-in-your-skill.html#permissions-card-for-requesting-customer-consent

    【讨论】:

    • 感谢您的回答。这可能是实现它的一种方式,尽管我希望它可以通过语音实现。由于我需要 Alexa 已经知道的通知权限,因此在启用技能时,Alexa 可以要求用户提供通知权限,并根据用户输入(是,否)使开发人员能够处理它。 Google 就是这样做的。
    【解决方案2】:

    要通过 lambda 运行提醒,其他权限可能是相同的格式。

    const CreateReminderIntent = {
    
      canHandle(handlerInput) {
        const { request } = handlerInput.requestEnvelope;
        return request.type === 'IntentRequest' && request.intent.name === 'CreateReminderIntent';
      },
    
      async handle(handlerInput) {
        const { requestEnvelope, serviceClientFactory, responseBuilder } = handlerInput;
        const consentToken = requestEnvelope.context.System.user.permissions
          && requestEnvelope.context.System.user.permissions.consentToken;
        if (!consentToken) {
          return handlerInput.responseBuilder
            .addDirective({
              type: "Connections.SendRequest",
              name: "AskFor",
              payload: {
                "@type": "AskForPermissionsConsentRequest",
                "@version": "1",
                "permissionScope": "alexa::alerts:reminders:skill:readwrite"
              },
              token: "<string>"
            })
            .getResponse();
        }
    
        try {
    
          const speechText = "Great! I've scheduled a reminder for you";
    
          const ReminderManagementServiceClient = serviceClientFactory.getReminderManagementServiceClient();
          const reminderPayload = {
            "trigger": {
              "type": "SCHEDULED_RELATIVE",
              "offsetInSeconds": "10",
              "timeZoneId": "Europe/London"
            },
            "alertInfo": {
              "spokenInfo": {
                "content": [{
                  "locale": "en-GB",
                  "text": "Wash the dog"
                }]
              }
            },
            "pushNotification": {
              "status": "ENABLED"
            }
          };
    
          await ReminderManagementServiceClient.createReminder(reminderPayload);
          return responseBuilder
            .speak(speechText)
            .getResponse();
    
        } catch (error) {
          console.error(error);
          return responseBuilder
            .speak('Uh Oh. Looks like something went wrong.')
            .getResponse();
        }
      }
    };

    【讨论】:

      猜你喜欢
      • 2019-02-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-04-21
      • 1970-01-01
      • 2023-01-24
      • 1970-01-01
      相关资源
      最近更新 更多