{"id":13793374,"url":"https://github.com/ShivangKakkar/telegraph","last_synced_at":"2025-05-12T20:30:57.261Z","repository":{"id":65518399,"uuid":"462185634","full_name":"ShivangKakkar/telegraph","owner":"ShivangKakkar","description":"Golang Bindings for Telegraph API","archived":false,"fork":false,"pushed_at":"2024-02-29T06:41:32.000Z","size":33,"stargazers_count":18,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-05-19T02:00:26.860Z","etag":null,"topics":["go","golang","golang-library","golang-package","telegram","telegraph","telegraph-api","telegraph-uploader"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/StarkBotsIndustries/telegraph/v2","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ShivangKakkar.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-22T07:30:46.000Z","updated_at":"2024-06-19T01:36:34.923Z","dependencies_parsed_at":"2024-02-29T07:44:50.324Z","dependency_job_id":null,"html_url":"https://github.com/ShivangKakkar/telegraph","commit_stats":null,"previous_names":["starkbotsindustries/telegraph"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShivangKakkar%2Ftelegraph","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShivangKakkar%2Ftelegraph/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShivangKakkar%2Ftelegraph/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ShivangKakkar%2Ftelegraph/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ShivangKakkar","download_url":"https://codeload.github.com/ShivangKakkar/telegraph/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253816679,"owners_count":21968866,"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":["go","golang","golang-library","golang-package","telegram","telegraph","telegraph-api","telegraph-uploader"],"created_at":"2024-08-03T23:00:19.939Z","updated_at":"2025-05-12T20:30:56.898Z","avatar_url":"https://github.com/ShivangKakkar.png","language":"Go","funding_links":[],"categories":["Go","Telegram Bot List"],"sub_categories":["Other Open Source Projects"],"readme":"## Golang Bindings for Telegraph API\n\n\u003e ⭐️ A star from you, means a lot!\n\nThis library represents a convenient wrapper around the Telegra.ph API. This is my first project in golang, so I would love to know my mistakes.\n\n### Features\n\nHere are the most important aspects, shown as pros and cons:\n\n#### Pros\n\n- Auto-generated from API, leaving less space for mistakes.\n- Very easy to use.\n- **Upload media** to Telegraph, the method which isn't included in the official API.\n- Helpful methods like `Prettify()` to pretty-print any object or convert object to JSON.\n- In-built `HTML` to `NodeElement` conversion so you can directly use strings with embedded `HTML`\n- Highly documented (doc strings) for IDEs like VSCode.\n\n#### Cons\n\n- No custom error handling. Not much panicking. Though official errors will be returned as `error` object. But I guess that's conventional, and maybe convenient?\n- The bugs you are going to find.\n\n### Installing\n\nJust install it using the standard `go get` command.\n\n```shell\ngo get github.com/StarkBotsIndustries/telegraph/v2\n```\n\n### Documentation\n\nDocs can be found here : [![Go Reference](https://pkg.go.dev/badge/github.com/StarkBotsIndustries/telegraph.svg)](https://pkg.go.dev/github.com/StarkBotsIndustries/telegraph/v2)\n\n### Example\n\nA project based on this library can be found here : [Telegraph Go Bot](https://github.com/StarkBotsIndustries/Telegraph-Go-Bot)\n\n### Usage\n\nThis is pretty straightforward. First, import the library\n\n```go\nimport \"github.com/StarkBotsIndustries/telegraph/v2\"\n```\n\nNow you can call any methods. Let's say, **CreateAccount**?\n\n```go\nacc, err := telegraph.CreateAccount(\n    telegraph.CreateAccountOpts{ShortName: \"Go is Love\"},\n)\n\nacc.AccessToken\n\u003e\u003e\u003e \"abcdefghijklmnopqrstuvwxyz\"\n\nacc.ShortName\n\u003e\u003e\u003e \"Go is Love\"\n```\n\nOr **CreatePage**\n\n```go\n\tpage, err := telegraph.CreatePage(telegraph.CreatePageOpts{\n\t\tTitle: \"My First Page\",\n\t\tContent: []telegraph.Node{\n\t\t\t\"Hi \",\n\t\t\ttelegraph.NodeElement{\n\t\t\t\tTag:      \"b\",\n\t\t\t\tChildren: []telegraph.Node{\"Brothers\"},\n\t\t\t},\n\t\t\t\" and \",\n\t\t\ttelegraph.NodeElement{\n\t\t\t\tTag:      \"code\",\n\t\t\t\tChildren: []telegraph.Node{\"Sisters\"},\n\t\t\t},\n\t\t},\n\t\tAccessToken: \"abcdefghijklmnopqrstuvwxyz\",\n\t})\n\npage.URL\n\u003e\u003e\u003e \"https://telegra.ph/My-First-Page-02-20\"\n\npage.Path\n\u003e\u003e\u003e \"My-First-Page-02-20\"\n```\n\nYou can also directly use HTML using _HTMLContent_ field\n\n```go\npage, err := telegraph.CreatePage(telegraph.CreatePageOpts{\n    Title: \"My First Page\",\n    HTMLContent: \"Hi \u003cb\u003eBrothers\u003c/b\u003e and \u003ccode\u003eSisters\u003c/code\u003e\",\n    AccessToken: \"abcdefghijklmnopqrstuvwxyz\",\n})\n```\n\n**Pretty Print** an Object / Convert to **JSON**\n\n```go\nacc, err := telegraph.CreateAccount(telegraph.CreateAccountOpts{ShortName: \"Go is Love\"})\nprettifiedObject := telegraph.Prettify(acc)\n\nprettifiedObject\n\u003e\u003e\u003e {\n\u003e\u003e\u003e     \"short_name\": \"Go is Love\",\n\u003e\u003e\u003e     \"author_name\": \"\",\n\u003e\u003e\u003e     \"author_url\": \"\",\n\u003e\u003e\u003e     \"access_token\": \"abcdefghijklmnopqrstuvwxyz\",\n\u003e\u003e\u003e     \"auth_url\": \"https://edit.telegra.ph/auth/lmnopqrstuvwxyzabcdefghijk\",\n\u003e\u003e\u003e     \"page_count\": 0\n\u003e\u003e\u003e }\n```\n\n**Upload Media** to Telegraph\n\n```go\nfile, _ := os.Open(\"file.jpg\")\n// os.File is io.Reader so just pass it.\nlink, _ := telegraph.Upload(file, \"photo\")\n\nlink\n\u003e\u003e\u003e \"https://telegra.ph/file/abcdefghijklmnopqrstuvwxyz.jpg\"\n```\n\nRaw **Get** Request\n\n```go\nopts := telegraph.CreateAccountOpts{ShortName: \"Durov Uncle\"}\nacc, err := telegraph.Get(\"createAccount\", opts)\n\nacc.AccessToken\n\u003e\u003e\u003e \"abcdefghijklmnopqrstuvwxyz\"\n```\n\nRaw **Post** Request\n\n```go\nopts := telegraph.CreateAccountOpts{ShortName: \"Durov Uncle\"}\nacc, err := telegraph.Post(\"createAccount\", opts)\n\nacc.AccessToken\n\u003e\u003e\u003e \"abcdefghijklmnopqrstuvwxyz\"\n```\n\n### Community and Support\n\nTelegram Channel - [StarkBots](https://t.me/StarkBots)\n\nTelegram Chat - [StarkBotsChat](https://t.me/StarkBotsChat)\n\n### Copyright and License\n\n- Copyright (C) 2022 **Stark Bots** \u003c\u003chttps://github.com/StarkBotsIndustries\u003e\u003e\n\n- Licensed under the terms of [GNU General Public License v3 or later (GPLv3+)](https://github.com/StarkBotsIndustries/telegraph/blob/master/LICENSE)\n\n### :)\n\n[![ForTheBadge made-with-go](http://ForTheBadge.com/images/badges/made-with-go.svg)](https://go.dev/)\n\n[![ForTheBadge built-with-love](http://ForTheBadge.com/images/badges/built-with-love.svg)](https://github.com/StarkBotsIndustries)\n\n[![ForTheBadge makes-people-smile](http://ForTheBadge.com/images/badges/makes-people-smile.svg)](https://github.com/StarkBotsIndustries)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShivangKakkar%2Ftelegraph","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FShivangKakkar%2Ftelegraph","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FShivangKakkar%2Ftelegraph/lists"}