{"id":49404985,"url":"https://github.com/mileusna/viber","last_synced_at":"2026-04-28T20:40:36.804Z","repository":{"id":54547593,"uuid":"94921101","full_name":"mileusna/viber","owner":"mileusna","description":"Viber messaging/chatbot for Go/Golang","archived":false,"fork":false,"pushed_at":"2024-07-12T17:24:47.000Z","size":32,"stargazers_count":31,"open_issues_count":5,"forks_count":33,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-08-14T01:34:55.547Z","etag":null,"topics":["chatbot","go","golang","viber","viber-bot","viber-chatbot","viber-platform","viber-public-accounts"],"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/mileusna.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}},"created_at":"2017-06-20T18:08:20.000Z","updated_at":"2025-03-29T17:53:01.000Z","dependencies_parsed_at":"2022-08-13T19:20:28.454Z","dependency_job_id":null,"html_url":"https://github.com/mileusna/viber","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/mileusna/viber","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mileusna%2Fviber","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mileusna%2Fviber/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mileusna%2Fviber/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mileusna%2Fviber/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mileusna","download_url":"https://codeload.github.com/mileusna/viber/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mileusna%2Fviber/sbom","scorecard":{"id":647152,"data":{"date":"2025-08-11","repo":{"name":"github.com/mileusna/viber","commit":"9c9572f73a58b71443a7e3a9018c28428bcb9034"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 2/27 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 5 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-21T12:25:48.600Z","repository_id":54547593,"created_at":"2025-08-21T12:25:48.600Z","updated_at":"2025-08-21T12:25:48.600Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32399002,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: 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":["chatbot","go","golang","viber","viber-bot","viber-chatbot","viber-platform","viber-public-accounts"],"created_at":"2026-04-28T20:40:35.978Z","updated_at":"2026-04-28T20:40:36.798Z","avatar_url":"https://github.com/mileusna.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go/Golang package for Viber messaging and chatbot [![GoDoc](https://godoc.org/github.com/mileusna/viber?status.svg)](https://godoc.org/github.com/mileusna/viber)\n\nWith this package you can use [Viber REST API](https://developers.viber.com/docs/api/rest-bot-api/) to send and receive messages from Viber platform.\n\nAll structs used in package represents the structs identical to [Viber REST API](https://developers.viber.com/docs/api/rest-bot-api/). To fully understand Viber messaging platform and this package as well, you should read [Viber REST API](https://developers.viber.com/docs/api/rest-bot-api/).\n\nBefore using this package you will need [Viber public account](https://support.viber.com/customer/en/portal/articles/2733413-create-a-public-account) and your App key which you can find in Edit section of your Viber public account.\n\n  * [Instalation](#instalation)\n  * [Hello World example](#helloworld)\n  * [Set Webhook](#webhook)\n  * [Send message to the user](#messaging)\n  * [Carousel messages](#carousel)\n  * [Send message to the Public Account](#pamessaging)\n  * [Public Account info](#accountinfo)\n  * [User details](#userdetails)\n  * [Receiving messages and callbacks](#callbacks)\n\n## Installation \u003ca id=\"installation\"\u003e\u003c/a\u003e\n```\ngo get github.com/mileusna/viber\n```\n\n## Hello World example\u003ca id=\"helloworld\"\u003e\u003c/a\u003e\n\n```go\npackage main \n\nimport (\n    \"fmt\"\n    \"log\"\n\n    \"github.com/mileusna/viber\"\n)\n\nfunc main() {\n    v := viber.New(\"YOUR-APP-KEY-FROM-VIBER\", \"MyPage\", \"https://mysite.com/img/avatar.jpg\")\n\n    // you really need this only once, remove after you set the webhook\n    v.SetWebhook(\"https://mysite.com/viber/webhook/\", nil)\n\n    userID := \"Goxxuipn9xKKRqkFOOwKnw==\" // fake user ID, use the real one\n\n    // send text message\n    token, err := v.SendTextMessage(userID, \"Hello, World!\")\n    if err != nil {\n        log.Println(\"Viber error:\", err)\n        return\n    }\n    fmt.Println(\"Message sent, message token:\", token)\n}\n```\n\nAt the begining you neew to declare your viber struct with you app key. Sender is default sender which will be used as default for sending all messages to the users and public account. But, for each message you can specify different sender if you like.\n\n```go\nv := viber.New(\"YOUR-APP-KEY-FROM-VIBER\", \"MyPage\", \"https://mysite.com/img/avatar.jpg\")\n```\n\nRead more about _SetWebhook_ in following [chapter](#webhook).\n\nAfter that, you can [send different kind of messages to the user](#messaging).\n\n[Here](#callbacks) you can read how to handle message receiving.\n\n## Webhook \u003ca id=\"webhook\"\u003e\u003c/a\u003e\n\nTo be able to receive messages and notifications from Viber you have to specify your webhook. Webhook is the URL where Viber will send you all messages and notification. You only have to do this once in a lifetime. URL of webhook have to be online in moment you call _SetWebhook_ since Viber will send http request to webhook URL expecting HTTP status code 200. For more info visit [Viber documentation on Webhooks](https://developers.viber.com/docs/api/rest-bot-api/#webhooks).\n\n```go\n// if eventTypes is nil, all callbacks will be set to webhook\n// if eventTypes is empty []string mandatory callbacks will be set\n// Mandatory callbacks: \"message\", \"subscribed\", \"unsubscribed\"\n// All possible callbacks: \"message\", \"subscribed\",  \"unsubscribed\", \"delivered\", \"seen\", \"failed\", \"conversation_started\"\nv.SetWebhook(\"https://mysite.com/viber/webhook/\", nil)\n```\n\n## Messaging \u003ca id=\"messaging\"\u003e\u003c/a\u003e\n\nYou can send message in different ways. The easiest way is to use shortcut functions like _SendTextMessage_ or _SendURLMessage_:\n```go\nv.SendTextMessage(userID, \"Hello, World!\")\n\nv.SendURLMessage(userID, \"Visit my site\", \"http://mysite.com/\")\n\nv.SendPictureMessage(userID, \"Take a look at this photo\", \"http://mysite.com/photo.jpg\")\n```\n\nThis function will send messages to userID (you will get userID when you [receive message from user](#callbacks)) using default sender specified in declaration.\n\nYou can create individual message, change some settings and then send it using _SendMessage_\n\n```go\n// create message, change the sender for this message and then send id\nm := v.NewTextMessage(\"Hello, world!\")\nm.Sender = viber.Sender{\n    Name:   \"SomeOtherName\",\n    Avatar: \"https://mysite.com/img/other_avatar.jpg\",\n}\nv.SendMessage(userID, m)\n```\n\n## Carousel messages \u003ca id=\"carousel\"\u003e\u003c/a\u003e\n\nDocumentation coming soon.\n\n## Send Messages to Public Account \u003ca id=\"pamessaging\"\u003e\u003c/a\u003e\n\nIn previous examples you send messages directly to the user subscribed to your public account. If you want to send message to the Public Account which will be seen by all PA followers, use te _SendPublicMessage_ function.\n```go\n// adminID is the ID of PA administrator\nm := v.NewTextMessage(\"Hello to everyone\")\nv.SendPublicMessage(adminID, m)\n\nimgMsg := v.NewImageMessage(\"Photo for everyone\", \"http://mysite.com/photo.jpg\")\nv.SendPublicMessage(adminID, imgMsg)\n```\n\n## Account info \u003ca id=\"accountinfo\"\u003e\u003c/a\u003e\n\nIn previous example you have to use ID of administrator of Public account. To obtain Public Acount info and the list of administrators, use the _AccountInfo_ function.\n```go\na, err := v.AccountInfo()\nif err != nil {\n    log.Println(\"AccountInfo Viber error:\", err)\n    return\n}\n\n// print all admministrators\nfor _, m := range a.Members {\n    fmt.Println(m.ID, m.Name, m.Role)\n}\n```\n\n# User details \u003ca id=\"userdetails\"\u003e\u003c/a\u003e\nWhen receiving message from user, or when user starts the conversation, you will receive some bacis user info. To obtain full user details use the _UserDetails_ function.\n\n```go\nu, err := v.UserDetails(userID)\nif err != nil {\n    log.Println(\"User details viber error:\", err)\n    return\n}\n\nfmt.Println(\"Details:\", u.Name, u.Avatar, u.Country, u.Language, u.DeviceType, u.PrimaryDeviceOs)\n```\n\n## Receiving messages / Callbacks \u003ca id=\"callbacks\"\u003e\u003c/a\u003e\nTo receive messages and other callbacks, you have to run you viber app on webhook URL you specified using _SetWebhook_. You can easily manage all Viber callbacks (_Message, Subscribed, Unsubscribed, Delivered, Seen, Failed_) using this package by specifying your own functions which will be called on event.\n\n```go\npackage main\n\nimport (\n    \"fmt\"\n    \"log\"\n    \"net/http\"\n    \"time\"\n\n    \"github.com/mileusna/viber\"\n)\n\nfunc main() {\n    v := \u0026viber.Viber{\n        AppKey: \"YOUR-APP-KEY-FROM-VIBER\",\n        Sender: viber.Sender{\n            Name:   \"MyPage\",\n            Avatar: \"https://mysite.com/img/avatar.jpg\",\n        },\n        Message:   myMsgReceivedFunc,  // your function for handling messages\n        Delivered: myDeliveredFunc,    // your function for delivery report\n    }\n    v.Seen = mySeenFunc   // or assign events after declaration\n    \n    // this have to be your webhook, pass it your viber app as http handler\n    http.Handle(\"/viber/webhook/\", v)\n    http.ListenAndServe(\":80\", nil)    \n}\n\n// myMsgReceivedFunc will be called everytime when user send us a message\nfunc myMsgReceivedFunc(v *viber.Viber, u viber.User, m viber.Message, token uint64, t time.Time) {\n    switch m.(type) {\n\n    case *viber.TextMessage:\n        v.SendTextMessage(u.ID, \"Thank you for your message\")\n        txt := m.(*viber.TextMessage).Text\n        v.SendTextMessage(u.ID, \"This is the text you have sent to me \"+txt)\n\n    case *viber.URLMessage:\n        url := m.(*viber.URLMessage).Media\n        v.SendTextMessage(u.ID, \"You have sent me an interesting link \"+url)\n\n    case *viber.PictureMessage:\n        v.SendTextMessage(u.ID, \"Nice pic!\")\n\n    }\n}\n\nfunc myDeliveredFunc(v *viber.Viber, userID string, token uint64, t time.Time) {\n    log.Println(\"Message ID\", token, \"delivered to user ID\", userID)\n}\n\nfunc mySeenFunc(v *viber.Viber, userID string, token uint64, t time.Time) {\n    log.Println(\"Message ID\", token, \"seen by user ID\", userID)\n}\n\n\n// All events that you can assign your function, declarations must match\n// ConversationStarted func(v *Viber, u User, conversationType, context string, subscribed bool, token uint64, t time.Time) Message\n// Message             func(v *Viber, u User, m Message, token uint64, t time.Time)\n// Subscribed          func(v *Viber, u User, token uint64, t time.Time)\n// Unsubscribed        func(v *Viber, userID string, token uint64, t time.Time)\n// Delivered           func(v *Viber, userID string, token uint64, t time.Time)\n// Seen                func(v *Viber, userID string, token uint64, t time.Time)\n// Failed              func(v *Viber, userID string, token uint64, descr string, t time.Time) \n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmileusna%2Fviber","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmileusna%2Fviber","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmileusna%2Fviber/lists"}