Skip to content

Support for Progresive Response API

Compare
Choose a tag to compare
@tianrenz tianrenz released this 13 Nov 23:16

This release adds SDK support for progressive response API.

The DirectiveService provides the following function to access the Progressive Response API:

enqueue(directive, apiEndpoint, token);

An example to send directive to the service API is as follows:

function callDirectiveService(event) {
    // Call Alexa Directive Service.
    const ds = new Alexa.services.DirectiveService();
    const requestId = event.request.requestId;
    const endpoint = event.context.System.apiEndpoint;
    const token = event.context.System.apiAccessToken;
    const directive = new Alexa.directives.VoicePlayerSpeakDirective(requestId, "This is a message");
    ds.enqueue(directive, endpoint, token)
    .catch((err) => {
        console.log(err.message);
    });
}