stoiveyp / Alexa.NET.ProactiveEvents

Small library to help with the Alexa ProactiveEvents API
MIT License
5 stars 2 forks source link

SKILL_PROACTIVE_SUBSCRIPTION_CHANGED not firing #6

Open bauchschuss opened 5 years ago

bauchschuss commented 5 years ago

Hi, i don't know if i do something wrong but the SKILL_PROACTIVE_SUBSCRIPTION_CHANGED event is not firing when activating / deactivating the corresponding permission via Alexa app. The proactive events are working well.

I've added the ProactiveSubscriptionChangedRequestHandler in the constructor of my function.

public Function() { new ProactiveSubscriptionChangedRequestHandler().AddToRequestHandler(); }

The SKILL_PERMISSION_CHANGED and SKILL_PERMISSION_ACCEPTED are firing like expected when changing the permission in the app.


"subscriptions": [
        {
          "eventName": "SKILL_PROACTIVE_SUBSCRIPTION_CHANGED"
        },
        {
          "eventName": "SKILL_PERMISSION_ACCEPTED"
        },
        {
          "eventName": "SKILL_PERMISSION_CHANGED"
        },
        {
          "eventName": "SKILL_ENABLED"
        },
        {
          "eventName": "SKILL_DISABLED"
        }
      ],

I have also subscribed to the event from the skill manifest.

Does anybody else have the same issue?

best regards Martin

DanBusc commented 4 years ago

Hi Martin,

the event is triggered, but the converted object is null... You can try to check by type

public class SubscriptionChangedRequestHandler : IAlexaRequestHandler { public bool CanHandle(AlexaRequestInformation<SkillRequest> information) { return information.SkillRequest.Request.Type == "AlexaSkillEvent.ProactiveSubscriptionChanged"; } ....

After you convert the object as a ProactiveSubscriptionChangedRequest, the request object is null.

public async Task<SkillResponse> Handle(AlexaRequestInformation<SkillRequest> information) { var request = information.SkillRequest.Request as ProactiveSubscriptionChangedRequest; //request is null } ...

Right now I have no idea why this is happening @stoiveyp can you pls check this and give a hint?

Thanks, Daniel

Edit: Unfortunately I have no idea how to write the code with line breaks.

stoiveyp commented 4 years ago

Thanks for the extra info - I'll take a look tonight

stoiveyp commented 4 years ago

The request type was being picked up by the default alexa skill handler and that's why it produced a null object This has been fixed in v1.1.2 that was just released 👍