I have been developing a timer request template for the last 3 weeks and have finally come down to this code. The function is almost working as the voice permission works. However, I am getting stop by this error that I don't understand nor now how to fix. Would love your input so we can launch the template to the community :)
timer = { "duration": "PT15S", "timerLabel": "Change name", "creationBehavior": { "displayExperience": { "visibility": "VISIBLE" } }, "triggeringBehavior": { "operation": { "type": "ANNOUNCE", "textToAnnounce": [ { "locale": "en-US", "text": "Break time" } ] }, "notificationConfig": { "playAudible": True } } } class LaunchRequestHandler(AbstractRequestHandler): def can_handle(self, handler_input): return ask_utils.is_request_type("LaunchRequest")(handler_input),ask_utils.is_request_type("AMAZON.YesIntent")(handler_input), ask_utils.is_request_type("AMAZON.NoIntent")(handler_input) def handle(self, handler_input): accessToken= ask_sdk_core.utils.get_api_access_token rb = handler_input.response_builder request_envelope = handler_input.request_envelope permissions = request_envelope.context.system.user.permissions if not (permissions and permissions.consent_token): logging.info("user hasn't granted reminder permissions") return ( rb .add_directive( SendRequestDirective( name="AskFor", payload={ "@type": "AskForPermissionsConsentRequest", "@version": "1", "permissionScope": "alexa::alerts:timers:skill:readwrite", }, token="" ) ) .response ) else: speak_output = "would you like to set the timer for 20 minutes?" if ask_utils.is_request_type("AMAZON.YesIntent")(handler_input): options = {"Authorization": "Bearer " + accessToken, "Content-Type": "application/json"} requests.post("https://api.amazonalexa.com/v1/alerts/timers", timer, options) speak_output = "timer set for 20 seconds"
Error: Alexa skill error: 'NoneType' object has no attribute 'object_type'
Please let me know if there are any other possible bug causing line that haven't caught my eyes yet.
Stay safe & happy coding.