{"id":45316730,"url":"https://github.com/ignaci0/okgohook","last_synced_at":"2026-02-21T07:52:12.399Z","repository":{"id":141460291,"uuid":"460899302","full_name":"ignaci0/okgohook","owner":"ignaci0","description":"Router library for creating webhooks for Actions On Google fulfillment requests","archived":false,"fork":false,"pushed_at":"2022-02-21T22:39:20.000Z","size":16,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-06-20T17:47:35.399Z","etag":null,"topics":["actions","aog","go","golang","google","router","webhook"],"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/ignaci0.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}},"created_at":"2022-02-18T15:11:03.000Z","updated_at":"2022-03-01T08:25:45.000Z","dependencies_parsed_at":"2023-06-09T05:15:21.926Z","dependency_job_id":null,"html_url":"https://github.com/ignaci0/okgohook","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/ignaci0/okgohook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignaci0%2Fokgohook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignaci0%2Fokgohook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignaci0%2Fokgohook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignaci0%2Fokgohook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ignaci0","download_url":"https://codeload.github.com/ignaci0/okgohook/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignaci0%2Fokgohook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29676855,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-21T06:23:40.028Z","status":"ssl_error","status_checked_at":"2026-02-21T06:23:39.222Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["actions","aog","go","golang","google","router","webhook"],"created_at":"2026-02-21T07:52:11.671Z","updated_at":"2026-02-21T07:52:12.391Z","avatar_url":"https://github.com/ignaci0.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ignaci0/okgohook\n\nThis module, composed by two packages provides the means to implement fulfillment\nservice webhooks so Actions On Google can send to a running server.\n\nIt's important to remark this module **does not** implement [DialogFlow fulfillments](https://developers.google.com/assistant/df-asdk/overview)\nbut fulfillment services for the [new conversational actions](https://developers.google.com/assistant/conversational/build).\n\nThis module's features include:\n\n* Implementation of http.Handler interface so that it is compatible with \nhttp.ServeMux (and other modules such as gorilla/mux)\n* It provides data types for the [fulfillment requests (complete) and response (partial)](https://developers.google.com/assistant/conversational/reference/rest/v1/TopLevel/fulfill) \n; missing ones can be introduced later by comunity or myself upon need\n* It implements HealthCheck system intent route\n* It supports request verification by validating JWT received and the intended audience\n* Additional matching rules out of the box: locale and handler\n* Matcher interface to introduce custom request matchers\n\n\nTo get started building your own actions [this is the place to go](https://developers.google.com/assistant/conversational/build).\n\nSince actions can be run in alfa channel, this is quite convenient to run _home server's automated tasks_.\n\n---\n\n## Install\n\nAssuming go toolchain is available:\n\n```sh\ngo get github.com/ignaci0/okgohook\n```\n\n## Examples\n\n### Hello World\n\nJust because:\n\n```go\nwebhookRouter := okgohook.NewRouter()\nwebhookRouter.HandleIntent(\"hello\", func (req *aog.FulfillmentRequest) *aog.FulfillmentResponse {\n\treturn \u0026aog.FulfillmentResponse {\n\t\tPrompt: \u0026aog.Prompt {\n\t\t\tFirstSimple: \u0026aog.Simple { Speech: \"Hello World!\" },\n\t\t},\n\t}\n}) \n\n//Let's use gorilla/mux for this sample:\nrouter := mux.NewRouter()\nrouter.Handle(\"/webhook\", webhookRouter)\n//It plays well with other handlers, e.g.:\n//router.PathPrefix(\"/\").Handler...\n\nsrv := \u0026http.Server {\n\tHandler: router,\n\tAddress: \":8080\",\n\tWriteTimeout: 2 * time.Second,\n\tReadTimeout: 2 * time.Second,\n}\n\nlog.Fatal(srv.ListenAndServe())\n```\n\n### Basic Echo\n\nThis sample fulfillment function talks back the user request:\n\n```go\nwebhookRouter := okgohook.NewRouter()\nwebhookRouter.HandleIntent(\"hello\", func (req *aog.FulfillmentRequest) *aog.FulfillmentResponse {\n\treturn \u0026aog.FulfillmentResponse {\n\t\tPrompt: \u0026aog.Prompt {\n\t\t\tFirstSimple: \u0026aog.Simple { Speech: req.Intent.Query },\n\t\t},\n\t}\n}) \n```\n\n### With additional matches\n\n```go\nwebhookRouter := okgohook.NewRouter()\n\nwebhookRouter.HandleIntent(\"hello\", func (req *aog.FulfillmentRequest) *aog.FulfillmentResponse { }).WithHandler(\"world\").WithLocaleLike(\"EN\")\nwebhookRouter.HandleIntent(\"hello\", func (req *aog.FulfillmentRequest) *aog.FulfillmentResponse { }).WithHandler(\"world\").WithLocaleLike(\"ES\")\n```\n\n### With token verification and authorization\n\nCurrently it is not possible to verify the token without audience verification.\n\n```go\nwebhookRouter := okgohook.NewRouter().Authorize(\"my-app\")\n``` \n\nWhen the newly created router is provided with an audience, a goroutine is launched\nto retrieve and keep up to date the signing token certificates. This means the server\nshall require access to the internet to retrieve them.\n\n## TO-DOs/Roadmap\n\n* Remove unnecessary logging and add a logger facility/middlewares\n* Implement missing response types\n* Change the certificates verifications to a newer keys url\n* ~~Add proxy support for certificates retrieval~~\n* Find a way to get rid off the aog package by autogenerating code for from the [gRPC specification](https://github.com/actions-on-google/assistant-conversation-nodejs/tree/master/src/api) \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignaci0%2Fokgohook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fignaci0%2Fokgohook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignaci0%2Fokgohook/lists"}