{"id":23881066,"url":"https://github.com/nndi-oss/phada","last_synced_at":"2025-08-31T05:33:41.845Z","repository":{"id":57708264,"uuid":"138003678","full_name":"nndi-oss/phada","owner":"nndi-oss","description":"Small library for dealing with AfricasTalking's USSD input","archived":false,"fork":false,"pushed_at":"2025-03-21T10:48:11.000Z","size":24,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-05T18:08:13.930Z","etag":null,"topics":["africastalking","golang","library","ussd"],"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/nndi-oss.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":"2018-06-20T08:35:31.000Z","updated_at":"2025-03-21T10:48:13.000Z","dependencies_parsed_at":"2025-03-21T11:39:35.067Z","dependency_job_id":null,"html_url":"https://github.com/nndi-oss/phada","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/nndi-oss/phada","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nndi-oss%2Fphada","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nndi-oss%2Fphada/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nndi-oss%2Fphada/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nndi-oss%2Fphada/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nndi-oss","download_url":"https://codeload.github.com/nndi-oss/phada/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nndi-oss%2Fphada/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272940937,"owners_count":25019004,"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-31T02:00:09.071Z","response_time":79,"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":["africastalking","golang","library","ussd"],"created_at":"2025-01-04T00:32:54.630Z","updated_at":"2025-08-31T05:33:41.823Z","avatar_url":"https://github.com/nndi-oss.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"Phada\n=====\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/nndi-oss/phada.svg)](https://pkg.go.dev/github.com/nndi-oss/phada)\n\nPhada is a small utility for _dealing with_ AfricasTalking's USSD input. If you've tried to build a USSD application with AT you may have come about the \"asterix input problem\" i.e. where the data is fed to your application as asterisk separated (ASV?) data.\n\nPhada is a library to reduce the ceremony required to read user's current input, as a bonus you get a way to store the session data\n\nPhada is [Chichewa](https://en.wikipedia.org/wiki/Chichewa) for `Hopscotch`.\n\n## USAGE\n\nInstall the module \n\n```sh\n$ go get github.com/nndi-oss/phada@v0.4.0\n```\n\nIf you're using the standard `net/http` package then you can create the UssdRequestSession\nusing the `ParseUssdRequest(*http.Request)` function. Otherwise you will have to \nfill the `UssdRequestSession` struct yourself if you're using a framework like Gin, Echo, etc..\n\n\n```go\nimport (\n    \"github.com/nndi-oss/phada\"\n)\n\nvar (\n    sessionStore = phada.NewInMemorySessionStore()\n)\n\nfunc handler(w http.ResponseWriter, req *http.Request) {\n    session, err := phada.ParseUssdRequest(req)\n    if err != nil {\n        log.Errorf(\"Failed to parse request to UssdRequestSession, %s\", err)\n    }\n    err = sessionStore.PutHop(session) // store/persist the session\n    if err != nil {\n        // handle the error\n    }\n    session, err = sessionStore.Get(session.SessionID)\n    if err != nil {\n        log.Errorf(\"Failed to read UssdRequest from sessionStore, Got Error: %s\", err)\n    }\n    // read the current hop/request text\n    currentHopInput := session.ReadIn()\n    if currentHopInput == \"\" {\n        fmt.Printf(\"Failed to read input or input was empty\")\n    }\n    // read the text from the first hop only\n    fmt.Printf(\"Got data: %s during Hop 1\", session.GetHopN(1))\n    // read text for all the hops (basically the way AT sent it)\n    fmt.Printf(\"Got data: %s\", session.Text)\n}\n```\n\n\n## LICENSE\n\nMIT License, see [LICENSE.txt](./LICENSE)\n\n---\n\nCopyright (c) 2018 - 2022, NNDI","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnndi-oss%2Fphada","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnndi-oss%2Fphada","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnndi-oss%2Fphada/lists"}