{"id":25198069,"url":"https://github.com/danedens/bash_install_alexa_kit.sh","last_synced_at":"2025-04-04T17:17:31.236Z","repository":{"id":149879441,"uuid":"586109030","full_name":"DanEdens/bash_install_alexa_kit.sh","owner":"DanEdens","description":"Trigger Alexa routines from your EC2 server using the Alexa Skills Kit. This project is to document my notes on setup and experience","archived":false,"fork":false,"pushed_at":"2023-01-07T02:28:06.000Z","size":7,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-10T02:41:21.844Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DanEdens.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-07T01:07:12.000Z","updated_at":"2023-03-04T18:00:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"a6f71ff0-9ca0-43a6-ab91-bbcee0a297c6","html_url":"https://github.com/DanEdens/bash_install_alexa_kit.sh","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanEdens%2Fbash_install_alexa_kit.sh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanEdens%2Fbash_install_alexa_kit.sh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanEdens%2Fbash_install_alexa_kit.sh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DanEdens%2Fbash_install_alexa_kit.sh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DanEdens","download_url":"https://codeload.github.com/DanEdens/bash_install_alexa_kit.sh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217221,"owners_count":20903009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-02-10T02:40:42.176Z","updated_at":"2025-04-04T17:17:31.228Z","avatar_url":"https://github.com/DanEdens.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\n    Usage $: sh bash_install_alexa_kit.sh\n\n```\n# Update the package manager\nsudo yum update -y\n\n# Install Node.js and npm\ncurl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -\nsudo yum install -y nodejs\n\n# Install the AWS SDK for Node.js\nnpm install aws-sdk\n\n# Install the Alexa Skills Kit SDK for Node.js\nnpm install ask-sdk\n\n```\n\nYou can trigger Alexa routines from your EC2 server using the `Alexa Skills Kit (ASK)` and the `Alexa Skills Kit SDK` for `Node.js`. The `ASK` is a collection of self-service APIs, tools, documentation, and code samples that makes it easier for you to build and host Alexa skills.\n\nTo trigger an Alexa routine from your EC2 server, you will need to create a custom skill that sends a request to the `Alexa Routines API` to execute the desired routine. You can use the `Alexa Skills Kit SDK` for `Node.js` to build and host the skill, and the `AWS SDK for Node.js` to make requests to the `Alexa Routines API` from your EC2 server.\n\nHere is a high-level overview of the steps you can follow to trigger an Alexa routine from your EC2 server:\n\nCreate an `AWS account`, if you don't have one already.\n\nSet up an EC2 instance running `Amazon Linux` or another supported Linux distribution.\n\nInstall the `AWS SDK for Node.js` on the `EC2 instance`.\n\nCreate an Alexa skill using the `Alexa Skills Kit Developer Console`.\n\nUse the `Alexa Skills Kit SDK` for `Node.js` to build and host the custom skill on your EC2 instance.\n\nUse the `AWS SDK` for `Node.js` to make a request to the `Alexa Routines API` to execute the desired routine.\n\n# Main.js\n\nThis script defines two custom intents: `ToggleIntent` and `DiscoverDevicesIntent`.\n\nThe `toggleIntentHandler` function handles the `ToggleIntent` intent and uses the `Alexa.ToggleController` interface to toggle a device on and off.\n\nThe discoverIntentHandler function handles the `DiscoverDevicesIntent` intent and uses the `Alexa.Discovery` interface to retrieve a list of devices that are connected to the user's account.\n\nTo use this script, you can call the handler function with the desired intent name as an argument. For example, to toggle a device, you can call the handler function with the `ToggleIntent` intent name:\n\n```\n\nhandler({\n  requestEnvelope: {\n    request: {\n      type: 'IntentRequest',\n      intent: {\n        name: TOGGLE_INTENT\n      }\n    }\n  }\n});\n\n```\n\nTo retrieve a list of devices, you can call the handler function with the `DiscoverDevicesIntent` intent name:\n\n```\n\nhandler({\n  requestEnvelope: {\n    request: {\n      type: 'IntentRequest',\n      intent: {\n        name: DISCOVER_INTENT\n      }\n    }\n  }\n});\n\n```\n\n# toggle_device_slackbot.js\n\nAn example of how you can create a Slackbot that sends the handler function a `ToggleIntent` request when a user types a `/toggle` command followed by a device name:\n\n    /toggle hb3910\n\nThis script uses the spread operator `(...)` to split the message text into an array,  \nwith the first element being the command and the rest being the body of the message.  \n\nThe body of the message is then joined back into a single string and used as the token.\n\nTo convert a device name like `hb3910` into a device token, you will need to store the mapping between device names and tokens in a database or configuration file.  \nYou can then look up the token for a given device name when you receive a request.\n\nAn example of how you might do this can be found in [toggle_intent_handler.js](toggle_intent_handler.js)\n\n\nThe `toggleIntentHandler` function looks up the device token using the device name and sends the `Alexa.ToggleController` directive with the correct token.  \n\nIf the device name is not found in the `deviceMap`, it returns an error message.\n\n\n\n# Refrences\n[Understand the Smart Home Skill Api](https://developer.amazon.com/en-US/docs/alexa/smarthome/understand-the-smart-home-skill-api.html)\n\n[avs-device-sdk/endpoints](https://developer.amazon.com/en-US/docs/alexa/avs-device-sdk/endpoints.html)\n\n[wwa-connection-options](https://developer.amazon.com/en-US/docs/alexa/smarthome/wwa-connection-options.html)\n\n[Alexa-Skills-Kit](https://developer.amazon.com/en-US/alexa/alexa-skills-kit)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanedens%2Fbash_install_alexa_kit.sh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanedens%2Fbash_install_alexa_kit.sh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanedens%2Fbash_install_alexa_kit.sh/lists"}