感谢您的访问。此页面目前仅提供英语版本。我们正在开发中文版本。谢谢您的理解。

Alexa.Health.DiaperChange Interface

The Alexa.Health.DiaperChange interface describes messages that you can use to develop Alexa skills for your apps and devices that track diaper changes. You can develop your skill as a stand-alone skill, or you can integrate it with a smart home device, such as a diaper-changing table. For an overview of the Alexa.Health interfaces, see Understand the Baby Activity Skill API.

For the list of locales that are supported for the DiaperChange interface, see List of Capability Interfaces and Supported Locales.

Utterances

When you use the Alexa.Health.DiaperChange interface, the voice interaction model is already built for you. The following examples show some customer utterances:

Alexa, record a dirty diaper at three pm.
Alexa, record a wet diaper at five.
Alexa, how long ago was the last diaper change?
Alexa, what were the contents of the last diaper?

After the customer says one of these utterances, Alexa sends a corresponding directive to your skill. You identify which directives you support, and for which customers, in the user profile report. You handle the directive and send a response event back to Alexa.

Before you submit your skill for certification, verify that you correctly handle the utterances in the testing guide.

User profile report

When a customer enables your Alexa skill, post a profile report message to Alexa. Your customers create their profiles in your app, and you create an identifier to track them in your app. Send the same identifier to Alexa as profileId in the profile report. If a customer adds, updates, or deletes a profile in your app, post a new profile report message to Alexa.

Identify the directives that your skill supports for each profile as supportedOperations in the profile report. The Get directive is always required. Requirements for other directives are specified in the Directives section.

You can send multiple profiles and multiple capabilities in the profile report. For more information, see User Profiles.

User profile report example

{
  "report": {
    "messageId": "<message id>",
    "profiles": [
      {
        "profileId": "<profile id>",
        "name": {
          "firstName": "Baby",
          "lastName": "Doe",
          "nickNames": ["Baby", "Junior"]
        },
        "capabilities": [
          {
            "name": "Alexa.Health.DiaperChange",
            "type": "AlexaInterface",
            "version": "1",
            "supportedOperations": ["Add", "Get"]
          }
        ]
      }
    ]
  }
}

The diaperChangeMeasurement object

The Alexa.Health.DiaperChange interface uses the diaperChangeMeasurement object as the primary data object.

Diaper change measurement details

Field Description Type Required
measurementTime The time of the diaper change, specified in UTC. A string in ISO 8601 format, YYYY-MM-DDThh:mm:ssZ. Yes
diaperChange The type of the contents of the diaper. A diaperChange object that contains a type string. Yes

Diaper change measurement example

{
  "diaperChangeMeasurement": {
    "measurementTime": "2018-05-30T05:30Z",
    "diaperChange": {
      "type": "WET",
    }
  }
}

Diaper change types

You can use the following values for type in your diaperChange objects.

Value Description
DRY The diaper contains nothing. The diaper is clean.
WET The diaper contains urine.
DIRTY The diaper contains feces.
MIXED The diaper contains both urine and feces.

Directives

Add directive

Support the Add directive so that customers can log a diaper change.

The following example shows a customer utterance:

Alexa, record a mixed diaper.

Add directive payload details

Field Description Type Required
diaperChangeMeasurement The diaper change to add. A diaperChangeMeasurement object. Yes

Add directive example

{
  "directive": {
    "header": {
      "namespace": "Alexa.Health.DiaperChange",
      "name": "Add",
      "messageId": "<message id>",
      "correlationToken": "<correlation token>",
      "payloadVersion": "1"
    },
    "profile": {
      "scope": {
        "token": "<an OAuth2 bearer token>"
      },
      "profileId": "<the identifier for the profile to associate with the diaper change>"
    },
    "payload": {
      "diaperChangeMeasurement": {
        "measurementTime": "<measurementTime>",
        "diaperChange": {
          "type": "WET"
        }
      }
    }
  }
}

Add response event

If you handle an Add directive successfully, respond with an AddResponse event.

AddResponse event payload details

Field Description Type Required
entryId Your identifier for the record that you added. String Yes

AddResponse event example

{
  "event": {
    "header": {
      "namespace": "Alexa.Health.DiaperChange",
      "name": "AddResponse",
      "messageId": "<message id>",
      "payloadVersion": "1",
    },
    "payload": {
      "entryId": "<entry id>"
    }
  }
}

Add directive error handling

If you can't handle an Add directive successfully, respond with an Alexa.Health.ErrorResponse event.

Get directive

Support the Get directive so that customers can retrieve one or more diaper changes. The Get directive is required.

The following example shows a customer utterance:

Alexa, how many diaper changes yesterday?

Get directive payload details

Field Description Type Required
maxResults The maximum number of results to return in the current page of results. Results beyond this number are paginated. Specify a number greater than zero. Integer Yes
nextToken A token to retrieve additional results if the results are paginated and there are more results. String No
filterParameters An array of filter parameter objects that filters the results of the query. Use "measurementTime" for the fieldName in your filter parameters when you retrieve diaper changes. Array No
sortParameters An array of sort parameter objects that sorts the results of the query. Array No

Get directive example

{
  "directive": {
    "header": {
      "namespace": "Alexa.Health.DiaperChange",
      "name": "Get",
      "messageId": "<message id>",
      "payloadVersion": "1"
    },
    "profile": {
      "scope": {
        "token": "<an OAuth2 bearer token>"
      },
      "profileId": "<the identifier for the profile associated with the diaper changes>"
    },
    "payload": {
      "queryParameters": {
        "maxResults": "3",
        "filterParameters": [
          {
            "fieldName": "measurementTime",
            "comparisonOperator": "GTE",
            "value": "2018-12-01T00:00:00Z"
          },
          {
            "fieldName": "measurementTime",
            "comparisonOperator": "LT",
            "value": "2018-12-02T00:00:00Z"
          }
        ],
        "sortParameters": [
          {
            "fieldName": "measurementTime",
            "order": "DESC"
          }
        ]
      }
    }
  }
}

Get response event

If you handle a Get directive successfully, respond with a GetResponse event.

GetResponse event payload details

Field Description Type Required
nextToken A token to retrieve additional results if the results are paginated and there are more results. String No
diaperChangeMeasurements The results of the query. An array of diaperChangeMeasurement objects. Yes

GetResponse event example

{
  "event": {
    "header": {
      "namespace": "Alexa.Health.DiaperChange",
      "name": "GetResponse",
      "payloadVersion": "1",
      "messageId": "<message id>"
    },
    "payload": {
      "nextToken": "4",
      "diaperChangeMeasurements": [
        {
          "measurementTime": "2018-12-01T05:30Z",
          "diaplerChange": {
            "type": "MIXED"
          }
        },
        {
          "measurementTime": "2018-12-01T09:30Z",
          "diaplerChange": {
            "type": "DIRTY"
          }
        },       
        {
          "measurementTime": "2018-12-01T13:30Z",
          "diaplerChange": {
            "type": "WET"
          }
        }
      ]
    }
  }
}

Get directive error handling

If you can't handle a Get directive successfully, respond with an Alexa.Health.ErrorResponse event. Use the INVALID_NEXT_TOKEN error type if the nextToken is inconsistent with the filter and sort parameters. For more information, see Paginating Results.

Interface Description
Alexa.Health.Weight Describes messages for tracking weight measurements.
Alexa.Health.Sleep Describes messages for tracking and timing sleep.
Alexa.Health.InfantFeeding Describes messages for tracking and timing infant feeding.