Pour créer une skill utilisez la console :
https://developer.amazon.com/alexa/console/ask
Chaque flash info est limité à 4500 caractères. Si le flash est lus important il sera coupé.
Le texte doit être du texte « simple » sans balises SSML, HTML ou XML.
Il doit être compréhensible, bien orthographié et bien ponctué. Les virgules (,) et points virgules (;) génèrent des pauses courtes. Les points (.), points d’interrogation (?) et d’exclamation (!) génèrent des pauses longues.
Feed Item |
Description |
Required? |
JSON element |
Example |
HTTP Content-Type Header |
Indicates the format of the feed payload. |
Yes |
application/json |
|
Identifier |
Unique identifier for each feed item. UUID format preferred, but not required. |
Yes |
uid |
function gen_uuid() {return sprintf( ‘%04x%04x-%04x-%04x-%04x-%04x%04x%04x’,mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ),mt_rand( 0, 0xffff ),mt_rand( 0, 0x0fff ) | 0x4000,mt_rand( 0, 0x3fff ) | 0x8000,mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ), mt_rand( 0, 0xffff ));} |
Date |
Indicates freshness of the feed item, and items should be in date order from newest to oldest. This field requires a specific Simple Date Format: yyyy-MM-dd’T’HH:mm:ss’.0Z’. Note that the date should be specified in UTC/Zulu time. Note: Items with a date older than 7 days will not be played or read. |
Yes |
updateDate |
$date = new DateTime();$dtJour = $date->format(‘Y-m-d\TH:i:s\Z’); |
Title |
The title of the feed item to display in the Alexa app. |
Yes |
titleText |
title |
Audio content |
HTTPS URL specifying the location of audio content for an audio feed. |
Yes, for audio feed items. |
streamUrlelement with a value of the URL for an MP3 stream |
enclosure element with type attribute set to audio/mpeg |
Text content |
For text feeds, the text that is read to the customer. |
Yes in all cases. For an audio feed item, this element will be ignored and can contain an empty string (« ») |
mainText |
description |
Display URL |
Provides the URL target for the Read More link in the Alexa app. |
No |
redirectionUrl |
link |
Exemple de génération en PHP :
function gen_uuid() {
return sprintf('%04x%04x-%04x-%04x-%04x-%04x%04x%04x',
mt_rand(0, 0xffff), mt_rand(0, 0xffff),
mt_rand(0, 0xffff),
mt_rand(0, 0x0fff) | 0x4000,
mt_rand(0, 0x3fff) | 0x8000,
mt_rand(0, 0xffff), mt_rand(0, 0xffff), mt_rand(0, 0xffff)
);
}
///////////////
$date = new DateTime();
$dtJour = $date - > format('Y-m-d\TH:i:s\Z');
//////////////////:
class Emp {
public $uid = "uid";
public $updateDate = "updateDate";
public $titleText = "titleText";
public $mainText = "mainText";
}
$e = new Emp();
$e - > uid = gen_uuid(); //"a3317174-ade9-11e8-8492-4a124eda53b1";
$e - > updateDate = $dtJour; //"2018-09-01T13:19:21.0Z";
$e - > titleText = "Test skill";
$e - > mainText = "Hello World";
/////////// JSON production
header('Content-type:application/json;charset=utf-8');
$res = json_encode($e);
echo $res;
Pour une skill lisant un fichier mp3 (à placer sur le serveur là où est le fichier PHP) :
//-- Structure du Json Alexa
$sUrlMp3="https://xxxx/Beautiful.mp3";
$sPhrase="";
class Emp {
public $uid = "uid";
public $updateDate = "updateDate";
public $titleText ="titleText";
public $mainText = "mainText";
public $streamUrl ="mp3url";
}
$date = new DateTime();
$dtJour = $date->format('Y-m-d\TH:i:s\Z');
$e = new Emp();
$e->uid = gen_uuid(); //"a3317174-ade9-11e8-8492-4a124eda53b1";
$e->updateDate = $dtJour; //"2018-09-01T13:19:21.0Z";
$e->titleText = "bonne année";
$e->mainText = $sPhrase;
$e->streamUrl = $sUrlMp3;
/////////// JSON production
header('Content-type:application/json;charset=utf-8');
$res= json_encode($e, JSON_UNESCAPED_UNICODE);
echo $res;
Skills développées par Andrologiciels :
Références
https://developer.amazon.com/fr/docs/flashbriefing/flash-briefing-skill-api-feed-reference.html