<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/rss-style.css?cache=2026-11-13T15:19:59+00:00" type="text/css"?>
<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/"
	>
<html:meta xmlns:html="http://www.w3.org/1999/xhtml" name="viewport" content="width=device-width" />
<channel>
	<title>skill &#8211; Terence Eden’s Blog</title>
	<atom:link href="https://shkspr.mobi/blog/tag/skill/feed/" rel="self" type="application/rss+xml" />
	<link>https://shkspr.mobi/blog</link>
	<description>Regular nonsense about tech and its effects 🙃</description>
	<lastBuildDate>Thu, 05 Sep 2024 08:10:13 +0000</lastBuildDate>
	<language>en-GB</language>
	<copyright>© Terence Eden. 🄯 CC BY-SA. See https://shkspr.mobi/blog/copyright-and-copyleft/</copyright>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1.5</generator>

<image>
	<url>https://shkspr.mobi/blog/wp-content/uploads/2023/07/cropped-avatar-32x32.jpeg</url>
	<title>skill &#8211; Terence Eden’s Blog</title>
	<link>https://shkspr.mobi/blog</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title><![CDATA[Quick and Dirty Self-Hosted Alexa Skills (2019)]]></title>
		<link>https://shkspr.mobi/blog/2019/09/quick-and-dirty-self-hosted-alexa-skills-2019/</link>
					<comments>https://shkspr.mobi/blog/2019/09/quick-and-dirty-self-hosted-alexa-skills-2019/#comments</comments>
				<dc:creator><![CDATA[Terence Eden]]></dc:creator>
		<pubDate>Thu, 05 Sep 2019 06:50:44 +0000</pubDate>
		<category><![CDATA[AI]]></category><category><![CDATA[alexa]]></category><category><![CDATA[HowTo]]></category><category><![CDATA[PHP]]></category><category><![CDATA[skill]]></category><category><![CDATA[tutorial]]></category>		<guid isPermaLink="false">https://shkspr.mobi/blog/?p=32631</guid>

		
		<description>I hate creating Alexa skills. What should be a 3-click process inevitably ends up requiring trips to multiple websites, to set up weird parameters, and reading outdated tutorials for obsolete libraries.  So this is how to create a self-hosted Skill, using PHP. It runs on your own server and doesn't require any interaction.  The Skill  At a basic level, all your website has to do is spit out a…</description>
			
		<content:encoded>&lt;p&gt;I hate creating Alexa skills. What should be a 3-click process inevitably ends up requiring trips to multiple websites, to set up weird parameters, and reading outdated tutorials for obsolete libraries.&lt;/p&gt;

&lt;p&gt;So this is how to create a self-hosted Skill, using PHP. It runs on your own server and doesn't require any interaction.&lt;/p&gt;

&lt;h2 id="the-skill"&gt;&lt;a href="https://shkspr.mobi/blog/2019/09/quick-and-dirty-self-hosted-alexa-skills-2019/#the-skill"&gt;The Skill&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;At a basic level, all your website has to do is spit out &lt;a href="https://developer.amazon.com/docs/custom-skills/request-and-response-json-reference.html#standard-response-to-canfulfillintentrequest-launchrequest-or-intentrequest-example"&gt;a piece of JSON for Alexa&lt;/a&gt; to read out.&lt;/p&gt;

&lt;pre&gt;&lt;code class="language-php"&gt;//   Set the correct header for JSON data
header('Content-Type: application/json');
//   Set the response
$response = [
  "response" =&amp;gt; [
    "outputSpeech" =&amp;gt; [
      "type" =&amp;gt; "PlainText",
      "text" =&amp;gt; "I'm a little teapot"
    ]
  ]
];
echo json_encode($response);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;This is perfect for when you have a simple query - "Yo! Alexa! Bus time?" - one question, no parameters.&lt;/p&gt;

&lt;p&gt;OK, you can make &lt;a href="https://developer.amazon.com/docs/custom-skills/host-a-custom-skill-as-a-web-service.html#verify-request-sent-by-alexa"&gt;sure that the request genuinely came from Alexa&lt;/a&gt;, and do all sorts of certificate checks. But why bother? Totally unnecessary for a personal skill.&lt;/p&gt;

&lt;p&gt;Obviously, you can do some programming make the text say &lt;code&gt;$whatever&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;That was easy, right?&lt;/p&gt;

&lt;h2 id="the-amazon-side"&gt;&lt;a href="https://shkspr.mobi/blog/2019/09/quick-and-dirty-self-hosted-alexa-skills-2019/#the-amazon-side"&gt;The Amazon Side&lt;/a&gt;&lt;/h2&gt;

&lt;p&gt;OK kid, this is where it gets complicated.&lt;/p&gt;

&lt;p&gt;For this you will need an Amazon developer account. Getting one is beyond the scope of this tutorial.&lt;/p&gt;

&lt;p&gt;Go to &lt;a href="https://developer.amazon.com/alexa/console/ask"&gt;&lt;/a&gt;&lt;a href="https://developer.amazon.com/alexa/console/ask"&gt;https://developer.amazon.com/alexa/console/ask&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Click the "Create Skill" button.
&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2019/08/Screenshot_2019-08-22-Alexa-Developer-Console.png" alt="The button on a website." width="775" height="248" class="aligncenter size-full wp-image-32632"&gt;&lt;/p&gt;

&lt;p&gt;Give your skill a name. It defaults to USA! USA! USA! English - even though Amazon knows your location and the location of your Echo. If you think AI is hard, that ain't nothing compared to localisation.&lt;/p&gt;

&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2019/08/Screenshot_2019-08-22-Alexa-Developer-Console1.png" alt="Create a new skill screen." width="477" height="300" class="aligncenter size-full wp-image-32633"&gt;

&lt;p&gt;You need to select a Custom skill and to "Provision your own endpoint".&lt;/p&gt;

&lt;p&gt;&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2019/08/Screenshot_2019-08-22-Alexa-Developer-Console2.png" alt="" width="280" height="197" class="aligncenter size-medium wp-image-32635"&gt;&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2019/08/Screenshot_2019-08-22-Alexa-Developer-Console3.png" alt="" width="280" height="218" class="aligncenter size-full wp-image-32634"&gt;&lt;/p&gt;

&lt;p&gt;If you try to use AWS Lambdas you'll be in for a world of pain. Don't even bother - they are a nightmare for a beginner to use.&lt;/p&gt;

&lt;p&gt;Now scroll &lt;em&gt;all the way&lt;/em&gt; back to the top of the website to click the "Create Skill" button. You'd think that after filling in a form, the "next" button would be at the bottom. But that's too easy. If you think AI is hard, that ain't nothing compared to designing an easy to use form.&lt;/p&gt;

&lt;p&gt;We're going to choose the "Start From Scratch" template.
&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2019/08/Screenshot_2019-08-22-Alexa-Developer-Console4.png" alt="" width="745" height="325" class="aligncenter size-full wp-image-32636"&gt;
This has nothing to do with the Scratch programming language. Which is a shame, because Scratch is a great language and well designed for complex voice interaction models.&lt;/p&gt;

&lt;p&gt;Before doing anything else, set up your "endpoint".  This is the website where you uploaded your PHP file.
&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2019/08/Screenshot_2019-08-22-Alexa-Developer-Console5.png" alt="" width="937" height="356" class="aligncenter size-full wp-image-32637"&gt;
Your website needs to support https - you may need to change the certificate type on this page if Amazon has difficulties with it.
Hit "Save Endpoints" - again, it is at the top of the screen. Because people naturally work from the bottom of the form to the top of the form.&lt;/p&gt;

&lt;p&gt;Next up, we need a default intent. It doesn't really matter what you put in here. This is not a complex skill which can take multiple routes. We just want something to happen whenever it is launched.
&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2019/08/Screenshot_2019-08-22-Alexa-Developer-Console6.png" alt="" width="693" height="224" class="aligncenter size-full wp-image-32638"&gt;&lt;/p&gt;

&lt;p&gt;Because Alexa isn't really an AI - we have to give lots of "sample" utterances. So, if you want bus times, you might add "next bus", "buses", "when is my bus" - and every variation you can think of.
&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2019/08/Screenshot_2019-08-22-Alexa-Developer-Console7.png" alt="" width="1090" height="281" class="aligncenter size-full wp-image-32639"&gt;
Now hit "Build Model" at the top. Once that's done, go to test.
&lt;img src="https://shkspr.mobi/blog/wp-content/uploads/2019/08/Screenshot_2019-08-22-Alexa-Developer-Console8.png" alt="" width="1110" height="137" class="aligncenter size-full wp-image-32640"&gt;
Set the dropdown to "Development".&lt;/p&gt;

&lt;p&gt;That's it! You're finally done!  You can test the skill by either typing "whatever" into the text box, or by saying "Alexa! Whatever."&lt;/p&gt;

&lt;p&gt;Alexa will read out whatever is in your PHP script.&lt;/p&gt;

&lt;p&gt;I wish it were easier. Why can't I just say "When I ask &lt;em&gt;this&lt;/em&gt; question, reply with the data from &lt;em&gt;that&lt;/em&gt; website."  Sites like IFTTT and Zapier make it so easy to create services - I wish there was a Voice Assistant which was easy to make skills for.&lt;/p&gt;
&lt;img src="https://shkspr.mobi/blog/wp-content/themes/edent-wordpress-theme/info/okgo.php?ID=32631&amp;amp;HTTP_REFERER=RSS" alt="" width="1" height="1" loading="eager"&gt;</content:encoded>
	

					<wfw:commentRss>https://shkspr.mobi/blog/2019/09/quick-and-dirty-self-hosted-alexa-skills-2019/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
	</channel>
</rss>
