Dash Replenishment - Requirements
Integrate Dash Replenishment
Integrating Dash Replenishment in your connected device can be as easy as extending the capabilities of an existing Alexa Smart Home skill.
Overview
Amazon Dash Replenishment has several requirements to consider when building your smart device ecosystem. Where Dash is an extension of the Alexa Smart Home capabilities, most of these components may already exist or will be common to a new Alexa Smart Home implementation for your device. The graphic below shows the major components that you must implement for Alexa Smart Home and Dash Replenishment: device, device cloud, and Smart Home skill. Amazon provides the Alexa cloud, Alexa app, and Alexa-enabled devices. Optional, but highly recommended, is a manufacturer’s companion app for your smart device.
Dash Replenishment uses the Alexa Smart Home cloud to listen for inventory updates and notifies the user through different channels (e.g. email, Alexa notifications).
Device
A fundamental requirement for Dash integration is that the device can emit the required telemetry about its consumable(s) status. As a minimum, Dash requires daily inventory updates of the consumable(s) in your device, so it is critical that your device has the hardware, firmware, and connectivity to support this. Devices that are constantly connected via Wi-Fi have the best CX, as they can reliably send regular updates. It is possible to implement a device that relies on a companion app or hub, such as those devices that only have Bluetooth. Please discuss this scenario with your Amazon Solutions Architect during your high-level design phase. Telemetry can be captured by direct instrumentation of the consumable(s) (level and usage), inferred consumption or runtime (level usage), or other methods. Your device must map to one of the virtual inventory sensor types: level, usage, or level usage.
In order for the Amazon inventory optimization system used in Dash Replenishment to track, notify and reorder, your device must send regular updates about the consumable(s) status to your device cloud. The frequency of these updates differs depending on the inventory sensor used:
- Level: the consumable level is sent to and stored in your device cloud. It is scheduled to be sent to the Alexa cloud on a daily basis via asynchronous proactive state updates (PSU).
- Usage and Level Usage: each consumption of the device's consumable(s) is sent to your cloud, which then sends a PSU to the Alexa cloud at the time of consumption.
Device Cloud
Your manufacturer’s device cloud interacts with your customers’ devices, responds to directives from the Alexa cloud, and sends PSUs to the Alexa cloud. The four main components are device interaction, authentication, device registration, and Alexa cloud interaction. We recommend that your device cloud is implemented in Amazon Web Services (AWS) for the lowest dev effort and our ability to assist with the end-to-end design and support, but we are ultimately agnostic to its implementation as long as the technical requirements are met.
- Device Interaction (IoT): Your device cloud must interact with your device for communication of inventory sensor data and ideally persist that data in your device cloud for transmittal to and interrogation from the Alexa cloud. We highly recommend that your device support additional value-add functionality, such as customer interaction capabilities. This functionality is typically implemented using IoT design patterns.
- Authentication (OAuth2): As part of the account linking process when your customer enables your skill, you must connect your customer’s identity in your device cloud with their Amazon identity. Your OAuth2 server provides an authorization grant to the Alexa Smart Home cloud and allows Alexa to query about your connected devices and also send PSUs. Your device cloud must provide an authentication portal website for your customers to authenticate into your device cloud to initiate the backend process of sharing authentication tokens between your device cloud and the Alexa cloud during skill linking. An example of this webview from the Alexa App is shown below in the middle graphic:
- Device Registry: Your device cloud must provide a registry to associate your customers with their devices. When your customer enables your Alexa Smart Home skill, the Alexa cloud will send a request to your device cloud requesting a list of all devices owned by that customer. Your device cloud must respond, via your skill, with the list of the devices and their capabilities. This is typically implemented as a registry of devices mapped to customers, along with templates for the capabilities of each of your device types. This same registry can be used for other value-add functions such as device interaction and warranty registration.
- Alexa Cloud Interaction: Your Alexa skill will need to respond to directives from the Alexa cloud for device status or interaction. Because the skill is stateless, state is persisted in your device cloud. For example, if your customer asks for the level of ink in their printer, the Alexa cloud will send a directive to your skill, which in turn will query a data store in your device cloud. In addition to sending these synchronous replies, your device cloud must also send asynchronous PSUs to inform the Alexa cloud about the status of consumables in your customers’ devices. We recommend implementing your Alexa skill Lambda function as one of many Lambda functions that comprise your device cloud, allowing for ease in services interaction and data store access.
Smart Home Skill
Your Smart Home skill provides a simple way for you to enable Alexa voice interaction to control and check the status of your customers’ devices. Your Alexa Smart Home skill allows Alexa to discover your customers’ devices, connect their devices to Alexa Smart Reorders, receive PSUs about consumable status, and interact with the devices from Alexa- enabled devices and the Alexa app. The skill backend is built as a Lambda function in your AWS account using one of the available programming languages (Node.js and Python have the most support).
The amount of development work required to implement Dash Replenishment in your Smart Home skill depends on how or if you have implemented your skill, per the table below.
For an overview of the integration steps, please select whether you currently have no Alexa skill, a Custom skill or already have a Smart Home skill which you are extending.
If you have not created an Alexa skill yet, the required steps to implement Smart Reorders are to:
- Create a new device in the DRS console and contact Amazon Dash Solutions Architect to issue the
replenishmentId
- Access the Alexa console and create a new skill, selecting the "Smart Home" model.
- Configure account linking from the console, specifying your Oauth2 server details.
- Create an AWS Lambda function to process Alexa Smart Home requests
- Ensure your connected devices are sending a device ID to your cloud upon registration.
- Ensure your connected devices are sending inventory levels to your cloud upon user interaction.
If you have a Custom Alexa skill already, the required steps to implement Smart Reorders are to:
- Create a new device in the DRS console and contact Amazon Dash Solutions Architect to issue the
replenishmentId
- Access the Alexa console and add a new model, selecting the "Smart Home" model.
- Ensure account linking is configured or set it-up from the console, specifying your Oauth2 server details.
- Create an AWS Lambda function to process Alexa Smart Home requests
- Ensure your connected devices are sending a device ID to your cloud upon registration.
- Ensure your connected devices are sending inventory levels to your cloud upon user interaction.
If you already have an Alexa Smart Home skill, the required steps to implement Smart Reorders are to:
- Create a new device in the DRS console and contact Amazon Dash Solutions Architect to issue the
replenishmentId
- Update your AWS Lambda function to process the Discovery ChangeReport and the Inventory Updates.
- Ensure your connected devices are sending inventory levels to your cloud upon user interaction.
Design Checklist
This checklist is designed as a quick reference to cover the most important items in an end-to-end Amazon Dash Replenishment implementation.
Prerequisites
Amazon Developer account
AWS account
Alexa-enabled device or Alexa App for testing
Device
Maps to one of the virtual sensors (Level, Usage, Level Usage)
Network connectivity, preferably always-on Wi-Fi
Emits consumable status to your device cloud at least once daily or per use, whichever is more often
Device Cloud
Bidirectional communication with your device
Authentication server
Supports OAuth 2.0
Supports authorization code grant type
Secure store for customer authorization and refresh tokens
Provides a webview authentication portal for account linking
Device registry
Alexa cloud integration
Synchronously respond to requests from your skill
Asynchronously send PSUs to Alexa cloud for inventory status
Alexa Smart Home skill
Implement the Alexa.InventoryLevelSensor, Alexa.InventoryUsageSensor or Alexa.InventoryLevelUsageSensor interface in the Alexa Smart Home discovery response. This must be sent synchronously in response to the Discover directive.
Proactively send asynchronize AddOrUpdateReport events where already discovered devices change.
Proactively send asynchronize inventory updates, either as a ChangeReport event (daily for Level sensor) or InventoryConsumed event (whenever change occurs for Usage and LevelUsage sensors)
Meets the certification requirements here
AWS Service Mapping
This table depicts an example mapping of technical requirements to AWS services for implementing a solution in AWS. This is not an exhaustive list, but represents the major services that comprise a solution.
Requirement | AWS Service | |
---|---|---|
Device | Operating system | FreeRTOS |
Device Cloud | Device interaction | AWS IoT Core |
Authentication | AWS Cognito | |
Device registry | AWS IoT Device Management | |
Alexa cloud interaction | AWS Lambda | |
Secure token store | AWS DynamoDB | |
Authentication portal | AWS Amplify | |
Customer-facing website portal | AWS Amplify | |
Alexa Smart Home Skill | Skill hosting | AWS Lambda |
Companion App | App framework | AWS Amplify |
Last updated: Jul 05, 2021