-
- parsing discovery request from Amazon(AWS Lambda)
- and building response with or without Endpoints(Smart Home devices) as described here
-
- parsing and building Alexa headers
-
- payloads for responses
-
- constructs response with event, header and given payload
-
- AlexaDiscoveryRequest parses discovery request forwarded from aws_lambda.js. And constructs response with event, header and given payload
-
- Endpoint represents a connected device associated with the customer’s device cloud account. (Smart Device)
-
- AlexaContext class represents Context object for example for Alexa StateReport response.
-
- parses Control request and sets correlation token, directive and scope for future use.
-
- AlexaError helper class constructs 'type' -> 'message' chain for given error type in constructor
-
Example code for AWS Lambda function to forward requests and responses from AWS to your server and back
-
copy or upload this file to your AWS Lambda function.
-
Don't forget to change REMOTE_CLOUD_HOSTNAME and REMOTE_CLOUD_BASE_PATH to the right paths
var https = require('https'); var REMOTE_CLOUD_BASE_PATH = "/smarthome_skill/"; var REMOTE_CLOUD_HOSTNAME = "yourdomain.com";
This is an example of using Amazon Alexa Smart Home Skill PHP API.
It simply parses AlexaDiscoveryRequest generates one Endpoint device and sends response back.
- AWS Lambda code for forwarding request and responses
- Discovery example code - respond to Discover request with example devices
- turnON, turnOFF example code for PowerSwitch Interface