Code Monkey home page Code Monkey logo

alexa.net.proactiveevents's People

Contributors

stoiveyp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

alexa.net.proactiveevents's Issues

SKILL_PROACTIVE_SUBSCRIPTION_CHANGED not firing

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

AMAZON.Occasion.Updated Schema Update

In ReservationConfirmationStatus.cs

    [EnumMember(Value = "REQUESTED")] Requested,

should be changed to:

    [EnumMember(Value = "RECEIVED")] Received,

Amazon return BadRequest validation from a "REQUESTED" occasion:

{
"type": "Bad Request",
"message": "The event failed the schema validation, eventNode does not match schema, report is com.github.fge.jsonschema.core.report.ListProcessingReport: failure\n--- BEGIN MESSAGES ---\nwarning: the following keywords are unknown and will be ignored: [$id, schemaId]\n level: "warning"\n schema: {"loadingURI":"#","pointer":""}\n domain: "syntax"\n ignored: ["$id","schemaId"]\nerror: instance value ("REQUESTED") not found in enum (possible values: ["CONFIRMED","CANCELED","RECEIVED","CREATED","UPDATED","RESCHEDULED"])\n level: "error"\n schema: {"loadingURI":"#","pointer":"/properties/payload/properties/state/properties/confirmationStatus"}\n instance: {"pointer":"/payload/state/confirmationStatus"}\n domain: "validation"\n keyword: "enum"\n value: "REQUESTED"\n enum: ["CONFIRMED","CANCELED","RECEIVED","CREATED","UPDATED","RESCHEDULED"]\n--- END MESSAGES ---\n"
}

Have the possibility to send a "custom event"

Hi Steven and thanks in advance for you amazing work :-)
This is not an issue, I just want to ask if there is a way to send e "custom event" through ProactiveEvents api.
What I'm triyng to do is to notify a user (unicast) that a task (previous launched from skill) has ended successfully or with an error. It's a very simple message so I thought that the nearest schema is AMAZON.MessageAlert.Activated...but here I can only specify the creator...
If there is no way...maybe I can use progressive responses? But sincerely I don't think this can be the right pattern because the task can take some minutes to complete.
It's unbelivable that they removed notifications api...

Response 400 Bad request for Date time format issue

I always got 400 Bad requests even though the request was correct.

I found that the Date format doesn't follow the example provided in the Proactive Events API Reference documentation.

Can you release a new version with the resolution by improving the settings of the EventIsoDateTimeConverter class (see TO BE)?

AS IS

Date time Format JSON - Proactive Events API Reference

"timestamp": "2019-04-18T03:27:00.00Z"

Abstract JSON - Alexa.NET.ProactiveEvents.dll Version 1.1.0

"timestamp":"2020-03-02T23.30.21+00:00",
"expiryTime": "2020-03-03T22.30.21+00:00"

Full JSON - Alexa.NET.ProactiveEvents.dll Version 1.1.0

{
    "relevantAudience": {
        "type": "Multicast",
        "payload": {}
    },
    "timestamp": "2020-03-02T23.30.21+00:00",
    "referenceId": "120797e38ea148c18fa08bb669872b86",
    "expiryTime": "2020-03-03T22.30.21+00:00",
    "event": {
        "payload": {
            "state": {
                "status": "UNREAD",
                "freshness": "NEW"
            },
            "messageGroup": {
                "creator": {
                    "name": "Allerta Server"
                },
                "count": 4
            }
        },
        "name": "AMAZON.MessageAlert.Activated"
    },
    "localizedAttributes": []
}

Test with response 400 BAD REQUEST

var eventToSend = new Alexa.NET.ProactiveEvents.MessageReminders.MessageReminder(
new Alexa.NET.ProactiveEvents.MessageReminders.MessageReminderState(
    Alexa.NET.ProactiveEvents.MessageReminders.MessageReminderStatus.Unread,
    Alexa.NET.ProactiveEvents.MessageReminders.MessageReminderFreshness.New),
new Alexa.NET.ProactiveEvents.MessageReminders.MessageReminderGroup("Allerta Server", 4, null)
);

var request = new BroadcastEventRequest(eventToSend)
{
    ExpiryTime = DateTimeOffset.UtcNow.AddDays(1).AddHours(-1),
    ReferenceId = Guid.NewGuid().ToString("N"),
    TimeStamp = DateTimeOffset.UtcNow
};

var clientId = "<clientId>";
var clientSecret = "<clientSecret>";
var messaging = new AccessTokenClient(AccessTokenClient.ApiDomainBaseAddress);
var details = messaging.Send(clientId, clientSecret).GetAwaiter().GetResult();
var accessToken = details.Token;

var client = new ProactiveEventsClient(ProactiveEventsClient.EuropeEndpoint, accessToken);
var response = client.Send(request).GetAwaiter().GetResult();

Source code class EventIsoDateTimeConverter - Alexa.NET.ProactiveEvents.dll Version 1.1.0

internal class EventIsoDateTimeConverter : IsoDateTimeConverter
{
    public EventIsoDateTimeConverter()
    {
        //  DateTimeStyles = DateTimeStyles.AdjustToUniversal;
        DateTimeFormat = "yyyy-MM-ddTHH:mm:ssK";
    }
}

TO BE

FIX - Alexa.NET.ProactiveEvents.dll Version 1.X.X

internal class EventIsoDateTimeConverter : IsoDateTimeConverter
    {
        public EventIsoDateTimeConverter()
        {
            Culture = System.Globalization.CultureInfo.InvariantCulture;
            DateTimeStyles = System.Globalization.DateTimeStyles.AdjustToUniversal;
            DateTimeFormat = "yyyy'-'MM'-'dd'T'HH':'mm':'ss'.'ff'Z'";
        }
    }

Abstract JSON

"timestamp":"2020-03-02T23:24:23.06Z",
"expiryTime": "2020-03-03T22:24:23.06Z"

Full JSON

{
    "relevantAudience": {
        "type": "Multicast",
        "payload": {}
    },
    "timestamp": "2020-03-02T23:24:23.06Z",
    "referenceId": "75fa64c1db334c249e8952393d978211",
    "expiryTime": "2020-03-03T22:24:23.06Z",
    "event": {
        "payload": {
            "state": {
                "status": "UNREAD",
                "freshness": "NEW"
            },
            "messageGroup": {
                "creator": {
                    "name": "Allerta Server"
                },
                "count": 4
            }
        },
        "name": "AMAZON.MessageAlert.Activated"
    },
    "localizedAttributes": []
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.