{"id":27442384,"url":"https://github.com/drpsychick/go-alexa-lambda","last_synced_at":"2025-08-23T05:09:23.003Z","repository":{"id":43902536,"uuid":"407883982","full_name":"DrPsychick/go-alexa-lambda","owner":"DrPsychick","description":"Alexa golang library to generate skill + interaction model as well as serve requests with lambda or as a server.","archived":false,"fork":false,"pushed_at":"2025-08-22T19:10:49.000Z","size":163,"stargazers_count":5,"open_issues_count":14,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-23T05:09:18.672Z","etag":null,"topics":["alexa","alexa-custom-skill","alexa-sdk","alexa-skill","go","golang","hacktoberfest2021","lambda","library"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DrPsychick.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null},"funding":{"github":"DrPsychick"}},"created_at":"2021-09-18T14:34:13.000Z","updated_at":"2025-08-11T16:30:08.000Z","dependencies_parsed_at":"2023-02-18T09:46:09.484Z","dependency_job_id":"29e0312b-2779-4996-93d7-cafb13eb7b85","html_url":"https://github.com/DrPsychick/go-alexa-lambda","commit_stats":{"total_commits":79,"total_committers":3,"mean_commits":"26.333333333333332","dds":0.4177215189873418,"last_synced_commit":"58f635f603173fa09156f9a4e25faf4d668091c5"},"previous_names":[],"tags_count":83,"template":false,"template_full_name":null,"purl":"pkg:github/DrPsychick/go-alexa-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrPsychick%2Fgo-alexa-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrPsychick%2Fgo-alexa-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrPsychick%2Fgo-alexa-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrPsychick%2Fgo-alexa-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DrPsychick","download_url":"https://codeload.github.com/DrPsychick/go-alexa-lambda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DrPsychick%2Fgo-alexa-lambda/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271745490,"owners_count":24813503,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["alexa","alexa-custom-skill","alexa-sdk","alexa-skill","go","golang","hacktoberfest2021","lambda","library"],"created_at":"2025-04-15T00:27:12.148Z","updated_at":"2025-08-23T05:09:22.979Z","avatar_url":"https://github.com/DrPsychick.png","language":"Go","funding_links":["https://github.com/sponsors/DrPsychick","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=FTXDN7LCDWUEA\u0026source=url"],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/drpsychick/go-alexa-lambda)](https://goreportcard.com/report/github.com/drpsychick/go-alexa-lambda)\n[![Workflow Status](https://img.shields.io/github/actions/workflow/status/drpsychick/go-alexa-lambda/ci.yaml)](https://github.com/DrPsychick/go-alexa-lambda/actions)\n[![Coverage Status](https://coveralls.io/repos/github/DrPsychick/go-alexa-lambda/badge.svg?branch=main)](https://coveralls.io/github/DrPsychick/go-alexa-lambda?branch=main)\n[![license](https://img.shields.io/github/license/drpsychick/go-alexa-lambda.svg)](https://github.com/drpsychick/go-alexa-lambda/blob/main/LICENSE)\n[![GitHub stars](https://img.shields.io/github/stars/drpsychick/go-alexa-lambda.svg)](https://github.com/drpsychick/go-alexa-lambda)\n[![Paypal](https://img.shields.io/badge/donate-paypal-00457c.svg?logo=paypal)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=FTXDN7LCDWUEA\u0026source=url)\n[![GitHub Sponsor](https://img.shields.io/badge/github-sponsor-blue?logo=github)](https://github.com/sponsors/DrPsychick)\n\n# go-alexa-lambda\nAlexa golang library to generate skill + interaction model as well as serve requests with lambda or as a server.\nThe packages can also be used standalone as a request/response abstraction for Alexa requests.\n\n# Purpose\nThe Alexa skill and interaction model is tightly coupled with the actual intents a lambda function will process.\nAs developing a skill with a golang backend impacts the skill definition in many cases and they share localization scope,\nthis package allows defining and generating the skill and model for deployment and using the same source (with intents, localization) to\nbuild the lambda function that responds to requests from Alexa.\n\n# Usage\n## Build skill and interaction model\nRun it on go playground: https://play.golang.org/p/VfHW4RcUVwn\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\talexa \"github.com/drpsychick/go-alexa-lambda\"\n\t\"github.com/drpsychick/go-alexa-lambda/l10n\"\n\t\"github.com/drpsychick/go-alexa-lambda/skill\"\n\tjsoniter \"github.com/json-iterator/go\"\n)\n\n// Configure locale registry.\nvar enUS = \u0026l10n.Locale{\n\tName: \"en-US\",\n\tTextSnippets: map[string][]string{\n\t\tl10n.KeySkillName:   {\"This is my awesome skill.\"},\n\t\tl10n.KeySkillDescription: {\"Description\"},\n\t\tl10n.KeySkillSummary: {\"Skill summary\"},\n\t\tl10n.KeySkillSmallIconURI: {\"https://my-url.com/small.png\"},\n\t\tl10n.KeySkillLargeIconURI: {\"https://my-url.com/large.png\"},\n\t\tl10n.KeySkillTestingInstructions: {\"Testing instructions\"},\n\t\tl10n.KeySkillInvocation: {\"awesome skill\"},\n\t\t// ... for each locale, define the required keys\n\t},\n}\n\nfunc main() {\n\treg := l10n.NewRegistry()\n\treg.Register(enUS)\n\n\t// Create and configure skill builder.\n\ts := skill.NewSkillBuilder().\n\t\tWithLocaleRegistry(reg).\n\t\tWithCategory(skill.CategoryGames).\n\t\tWithPrivacyFlag(skill.FlagIsExportCompliant, true).\n\t\tWithModel()\n\n\t// Configure model.\n\ts.Model().\n\t\tWithDelegationStrategy(skill.DelegationSkillResponse).\n\t\tWithIntent(alexa.StopIntent)\n\n\t// Build `skill.json`\n\tsj, err := s.Build()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tres, _ := jsoniter.MarshalIndent(sj, \"\", \"  \")\n\tlog.Printf(\"Skill:\\n%s\", res)\n\n\t// Build interaction model: `en-US.json`\n\tms, err := s.BuildModels()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfor l, m := range ms {\n\t\tres, _ := jsoniter.MarshalIndent(m, \"\", \"  \")\n\t\tlog.Printf(\"Locale %s:\\n%s\", l, res)\n\t}\n}\n```\n\n## Respond to alexa requests with lambda\nRun it on go playground: https://play.golang.org/p/fRrzn_kmaBi\n```go\npackage main\n\nimport (\n\t\"os\"\n\t\"context\"\n\talexa \"github.com/drpsychick/go-alexa-lambda\"\n\t\"github.com/drpsychick/go-alexa-lambda/skill\"\n\tlog \"github.com/hamba/logger/v2\"\n)\n\nvar request = `{\n  \"version\": \"1.0\",\n  \"session\": {},\n  \"context\": {},\n  \"request\": {\n    \"type\": \"IntentRequest\",\n    \"requestId\": \"amzn1.echo-api.request.1234\",\n    \"timestamp\": \"2016-10-27T21:06:28Z\",\n    \"locale\": \"en-US\",\n    \"intent\": {\n      \"name\": \"AMAZON.HelpIntent\"\n    }\n  }\n}\n`\n\nfunc handleHelp(sb *skill.SkillBuilder) alexa.HandlerFunc {\n\tsb.Model().WithIntent(alexa.HelpIntent)\n\n\treturn alexa.HandlerFunc(func(b *alexa.ResponseBuilder, r *alexa.RequestEnvelope) {\n\t\tb.WithSimpleCard(\"Help Title\", \"Text explaining how it works.\")\n\t})\n}\n\nfunc main() {\n\tsb := skill.NewSkillBuilder()\n\tmux := alexa.NewServerMux(log.New(os.Stdout, log.ConsoleFormat(), log.Info))\n\tsb.WithModel()\n\n\tmux.HandleIntent(alexa.HelpIntent, handleHelp(sb))\n\t\n\t// actually, one would call `alexa.Serve(mux)`\n\t// but for this demo, we want to pass a request and get a response\n\ts := \u0026alexa.Server{Handler: mux}\n\tctx := context.Background()\n\tresponse, err := s.Invoke(ctx, []byte(request))\n\tif err != nil {\n\t\tmux.Logger().Error(err.Error())\n\t}\n\tmux.Logger().Info(string(response))\n}\n```\n\n# Projects using `go-alexa-lambda`\n* [alexa-go-cloudformation-demo](https://github.com/DrPsychick/alexa-go-cloudformation-demo) : the demo project that lead to developing this library. A fully automated build and deploy of an Alexa skill including lambda function via Cloudformation.\n\n## Project template\nTo give you a head start, check out the template project:\n* [go-alexa-lambda-template](https://github.com/DrPsychick/go-alexa-lambda-template) : generate skill and deploy it including lambda with cloudformation.\n\n### Create your own project based on the template\n```shell\ngit clone https://github.com/DrPsychick/go-alexa-lambda-template.git\nmv go-alexa-lambda-template alexa-project\ncd alexa-project\nrm -rf .git\n```\n\n### Required variables for your pipeline\n```shell\nASKClientId= # amzn1.application-oa2-client...\nASKClientSecret= # 6ef4...\nASKAccessToken= # Atza|IwE...\nASKRefreshToken= # \tAtzr|IwE...\nASKVendorId= # M3D....\nASKS3Bucket= # my-bucket\nASKS3Key= # my-skill.zip\nASKSkillId= # amzn1.ask.skill.fe19...\nASK_CONFIG= # cat ~/.ask/cli_config | jq -c | sed -e 's#\\([\"{}|]\\)#\\\\\\1#g'\nAWS_DEFAULT_REGION= # eu-central-1\nAWS_ACCESS_KEY_ID= # AKD...\nAWS_SECRET_ACCESS_KEY= # 3D+...\nCF_STACK_NAME= # skill-stack\nKEEP_STACK= # if empty, the CF stack will be deleted after deploy (for tests)\n```\n\n# References\n### Links\n* https://developer.amazon.com/docs/custom-skills/dialog-interface-reference.html\n* multiple intents in one dialog: https://developer.amazon.com/docs/custom-skills/dialog-interface-reference.html#pass-a-new-intent\n* https://developer.amazon.com/blogs/alexa/post/cfbd2f5e-c72f-4b03-8040-8628bbca204c/alexa-skill-teardown-understanding-entity-resolution-with-pet-match\n\n### Credits\ninitially inspired by: https://github.com/soloworks/go-alexa-models","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrpsychick%2Fgo-alexa-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdrpsychick%2Fgo-alexa-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdrpsychick%2Fgo-alexa-lambda/lists"}