Better Programming

Advice for programmers.

Follow publication

Member-only story

Build an Alexa Skill To Play Audio From YouTube Videos

Marcos Lombog
Better Programming
Published in
12 min readAug 6, 2020

Introduction

Have you ever wanted to ask Alexa to play the audio of a YouTube video? Just say “Alexa, Ask Hey Tube to play Whitesnake” and listen to a great Whitesnake track from YouTube.

In this article, I will show how to build a Custom Alexa Skill to connect your Amazon Echo device to YouTube.

Note: Keep in mind this skill will not be published in Amazon Store production, and can only be used in development mode. This is not an Amazon approved Skill and should only be used for educational purposes.

Alexa Custom Skill

The Alexa custom skill is a combination of two main components:

https://github.com/bignerdranch/developing-alexa-skills-solutions/blob/master/coursebook/coursebook.pdf

The skill interface defines how your skill will behave:

  • A set of “intents” that represent actions that users can do with your skill.
  • A set of “sample utterances” that specify the words and phrases users can say to invoke those intents. You map these utterances to your intents — this mapping forms the “interaction model” for the skill.
  • An “invocation name that identifies the skill. The user includes this name when initiating a conversation with your skill.

The skill service contains your code logic to handle the intents and perform actions. The service is deployed as a backend resource. For this exercise — JavaScript deployed in AWS Lambda

Skill Flow

This is the custom skill flow to be developed:

  • The flow starts with a welcome message and expects a video query name.
  • When asked to play a certain video, Alexa Interface calls the service using the query as the parameter.
  • The service calls YouTube API to search for a video, then returns the URL to…

Create an account to read the full story.

The author made this story available to Medium members only.
If you’re new to Medium, create a new account to read this story on us.

Or, continue in mobile web

Already have an account? Sign in

Responses (11)

Write a response