<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gj |</title>
	<atom:link href="https://blog.gaiterjones.com/category/amazon/feed/" rel="self" type="application/rss+xml" />
	<link>https://blog.gaiterjones.com/category/amazon/</link>
	<description>gaiterjones</description>
	<lastBuildDate>Sun, 22 Sep 2019 09:00:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.4.3</generator>
	<item>
		<title>Migrating from Amazon Cloud Drive</title>
		<link>https://blog.gaiterjones.com/migrating-from-amazon-cloud-drive/</link>
					<comments>https://blog.gaiterjones.com/migrating-from-amazon-cloud-drive/#respond</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Sun, 22 Sep 2019 08:45:17 +0000</pubDate>
				<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Google Drive]]></category>
		<category><![CDATA[Storage]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=2092</guid>

					<description><![CDATA[A few years ago the nice people at Amazon started to offer unlimited cloud storage for Amazon Prime customers on their so called Amazon Drive service. A lot of people,...<a class="more-link" href="https://blog.gaiterjones.com/migrating-from-amazon-cloud-drive/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p>A few years ago the nice people at Amazon started to offer unlimited cloud storage for Amazon Prime customers on their so called <em>Amazon Drive</em> service. A lot of people, including me, jumped on board &#8211; I mean it was unlimited storage &#8211; with emphasis on the <strong>UNLIMITED.</strong></p>
<p>This was great &#8211; for about a year, lots of people were boasting about the many, many, many Terabytes of data they had stored on Amazon Drive. For me it was a perfect solution to my cloud backups. I subscribed to ODrive and synced all my working data to Amazon Drive.</p>
<p>Then one day Amazon announced that Amazon Drive for Prime customers would no longer have unlimited storage, and would no longer be free. In fact 1TB of storage would cost $99.99 per year. They had dangled a nice free juicy worm in front of me, I had bitten and now I was well and truly hooked &#8211; hook line and sinker.</p>
<p>What choice did I have? All my data was already stored on Amazon Drive so I swore a lot, got out my credit card and paid up.</p>
<p>Another year or so later (2019) it&#8217;s time to pay Amazon another 100 bucks and I notice that Amazon Drive is now called Amazon Photos, without really informing their customers Amazon have rebranded it into a photo and video storage service. Not exactly what I expected from a cloud storage solution.</p>
<p>As soon as I discovered Google Drive offering twice the amount of storage (2TB) for the same price I decided it was time to migrate my ODrive from Amazon Drive to Google Drive. The problem is, with almost 1TB of data in the cloud &#8211; even with reasonably fast home DSL internet bandwidth how do you move so much data around? To download it all, and then upload it all would take days &#8211; and I don&#8217;t even have enough disk space on my shiny silver macbook pro to temporarily store it all (the reason why I moved to cloud storage in the first place.)</p>
<p>Here is the solution &#8211; How To Migrate your Terabytes in Hours not Days</p>
<ol>
<li>Spin up a bare metal Windows server
<ol>
<li> I used a Win2k16 Server on a Packet <span>c1.small.x86</span><span>c1.small.x86 </span>with super duper gigabit bandwidth.</li>
</ol>
</li>
<li>Install the AmazonPhotos app.
<ol>
<li>Using the Amazon app restore your files to a local folder.</li>
</ol>
</li>
<li>Login to Google and upload the restored files to Google Drive.</li>
<li>In Odrive unsync Amazon Drive synced folders and resync them to Google Drive</li>
<li><strong>FIN</strong>.</li>
</ol>
<p>I moved all of my data in a few hours, and it cost about $30.</p>
<p>Goodbye Amazon, please don&#8217;t try and trap me into a shitty service again.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/migrating-from-amazon-cloud-drive/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Simulate and test your Alexa Skill with the Alexa Skills Kit Command Line Interface (ASK CLI)</title>
		<link>https://blog.gaiterjones.com/simulate-and-test-your-alexa-skill-with-the-alexa-skills-kit-command-line-interface-ask-cli/</link>
					<comments>https://blog.gaiterjones.com/simulate-and-test-your-alexa-skill-with-the-alexa-skills-kit-command-line-interface-ask-cli/#respond</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Wed, 25 Apr 2018 10:16:31 +0000</pubDate>
				<category><![CDATA[Alexa]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Docker]]></category>
		<category><![CDATA[alexa]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=1871</guid>

					<description><![CDATA[The new Alexa Skills Kit Developer Console is fab and a lot of things have changed since I developed my first skill in 2016, one of the changes is skill...<a class="more-link" href="https://blog.gaiterjones.com/simulate-and-test-your-alexa-skill-with-the-alexa-skills-kit-command-line-interface-ask-cli/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p>The new Alexa Skills Kit Developer Console is fab and a lot of things have changed since I <a href="https://blog.gaiterjones.com/amazon-alexa-php-hello-world-example/">developed my first skill in 2016</a>, one of the changes is skill testing which you can now do quite easily with the Alexa Skills Kit Command Line Interface (ASK CLI)</p>
<p>If you are building skills with my PHP code here are a few notes on using the ASK CLI to do simple skill invocation tests using a Docker compose ASK CLI nodejs container.</p>
<p>Assuming you are familiar with using Docker and docker-compose here are the steps to testing your skill from the command line :</p>
<ol>
<li>git clone https://github.com/gaiterjones/docker-amazon-ask-cli</li>
<li>cd docker-amazon-ask-cli</li>
<li>docker-compose build</li>
<li>docker-compose up -d</li>
<li>./init.sh
<ol>
<li>Initialise <em>ask</em> with your amazon developer credentials, you will be prompted to create a default profile and then to paste an authorisation url into your browser. The url will take you to an Amazon authorisation page where you need to login with your developer login. You will then receive an authorisation code which you can paste into the init window to create your cli-config credentials file.</li>
<li><img fetchpriority="high" decoding="async" src="https://blog.gaiterjones.com/wp-content/uploads/2018/04/amazon-ask-cli-1.jpg" alt="" width="600" height="194" class="aligncenter size-full wp-image-1872" /></li>
</ol>
</li>
<li>Test skill with skill simulation
<ol>
<li>./ask.sh amzn1.ask.skill.123 &#8220;ask my skill to do something&#8221; where amzn1.ask.skill.123 is the id of your skill and &#8220;ask my skill to do something&#8221; is the invocation term you want to test with your skill &#8211; i.e. what you would ask Alexa to do to open and use your skill.</li>
<li><img decoding="async" src="https://blog.gaiterjones.com/wp-content/uploads/2018/04/amazon-ask-cli-2.jpg" alt="" width="600" height="265" class="aligncenter size-full wp-image-1873" /></li>
</ol>
</li>
</ol>
<p>Check out <em>ask.sh</em> for the ASK CLI syntax being used. You can use this directly from the container with <em>docker exec -it dockeramazonaskcli_nodejs_1 /bin/bash</em></p>
<p>The credentials will be saved in <em>cli-config</em> when the container is stopped.</p>
<p>You can do a whole lot more with the ASK CLI, check out the documentation here <a href="https://developer.amazon.com/docs/smapi/ask-cli-command-reference.html">https://developer.amazon.com/docs/smapi/ask-cli-command-reference.html</a></p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/simulate-and-test-your-alexa-skill-with-the-alexa-skills-kit-command-line-interface-ask-cli/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to use Amazon Cloud Drive with Owncloud</title>
		<link>https://blog.gaiterjones.com/how-use-amazon-cloud-drive-with-owncloud/</link>
					<comments>https://blog.gaiterjones.com/how-use-amazon-cloud-drive-with-owncloud/#respond</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Wed, 10 May 2017 17:05:52 +0000</pubDate>
				<category><![CDATA[5 Minute Fix]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Cloud]]></category>
		<category><![CDATA[Owncloud]]></category>
		<category><![CDATA[Storage]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=1610</guid>

					<description><![CDATA[Amazon offer cloud drive storage for photos free for Amazon Prime customers. For less that 10 yoyos per month you can upgrade to an unlimited cloud drive storage plan. Yes,...<a class="more-link" href="https://blog.gaiterjones.com/how-use-amazon-cloud-drive-with-owncloud/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p>Amazon offer <a href="https://www.amazon.de/clouddrive">cloud drive storage</a> for photos free for Amazon Prime customers. For less that 10 <em>yoyos</em> per month you can upgrade to an unlimited cloud drive storage plan.</p>
<p>Yes, I did just say <span style="text-decoration: underline;">unlimited</span> storage.</p>
<p>This is pretty neat, but I already use an open source cloud storage system on my own cloud server &#8211; called er, <em><a href="https://owncloud.org/">Owncloud</a>. </em> Wouldn&#8217;t it be really nifty if I could attach the unlimited Amazon Cloud drive storage to my Owncloud.</p>
<p>Here is how to do it in 5 easy steps:</p>
<ol>
<li>Sign up for an unlimited Amazon Cloud Drive storage plan at <a href="https://www.amazon.de/clouddrive">https://www.amazon.de/clouddrive</a></li>
<li>Install and configure <a href="https://acd-cli.readthedocs.io/en/latest/setup.html">acd_cli</a>
<ol>
<li><em>pip3 install &#8211;upgrade &#8211;pre acdcli</em></li>
<li><em>acd_cli -v init</em>
<ol>
<li>authenticate with Amazon and save the generated oauth_data file to ~/.cache/acd_cli/oauth_data</li>
</ol>
</li>
</ol>
</li>
<li>Sync acd_cli
<ol>
<li><em>acd_cli -v sync</em></li>
</ol>
</li>
<li>Mount acd with fuse
<ol>
<li><em>acd_cli mount &#8211;allow-other -i 0 /home/acd/</em></li>
</ol>
</li>
<li>Create a new external storage folder in Owncloud
<figure id="attachment_1611" aria-describedby="caption-attachment-1611" style="width: 600px" class="wp-caption aligncenter"><img decoding="async" src="https://blog.gaiterjones.com/wp-content/uploads/2017/05/owncloud-external-acd.png" alt="" width="600" height="198" class="size-full wp-image-1611" /><figcaption id="caption-attachment-1611" class="wp-caption-text">Owncloud External ACD</figcaption></figure></li>
</ol>
<p>That&#8217;s it, Amazon cloud drive will now appear as an ACD folder in Owncloud.</p>
<p style="text-align: left;">Is it really unlimited? In their license agreement it says that your service will terminate if your usage &#8220;substantially exceeds or differs from normal use by other users&#8221;. Be sure to check out the fine print. A quick Google around shows users already at hundreds of terabytes which sounds good to me.</p>
<p><img loading="lazy" decoding="async" src="https://blog.gaiterjones.com/wp-content/uploads/2017/05/wtf-acd-1.png" alt="" width="600" height="670" class="aligncenter wp-image-1619 size-full" /></p>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/how-use-amazon-cloud-drive-with-owncloud/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Amazon Alexa PHP Prompt and Response Example (Hello World Part 2)</title>
		<link>https://blog.gaiterjones.com/amazon-alexa-php-prompt-and-response-example/</link>
					<comments>https://blog.gaiterjones.com/amazon-alexa-php-prompt-and-response-example/#comments</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Sat, 15 Apr 2017 12:43:10 +0000</pubDate>
				<category><![CDATA[Alexa]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[alex]]></category>
		<category><![CDATA[hello world]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[prompt]]></category>
		<category><![CDATA[response]]></category>
		<category><![CDATA[session]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=1562</guid>

					<description><![CDATA[NOTE &#8211; this blog entry was written for the old version of the Alexa Skills Kit Developer Console &#8211; whilst the PHP server code still works some info and screen...<a class="more-link" href="https://blog.gaiterjones.com/amazon-alexa-php-prompt-and-response-example/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p><strong>NOTE &#8211; this blog entry was written for the old version of the Alexa Skills Kit Developer Console &#8211; whilst the PHP server code still works some info and screen shots of the developer console are now obsolete!</strong></p>
<p>In <a href="https://blog.gaiterjones.com/amazon-alexa-php-hello-world-example/">part one of the Alexa PHP Hello World example</a> I created a very basic skill and a PHP app to show how to handle Amazon Alexa IntentRequest data and provide a response. In part two I will extend the code to allow us to create interactive prompt and responses.</p>
<p><em>If you are new to Alex skills and PHP read <a href="https://blog.gaiterjones.com/amazon-alexa-php-hello-world-example/">part one</a> of this Hello World example first.</em></p>
<p>To demonstrate prompt and responses we will ask Alexa for a &#8220;clever quote&#8221;, Alexa will give us the quote and ask if we want another. If the user replies <em>yes</em>, Alexa reads another quote and prompts again until all the available quotes have been used.</p>
<figure id="attachment_1574" aria-describedby="caption-attachment-1574" style="width: 400px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-1574 size-full" src="https://blog.gaiterjones.com/wp-content/uploads/2017/04/alexa-clever-quotes-1.jpg" alt="" width="400" height="473" /><figcaption id="caption-attachment-1574" class="wp-caption-text">Clever Quotes</figcaption></figure>
<h1>Alexa Prompt and Response</h1>
<p>To allow this prompt and response interaction we simply tell our skill to keep the session open when we require a response, and we store the data we need for the session in the session attributes array.</p>
<p>First let&#8217;s modify the Hello World skill interaction model :</p>
<p>&nbsp;</p>
<pre class="brush: plain; title: ; notranslate">
{
  &quot;intents&quot;: &#x5B;
    {
      &quot;slots&quot;: &#x5B;
        {
          &quot;name&quot;: &quot;command&quot;,
          &quot;type&quot;: &quot;COMMANDOBJECTS&quot;
        },
        {
          &quot;name&quot;: &quot;prompt&quot;,
          &quot;type&quot;: &quot;PROMPTOBJECTS&quot;
        }
      ],
      &quot;intent&quot;: &quot;HelloWorld&quot;
    },
    {
      &quot;intent&quot;: &quot;HelpIntent&quot;
    }
  ]
}
</pre>
<p>Now we have command and prompt slots, with command objects and prompt objects to catch our prompt and response utterances. I have also added two new utterances</p>
<p><em>HelloWorld for {command}</em><br />
<em>HelloWorld {prompt}</em></p>
<h1>&#8220;Clever&#8221; quotes</h1>
<p>The clever quotes data is an array of sentences stored in <em>Data::cleverQuotes(). </em>We load the data, and then create a list of random numbers we will use as array keys to get random quotes from the array. The list of random array keys will be stored in the session data.</p>
<pre class="brush: php; title: ; notranslate">
// clever quotes data
//
$_cleverQuotesData=Data::cleverQuotes();
$_cleverQuotesArrayKeys= range(0, (count($_cleverQuotesData)-1));
shuffle($_cleverQuotesArrayKeys);
</pre>
<p>&nbsp;</p>
<ul>
<li>alexa ask hello world for clever quotes</li>
</ul>
<p>In the HelloWorld php intent class I have added some new code to parse the user request for clever quotes. The response includes the first &#8220;clever quote&#8221; fetched from the array using the first of our random array key numbers and the prompt to the user &#8211; &#8220;<em>would you like some more clever quotes</em>&#8220;. We also set <em>endsession</em> to false to keep the session open and save the random key data and prompt count data we need for the next session.</p>
<p>&nbsp;</p>
<pre class="brush: php; title: ; notranslate">
// response
//
return array(
	'intent' =&gt; array(
		'response' =&gt; 'Ok, here comes your first clever quote : '. $_cleverQuotesData&#x5B;$_cleverQuotesArrayKeys&#x5B;0]]. ' Would you like some more clever quotes?',
		'card' =&gt; array(
			'title' =&gt; $_target,
			'text' =&gt; $_now-&gt;format('H:i:s'). ' '. $_cleverQuotesData&#x5B;$_cleverQuotesArrayKeys&#x5B;0]],
			'image' =&gt; false
		),											
		'target' =&gt; $_target,
		'status' =&gt; false,
		'sessionattributes' =&gt; array('object' =&gt; 'clever quotes','target' =&gt; $_target,'prompt' =&gt; true, 'count' =&gt; 1,'data' =&gt; $_cleverQuotesArrayKeys),
		'endsession' =&gt; false
	)
);
</pre>
<p>With the session still open the user has about 8 seconds to reply and we will see the response in the prompt slot. In the same way we parse the command slot data we parse the response slots for the <em>yes</em> or <em>no</em> response from the user.</p>
<p>If the user responded with yes, we extract the data we need from the session to provide the next &#8220;clever quote&#8221; and then provide the exact same response and session data including an incremented prompt count variable.</p>
<p>If there are no more quotes available we respond appropriately and end the session. Similarly if the user responds with no, we respond and end the session by setting <em>endsession</em> to true.</p>
<h1>Alexa Session Data</h1>
<p>If you check the logs generated by the php script you will see the session data:</p>
<p>&nbsp;</p>
<pre class="brush: plain; title: ; notranslate">
    &#x5B;session] &gt; Array
        (
            &#x5B;new] &gt; 
            &#x5B;sessionId] &gt; SessionId.1-2-3
            &#x5B;application] &gt; Array
                (
                    &#x5B;applicationId] &gt; amzn1.ask.skill.1-2-3
                )

            &#x5B;attributes] &gt; Array
                (
                    &#x5B;data] &gt; Array
                        (
                            &#x5B;0] &gt; 0
                            &#x5B;1] &gt; 1
                            &#x5B;2] &gt; 5
                            &#x5B;3] &gt; 3
                            &#x5B;4] &gt; 7
                            &#x5B;5] &gt; 4
                            &#x5B;6] &gt; 10
                            &#x5B;7] &gt; 6
                            &#x5B;8] &gt; 2
                            &#x5B;9] &gt; 8
                            &#x5B;10] &gt; 9
                        )

                    &#x5B;count] &gt; 1
                    &#x5B;prompt] &gt; 1
                    &#x5B;object] &gt; clever quotes
                    &#x5B;target] &gt; clever quotes
                )

            &#x5B;user] &gt; Array
                (
                    &#x5B;userId] &gt; amzn1.ask.account.123
                )
</pre>
<h1>Custom Help and Launch intent</h1>
<p>Alexa has some default built in intents such as STOP, HELP and LAUNCH.</p>
<p>When you say &#8220;Alex open skillname&#8221; the LAUNCH intent is used. When you say HELP in a skill, the HELP intent is used. When you submit your skill Amazon will check these intents for functionality. To create your own custom LAUNCH and HELP intent responses you must create or edit the example file in AmazonDev/Alexa/Launch and AmazonDev/Alexa/Help.</p>
<p>The filenames should be as follows</p>
<p><em>launch123.php<br />
help123.php</em></p>
<p>Where 123 is replaced with the last digits from your skill id, i.e. if your skill id is <em>amzn1.ask.skill.111-222-333-444-555</em> then the launch and intent filenames should be</p>
<p><em>launch555.php<br />
help555.php</em></p>
<p>You should also change the class name of the launch and help classes to the same as the filename (without .php). Now you can customise the launch and help intent for you skill by editing the responses in the help and launch methods.</p>
<pre class="brush: php; title: ; notranslate">
	public static function help($_alexaRequest=false)
	{
		$_response=&quot;Hello, I am happy to Help! To start this skill please say 'Alexa, open Hello World'&quot;;
		$_card=false;
		$_endSession=false;
		$_sessionAttributes=false;
		$_outputSSML=false;

		return array(
			'response' =&gt; $_response,
			'card' =&gt; $_card,
			'endsession' =&gt; $_endSession,
			'sessionattributes' =&gt; $_sessionAttributes,
			'outputssml' =&gt; $_outputSSML
		);

	}
</pre>
<p>You can see here that it is relatively simple to include prompts and responses in your Alexa skill by controlling and storing data in the skill session.</p>
<p>The example &#8220;clever quotes&#8221; intent show here is published in the Alexa skill store as &#8220;Clever Stuff&#8221;.</p>
<p>The updated code for this Hello World and Clever Quotes example is <a href="https://github.com/gaiterjones/amazon-alexa-php-hello-world-example">available from github here</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/amazon-alexa-php-prompt-and-response-example/feed/</wfw:commentRss>
			<slash:comments>35</slash:comments>
		
		
			</item>
		<item>
		<title>Amazon Alexa PHP Hello World Example</title>
		<link>https://blog.gaiterjones.com/amazon-alexa-php-hello-world-example/</link>
					<comments>https://blog.gaiterjones.com/amazon-alexa-php-hello-world-example/#comments</comments>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Tue, 13 Dec 2016 18:33:25 +0000</pubDate>
				<category><![CDATA[Alexa]]></category>
		<category><![CDATA[Amazon]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Raspberry Pi]]></category>
		<category><![CDATA[alexa]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[echo]]></category>
		<category><![CDATA[hello world]]></category>
		<category><![CDATA[php]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=1481</guid>

					<description><![CDATA[NOTE &#8211; this blog entry was written for the old version of the Alexa Skills Kit Developer Console &#8211; whilst the PHP server code still works some info and screen...<a class="more-link" href="https://blog.gaiterjones.com/amazon-alexa-php-hello-world-example/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p><strong>NOTE &#8211; this blog entry was written for the old version of the Alexa Skills Kit Developer Console &#8211; whilst the PHP server code still works some info and screen shots of the developer console are now obsolete!</strong></p>
<p>This Christmas (2016) a lot of people in Europe will be unpacking a shiny new Amazon Echo device and enjoying meaningful discussions with Alexa about life, the universe and everything.</p>
<p>If you are a geek like me then you will probably want Alexa to do a bit more than tell you about the weather or play Last Christmas by Wham. I bought my Amazon Echo Dot primarily to use for extremely important Home Automation tasks such as &#8216;<em>Alexa, switch on the Christmas Tree lights</em>&#8216;.</p>
<p>The developer documentation from Amazon is good but very biased towards node.js. I know absolutely nothing about node.js and some of the online examples seemed overly complex to me. Eventually I found some useable PHP code examples and set about creating my own flexible PHP server side app for handling Alexa requests.</p>
<p>The app I created uses Alexa to send home automation commands via an Internet server to a home based Raspberry Pi server that lets me control Lights and Audio equipment. This is a step by step Hello World example using the same script that shows how relatively simple it is to create an Amazon Alexa App using PHP on your server to handle requests.</p>
<p>Before we start, here is a shopping list of things you will need :</p>
<ol>
<li>Amazon developer account</li>
<li>Internet accessible web server (project tested with Apache)</li>
<li>SSL Certificate</li>
<li>PHP</li>
<li>Amazon Echo</li>
</ol>
<p>&nbsp;</p>
<h1>1. Install and Test the PHP Application</h1>
<ul>
<li>Download my example PHP application and extract it to your web server
<ul>
<li><a href="https://github.com/gaiterjones/amazon-alexa-php-hello-world-example"><strong>https://github.com/gaiterjones/amazon-alexa-php-hello-world-example</strong></a></li>
<li>preserve the file and folder structure
<ul>
<li>Application</li>
<li>Library</li>
<li>www</li>
<li>autoload.php</li>
</ul>
</li>
<li>Your web server needs to be able to serve web pages over SSL.</li>
</ul>
</li>
<li>create a folder that is writeable by your www server user, i.e. www-admin
<ul>
<li>configure this folder path as amazonCacheFolder in config.php
<ul>
<li><em>const amazonCacheFolder=&#8217;/home/www/amazon/cache/&#8217;;</em></li>
</ul>
</li>
</ul>
</li>
<li>make the file <em>PAJ/www/AmazonDev/alexa.php</em> web accessible
<ul>
<li>Test that the application is working by browsing to
<ul>
<li><strong><span style="color: #ff0000;">https</span>://www.your.server/youralias/alexa.php?debug</strong></li>
</ul>
</li>
<li>Make sure you see
<ul>
<li><strong>PAJ\Application\AmazonDev\AlexaRequest</strong></li>
<li><em>logfolder is writeable</em></li>
</ul>
</li>
<li>note the debug curl information as this will be helpful in testing access to your application.</li>
</ul>
</li>
</ul>
<h1>2. Register a Developer Account</h1>
<p>Register and login to Amazon Developer Services at <a href="https://developer.amazon.com/home.html">https://developer.amazon.com</a>. You should register with the Amazon account you used to setup your Amazon Echo device. Once you are registered and logged in, click on the <em>Alexa</em> tab, and then the <em>Get Started</em> button for the Alexa Skills Kit and click the <em>Add a New Skill</em> button.</p>
<figure id="attachment_1484" aria-describedby="caption-attachment-1484" style="width: 550px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-1484 size-large" src="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image1-620x203.png" alt="Getting started with Alexa" width="550" height="180" srcset="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image1-620x203.png 620w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image1-440x144.png 440w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image1-768x252.png 768w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image1-760x249.png 760w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image1-550x180.png 550w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image1.png 1025w" sizes="(max-width: 550px) 100vw, 550px" /><figcaption id="caption-attachment-1484" class="wp-caption-text">Getting started with Alexa</figcaption></figure>
<figure id="attachment_1486" aria-describedby="caption-attachment-1486" style="width: 513px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-1486 size-full" src="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image.png" alt="Add a new skill" width="513" height="301" srcset="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image.png 513w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-440x258.png 440w" sizes="(max-width: 513px) 100vw, 513px" /><figcaption id="caption-attachment-1486" class="wp-caption-text">Add a new skill</figcaption></figure>
<p>&nbsp;</p>
<h1>3. Create and Test the Alexa Skill</h1>
<h2>Skill Information</h2>
<p>Amazon calls the process used to interact with the Alexa Voice Service a Skill. We will create a new private skill called Hello World.</p>
<figure id="attachment_1490" aria-describedby="caption-attachment-1490" style="width: 550px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-1490 size-large" src="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-1-620x387.png" alt="Alexa Skill Information" width="550" height="343" srcset="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-1-620x387.png 620w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-1-440x274.png 440w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-1-768x479.png 768w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-1-760x474.png 760w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-1-550x343.png 550w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-1.png 837w" sizes="(max-width: 550px) 100vw, 550px" /><figcaption id="caption-attachment-1490" class="wp-caption-text">Alexa Skill Information</figcaption></figure>
<p>&nbsp;</p>
<ul>
<li>Skill Type
<ul>
<li>choose Custom Interaction Model</li>
</ul>
</li>
<li>Language
<ul>
<li>Select from drop down</li>
</ul>
</li>
<li>Name
<ul>
<li>The name of the skill
<ul>
<li>Hello World</li>
</ul>
</li>
</ul>
</li>
<li>Invocation Name
<ul>
<li>This is the name we will use to activate the skill when talking to Alexa
<ul>
<li>hello world
<ul>
<li>&#8220;<em>Alexa, ask <strong>hello world</strong> to say hello world</em>&#8220;</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li>Click Next</li>
</ul>
<p>&nbsp;</p>
<h2>Interaction Model &#8211; Skill Builder Beta</h2>
<p>The interaction model describes how the user will interact with the voice service. In the context of Alexa, an intent represents an action that fulfills a user’s spoken request. Intents can optionally have arguments called slots. The intent schema is configured as an array in JavaScript Object Notation (JSON) format.</p>
<p>Use the Skill Builder Beta and paste the following skills builder intent json schema into the code section :</p>
<p><img loading="lazy" decoding="async" class="aligncenter wp-image-1739 size-full" src="https://blog.gaiterjones.com/wp-content/uploads/2016/12/alexa-skills-kit.png" alt="" width="400" height="418" /></p>
<p>&nbsp;</p>
<span class="collapseomatic collapse" id="id6603741ac5291"  tabindex="0" title="Show interaction model json"    >Show interaction model json</span><div id="target-id6603741ac5291" class="collapseomatic_content ">
[text]
{<br />
  &quot;intents&quot;: [<br />
    {<br />
      &quot;name&quot;: &quot;AMAZON.CancelIntent&quot;,<br />
      &quot;samples&quot;: []
    },<br />
    {<br />
      &quot;name&quot;: &quot;AMAZON.HelpIntent&quot;,<br />
      &quot;samples&quot;: []
    },<br />
    {<br />
      &quot;name&quot;: &quot;AMAZON.StopIntent&quot;,<br />
      &quot;samples&quot;: []
    },<br />
    {<br />
      &quot;name&quot;: &quot;HelloWorld&quot;,<br />
      &quot;samples&quot;: [<br />
        &quot;say {command}&quot;,<br />
        &quot;for {command}&quot;,<br />
        &quot;{prompt}&quot;<br />
      ],<br />
      &quot;slots&quot;: [<br />
        {<br />
          &quot;name&quot;: &quot;command&quot;,<br />
          &quot;type&quot;: &quot;COMMANDOBJECTS&quot;,<br />
          &quot;samples&quot;: []
        },<br />
        {<br />
          &quot;name&quot;: &quot;prompt&quot;,<br />
          &quot;type&quot;: &quot;PROMPTOBJECTS&quot;,<br />
          &quot;samples&quot;: []
        }<br />
      ]
    }<br />
  ],<br />
  &quot;types&quot;: [<br />
    {<br />
      &quot;name&quot;: &quot;COMMANDOBJECTS&quot;,<br />
      &quot;values&quot;: [<br />
        {<br />
          &quot;name&quot;: {<br />
            &quot;value&quot;: &quot;hello world&quot;<br />
          }<br />
        },<br />
        {<br />
          &quot;name&quot;: {<br />
            &quot;value&quot;: &quot;clever quotes&quot;<br />
          }<br />
        }<br />
      ]
    },<br />
    {<br />
      &quot;name&quot;: &quot;PROMPTOBJECTS&quot;,<br />
      &quot;values&quot;: [<br />
        {<br />
          &quot;name&quot;: {<br />
            &quot;value&quot;: &quot;yes&quot;<br />
          }<br />
        },<br />
        {<br />
          &quot;name&quot;: {<br />
            &quot;value&quot;: &quot;no&quot;<br />
          }<br />
        },<br />
        {<br />
          &quot;name&quot;: {<br />
            &quot;value&quot;: &quot;ok&quot;<br />
          }<br />
        },<br />
        {<br />
          &quot;name&quot;: {<br />
            &quot;value&quot;: &quot;sure&quot;<br />
          }<br />
        }<br />
      ]
    }<br />
  ]
}<br />
[/text]
</div>
<figure id="attachment_1736" aria-describedby="caption-attachment-1736" style="width: 600px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-1736 size-full" src="https://blog.gaiterjones.com/wp-content/uploads/2016/12/amazon-skill-builder-beta.jpg" alt="" width="600" height="483" /><figcaption id="caption-attachment-1736" class="wp-caption-text">Amazon Skill Builder</figcaption></figure>
<p>Here we have defined our intent name <strong>HelloWorld</strong> and associated slots.</p>
<p>Some default Intents are added by Amazon</p>
<p><em>AMAZON.CancelIntent</em><br />
<em> AMAZON.HelplIntent</em><br />
<em> AMAZON.StoplIntent</em></p>
<p>You can think of slots as variables to the intent, we have a slot (variable) named <em>command</em> with possible values contained in the <em>COMMANDOBJECTS </em>intent slot.</p>
<p>Next we configure the sample utterances for the skill. These are what people say to Alexa to invoke the intents configured in the skill.</p>
<figure id="attachment_1737" aria-describedby="caption-attachment-1737" style="width: 600px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-1737 size-full" src="https://blog.gaiterjones.com/wp-content/uploads/2016/12/amazon-skill-builder-beta-sample-utterances.jpg" alt="" width="600" height="413" /><figcaption id="caption-attachment-1737" class="wp-caption-text">Sample Utterances</figcaption></figure>
<p>The sample utterance starts with the intent name <strong>HelloWorld</strong>, followed by any combination of words a user might use to interact with the skill, and then the slot name that corresponds with this interaction.</p>
<p>When a user interacts with our Alexa Skill</p>
<p style="text-align: center;"><em>&#8216;Alexa, ask hello world to say hello world&#8217;</em></p>
<p style="text-align: left;">The voice service try to determine the user intention by matching the spoken words to the configured utterances, invoking the configured intent and matching the slot values to the phrases provided to the slot. In this case it will match &#8216;<em>hello world</em>&#8216; to the value configured in the command slot of the <em>HelloWorld</em> intent. This data will be sent to our server for us to process.</p>
<p style="text-align: left;">Why use slots? By using the amazon voice service to process and match the users spoken words to a configured set of slot variables (object types) we do not have to process the spoken words ourselves, we simply match the slot type to the command or processes we want to execute making it easier to determine user intent.</p>
<p style="text-align: left;">When you are finished configuring the Skill Builder you must save your configuration by clicking the Save Model button, and then build the model by clicking the Build Model button.</p>
<h2 style="text-align: left;">Configuration</h2>
<figure id="attachment_1499" aria-describedby="caption-attachment-1499" style="width: 550px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-1499 size-large" src="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-5-620x373.png" alt="Configuration" width="550" height="331" srcset="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-5-620x373.png 620w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-5-440x265.png 440w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-5-768x462.png 768w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-5-760x458.png 760w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-5-550x331.png 550w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-5.png 842w" sizes="(max-width: 550px) 100vw, 550px" /><figcaption id="caption-attachment-1499" class="wp-caption-text">Configuration</figcaption></figure>
<p>Now we will configure how the Skill communicates with our PHP application.</p>
<ul>
<li>Select HTTPS</li>
<li>Select the geographical location closest to your server</li>
<li>Enter the URL to the Alexa php script on your server
<ul>
<li><strong>https://www.your.server/youralias/alexa.php</strong></li>
</ul>
</li>
</ul>
<p>&nbsp;</p>
<p style="text-align: left;">Click Next.</p>
<h2 style="text-align: left;">SSL Certificate</h2>
<figure id="attachment_1500" aria-describedby="caption-attachment-1500" style="width: 571px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-1500 size-full" src="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-6.png" alt="SSL Certificate" width="571" height="251" srcset="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-6.png 571w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-6-440x193.png 440w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-6-550x242.png 550w" sizes="(max-width: 571px) 100vw, 571px" /><figcaption id="caption-attachment-1500" class="wp-caption-text">SSL Certificate</figcaption></figure>
<p style="text-align: left;">Assuming your web server has a valid SSL certificate select &#8216;My development endpoint has a certificate from a trusted certificate authority&#8217;.</p>
<p style="text-align: left;">Click Next.</p>
<h2 style="text-align: left;">TEST</h2>
<p>We can now test the Skill and server PHP application by using the service simulator.</p>
<figure id="attachment_1501" aria-describedby="caption-attachment-1501" style="width: 550px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-1501 size-large" src="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-7-620x392.png" alt="Testing Alexa Skill" width="550" height="348" srcset="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-7-620x392.png 620w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-7-440x278.png 440w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-7-768x486.png 768w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-7-760x481.png 760w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-7-550x348.png 550w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Image-7.png 844w" sizes="(max-width: 550px) 100vw, 550px" /><figcaption id="caption-attachment-1501" class="wp-caption-text">Testing Alexa Skill</figcaption></figure>
<p>&nbsp;</p>
<p>In the Enter Utterance text box we can type the phrase we would say to invoke the application using our Echo device</p>
<p style="text-align: center;">Alexa, ask hello world to say hello world</p>
<p style="text-align: left;">The application will fail with an exception error if you have not yet added your amazon credentials to the config file in PAJ/Application/Amazon/Alexa/config.php. You can see the application id and userid in the service request. Copy these and add them to config.php.</p>
<pre class="brush: php; title: ; notranslate">
	// AMAZON ALEXA
	const amazonSkillId = 'amzn1.ask.skill.XXX';
	const amazonUserId = 'amzn1.ask.account.XXX';
	const amazonEchoServiceDomain = 'echo-api.amazon.com';
	const amazonCacheFolder='/home/www/amazon/cache';
</pre>
<p>Run the test again. If the application is working you will see the service response JSON data returned from our PHP application, and the text that would be spoken by the Echo device.</p>
<pre class="brush: plain; title: ; notranslate">
  &quot;response&quot;: {
    &quot;outputSpeech&quot;: {
      &quot;type&quot;: &quot;PlainText&quot;,
      &quot;text&quot;: &quot;OK, I will now say hello world&quot;
    },
</pre>
<h2>Publishing</h2>
<p>The publishing information is used to define how the app will appear to users if it is made public. This includes the category, countries the app will be available in, description, sample phrases and images.</p>
<p>This information will also be displayed in the Alexa mobile app.</p>
<p>You cannot publish your app until you have completed this section. When all sections are complete the Submit for Certification button will be available. Clicking this will begin the certification process where Amazon checks your app for compliance and functionality before publishing it in the Alexa Skills store and making it publicly accessible.</p>
<h2>Privacy &amp; Compliance</h2>
<p>Complete the privacy and Compliance section and click Save to save the Skill.</p>
<p>&nbsp;</p>
<h1>4. Test with Amazon Echo device</h1>
<p>To use your newly created Hello World skill with your Echo device make sure the skill is visible and enabled in the Alexa app, under <em>Home</em> -&gt; <em>Skills</em> select <em>Your Skills</em></p>
<p>&nbsp;</p>
<figure id="attachment_1504" aria-describedby="caption-attachment-1504" style="width: 411px" class="wp-caption aligncenter"><img loading="lazy" decoding="async" class="wp-image-1504" src="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Photo-13-12-2016-12-23-07-620x514.png" alt="Select your skill in Alexa App" width="411" height="341" srcset="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Photo-13-12-2016-12-23-07-620x514.png 620w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Photo-13-12-2016-12-23-07-440x365.png 440w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Photo-13-12-2016-12-23-07-550x456.png 550w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Photo-13-12-2016-12-23-07.png 750w" sizes="(max-width: 411px) 100vw, 411px" /><figcaption id="caption-attachment-1504" class="wp-caption-text">Select your skill in Alexa App</figcaption></figure>
<p>Now say to Alexa</p>
<p style="text-align: center;"><em>Alexa, ask hello world to say hello world</em></p>
<p style="text-align: left;">Your Echo device will respond with</p>
<p style="text-align: center;"><em>OK, I will now say hello world<br />
</em></p>
<p style="text-align: left;">You can also say, &#8216;<em>Alexa, open hello world</em>&#8216;, this initiates a Launch Request.</p>
<p style="text-align: left;">Ok, so this is a bit lame, change the output text response by modifying the response text in the HelloWorld.php intent return array.</p>
<pre class="brush: php; title: ; notranslate">
	return array(
		'intent' =&amp;amp;amp;amp;amp;amp;amp;gt; array(
			'response' =&amp;amp;amp;amp;amp;amp;gt; 'OK, I will now say something much more meaningful',
			'target' =&amp;amp;amp;amp;amp;amp;gt; $_target,
			'status' =&amp;amp;amp;amp;amp;amp;gt; false
		)
	);

</pre>
<h1 style="text-align: left;">How the PHP application works</h1>
<p>The PHP server side process is relatively straightforward:</p>
<ul>
<li>Amazon sends the Alexa request data as an HTTP POST request to alexa.php.
<ul>
<li>alexa.php initiates the wwwApp bootload which injects the following php objects
<ul>
<li>Config
<ul>
<li>config data for the app</li>
</ul>
</li>
<li>Security
<ul>
<li>validates the Alexa Request as per the guidelines <a href="https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skill-as-a-web-service">here</a>.</li>
<li> This includes :
<ul>
<li>Validating the amazon application id</li>
<li>Verifying that the Request was Sent by Alexa
<ul>
<li><span>determine whether the URL meets each of the following criteria:</span>
<ul>
<li><span>The protocol is equal to https (case insensitive).</span></li>
<li><span>The hostname is equal to s3.amazonaws.com (case insensitive).</span></li>
<li><span>The path starts with /echo.api/ (case sensitive).</span></li>
<li><span>If a port is defined in the URL, the port is equal to 443.</span></li>
</ul>
</li>
</ul>
</li>
<li>Validate the Signature of the Request</li>
<li>Validate the Timestamp of the Request</li>
</ul>
</li>
</ul>
</li>
<li>Log
<ul>
<li>logging</li>
</ul>
</li>
<li>Request
<ul>
<li>parses the alexa post data</li>
</ul>
</li>
<li>Data
<ul>
<li>renders the response</li>
<li>renders default intent responses
<ul>
<li>STOP, CANCEL, HELP</li>
</ul>
</li>
<li>render LaunchRequest response
<ul>
<li>open hello world</li>
</ul>
</li>
<li>initiating PAJ\Application\AmazonDev\Alexa\Intent\IntentName()</li>
<li>processing the Amazon intent data
<ul>
<li>formulating a text response based on the process data, in this case simply returning the response text for hello world
<ul>
<li>&#8216;<em>OK, I will now say hello world</em>&#8216;</li>
</ul>
</li>
<li>managing session attribute data</li>
</ul>
</li>
<li>wrapping the response text and card data into a JSON request and outputting it</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<p>If you look at HelloWorld.php in Alexa\Intent you will see how we are parsing the intent data from Amazon, looping through the slot data and performing an action on each slot. In this case looking for the &#8216;command&#8217; slot, validating the spoken words and then acting on them to formulate a response.</p>
<p>&nbsp;</p>
<h2>Further customisation</h2>
<p>Here you can also see how you can now further customise the application. For example suppose you want to ask alexa to turn the lounge lights on</p>
<p style="text-align: center;"><em>&#8216;Alexa, ask Home to switch the lounge lights on&#8217;</em></p>
<p style="text-align: left;">Here my Alexa Skill is called Home, my intent name is Command, and I have configures a slot called switch which contains object types (variables) such as &#8216;lounge lights on&#8217; and &#8216;lounge lights off&#8217;.</p>
<p style="text-align: left;">In Alexa/Intent/Command.php I parse the intent data to find the <em>switch </em>slot, verify that the slot value contains either &#8216;lounge lights on&#8217;, or &#8216;lounge lights off&#8217; and the send the appropriate commands to my home automation system, i.e. <a href="http://www.fhem.de">FHEM</a>. When the command has been successfully executed I can return the appropriate response.</p>
<p style="text-align: left;"><img loading="lazy" decoding="async" class="aligncenter wp-image-1515" src="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Photo-15-12-2016-12-11-24-516x620.png" alt="" width="344" height="413" srcset="https://blog.gaiterjones.com/wp-content/uploads/2016/12/Photo-15-12-2016-12-11-24-516x620.png 516w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Photo-15-12-2016-12-11-24-366x440.png 366w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Photo-15-12-2016-12-11-24-550x661.png 550w, https://blog.gaiterjones.com/wp-content/uploads/2016/12/Photo-15-12-2016-12-11-24.png 750w" sizes="(max-width: 344px) 100vw, 344px" /></p>
<p style="text-align: center;"><em>&#8216;Ok, I have switched the lounge lights on&#8217;</em></p>
<h1>Debugging</h1>
<p>If the Application is not working as expected check out the logfiles in your cache folder, for each Amazon Alexa request you will see the request, intent and response data logged in a file called helloworld_yyyy-mm-dd.log.</p>
<p>Use the skills tester in the Amazon skill builder to test and debug your skill. To debug further use the example curl command from the debug page. Execute this from a bash terminal to run curl and simulate an alexa request to your application.</p>
<h1>Amazon Default Intents</h1>
<p>You will notice that Amazon includes some default intents in the interaction model : AMAZON.StopIntent, AMAZON.CancelIntent, AMAZON.HelpIntent. If you want to publish your skill you must also include responses for these default intents. The default response for the Stop and Cancel intent is included in the renderAlexaResponse method. An examples for the Stop intent can be found in the Help folder.</p>
<h1>Prompt and Response Dialog</h1>
<p>Having completed a basic Alex command skill I will extend this PHP example to allow for prompts and responses <a href="https://blog.gaiterjones.com/amazon-alexa-php-prompt-and-response-example/">in part 2 of this blog post</a>.</p>
<h1>Submit for Certification</h1>
<p>Alexa Skills built with this project will pass the Amazon certification process. After submitting your skill you will receive a confirmation email from Amazon, and within 24 hours a response to notify you whether your skill has passed certification of not. Once your skill has been certified you cannot make any changes to the skill configuration without revoking it&#8217;s published status.</p>
<p>If you publish a skill with this application please let us know in the comments!</p>
]]></content:encoded>
					
					<wfw:commentRss>https://blog.gaiterjones.com/amazon-alexa-php-hello-world-example/feed/</wfw:commentRss>
			<slash:comments>48</slash:comments>
		
		
			</item>
		<item>
		<title>Amazon iFrame X-Frame-Options SAMEORIGIN error</title>
		<link>https://blog.gaiterjones.com/amazon-iframe-x-frame-options-sameorigin-error/</link>
		
		<dc:creator><![CDATA[PAJ]]></dc:creator>
		<pubDate>Fri, 17 Jan 2014 08:39:41 +0000</pubDate>
				<category><![CDATA[Amazon]]></category>
		<category><![CDATA[Grumps]]></category>
		<guid isPermaLink="false">http://blog.gaiterjones.com/?p=1076</guid>

					<description><![CDATA[I didn&#8217;t realize that Amazon restricted access to product content in iframes with an X-Frame-Options header until yesterday (16.02.2014) when they applied the same iFrame restrictions to their admin backend...<a class="more-link" href="https://blog.gaiterjones.com/amazon-iframe-x-frame-options-sameorigin-error/" title="Continue reading">Continue reading</a>]]></description>
										<content:encoded><![CDATA[<p><img loading="lazy" decoding="async" class="hang-2-column      alignnone" alt="" src="http://www.abc.nl/blog/wp-content/uploads/2008/10/mr-grumpy.jpg" width="180" height="164" />I didn&#8217;t realize that Amazon restricted access to product content in iframes with an X-Frame-Options header until yesterday (16.02.2014) when they applied the same iFrame restrictions to their admin backend <strong>Amazon Seller Central</strong>.</p>
<p>This made me very grumpy.</p>
<p>I created an eBay and Amazon admin website to allow us to consolidate order info from both merchants. It was useful to go directly from this site to the Amazon order in seller central by clicking on a button, even more useful was showing this in a fancybox iframe so the user didn&#8217;t have to leave the admin page. This worked, up until yesterday, when the iframe request is cancelled due to a :</p>
<p><em>Refused to display &#8230;. in a frame because it set &#8216;X-Frame-Options&#8217; to &#8216;SAMEORIGIN&#8217;.</em></p>
<p>X-Frame-Options is an HTTP response header to prevent framing of pages. If the header is present the browser will refuse to render (cancel) the page in a frame depending on the values:</p>
<p><strong>DENY</strong> &#8211; stops all framing<br />
<strong>SAMEORIGIN</strong> &#8211; stops framing except for requests from the website itself.</p>
<p>So it looks like Amazon changed the security policy on their customer admin pages (Seller Central) yesterday to match the front end product pages and block frame request to content using the SAMEORIGIN header. There is no way around this so it is no longer possible to frame any amazon content. <strong>Boo</strong>!</p>
<p>The workaround is to load the content into a new _blank page and not use iframes &#8211; <strong>Hurrah</strong>!</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
