{"id":15229099,"url":"https://github.com/jyz0309/notionai-go","last_synced_at":"2025-07-14T12:43:28.601Z","repository":{"id":86273565,"uuid":"606705317","full_name":"jyz0309/NotionAI-go","owner":"jyz0309","description":"Unofficial NotionAI Go SDK","archived":false,"fork":false,"pushed_at":"2023-10-11T02:29:14.000Z","size":315,"stargazers_count":60,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-10T01:14:42.256Z","etag":null,"topics":["golang","gpt-3","gpt3","notion","notion-api","notionai"],"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/jyz0309.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":"2023-02-26T10:10:56.000Z","updated_at":"2024-10-05T12:58:47.000Z","dependencies_parsed_at":"2023-10-11T04:45:49.568Z","dependency_job_id":null,"html_url":"https://github.com/jyz0309/NotionAI-go","commit_stats":{"total_commits":10,"total_committers":3,"mean_commits":"3.3333333333333335","dds":"0.30000000000000004","last_synced_commit":"e83953810ecbe6b2d453b733e35a5d6ac8347cba"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jyz0309%2FNotionAI-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jyz0309%2FNotionAI-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jyz0309%2FNotionAI-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jyz0309%2FNotionAI-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jyz0309","download_url":"https://codeload.github.com/jyz0309/NotionAI-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248137891,"owners_count":21053775,"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":["golang","gpt-3","gpt3","notion","notion-api","notionai"],"created_at":"2024-09-29T00:07:13.062Z","updated_at":"2025-04-10T01:14:50.010Z","avatar_url":"https://github.com/jyz0309.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NotionAI-go\nNotionAI-go is an unofficial NotionAI API that provides a Go SDK, inspired by https://github.com/Vaayne/NotionAI.\n\n## NotionAI Go SDK\nThe NotionAI Go SDK is a wrapper for the All NotionAI APIs, you can use it to simplify integration of NotionAI solutions into your projects.\n\n### Usage\n\n#### Installing\nUse `go get` to retrieve the SDK to add it to your GOPATH workspace, or project's Go module dependencies.\n```\ngo get github.com/jyz0309/notionAI-go\n```\n\n#### Get Notion Token and Workspace ID\nTo use the NotionAI Go SDK, you need to obtain a Notion token. You can do this by following these steps:\n\n1. Open your browser DevTools\n2. Find the spaceId of your Notion workspace in the request body.\n3. Find the request cookies and copy the value for token_v2\n\n![Get Notion Token](./docs/image/get_notion_spaceId.png)\n\n![Get Notion Workspace ID](./docs/image/get_notion_token.png)\n\n#### Init the client\nFirst, you need to use the `token` and `spaceID` to init notion AI client, just like this:\n```go\nimport \"github.com/jyz0309/notionAI-go/client\"\n\nfunc main(){\n\tcli := client.NewClient(\"Your notion token\", \"Your notion space ID\")\n    //...\n}\n```\nAfter init the client, you can use client to call notion AI API in pkg.\n\n\n#### API Introduction\nAll NotionAI APIs are supported. You can check the `client` package to see all APIs.\n\n1. WriteWithTopic\n```go\n/*\nUsage: WriteWithTopic writes for special topic, like Blog, Essay, Todo list\nArgs:\n    topic(TopicType): the special topic\n    prompt(string): prompt for writing\n*/\n// Example:\nfunc main(){\n\tcli := client.NewClient(\"Your notion token\", \"Your notion space ID\")\n    cli.WriteWithTopic(common.BlogPost, \"Golang\")\n}\n```\n\n2. WriteWithPrompt\n```go\n/*\nUsage: WriteWithPrompt writes with special prompt, like summarize, explain_this, improve_writing\nArgs:\n    promptType(PromptType): the special prompt\n    content(string): the content for your writing\n*/\n// Example:\nfunc main() {\n\tcli := client.NewClient(\"Your notion token\", \"Your notion space ID\")\n\tcli.WriteWithPrompt(common.MakeLonger, \"Today is friday!\")\n}\n```\n\n3. Translate\n```go\n/*\nUsage: Translate will translate the content to given language\nArgs:\n    lang(SupportedLanguage): the target language\n    prompt(string): content to translate\n*/\n// Example:\nfunc main() {\n\tcli := client.NewClient(\"Your notion token\", \"Your notion space ID\")\n\tcli.Translate(common.Chinese, \"Today is friday!\")\n}\n```\n\n5. ChangeTone\n```go\n/*\nUsage: ChangeTone uses specific tones to optimize content.\nArgs:\n    tone(SupportedTone): the target tone\n    prompt(string): content to change\n*/\n// Example:\nfunc main() {\n\tcli := client.NewClient(\"Your notion token\", \"Your notion space ID\")\n\tcli.ChangeTone(common.Professional, \"Today is friday!\")\n}\n```\n\n\n6. ContinueWriting\n```go\n/*\nUsage: ContinueWriting can generate the following content based on the given input content.\nArgs:\n    content(string): content to continue writing\n*/\n// Example:\nfunc main() {\n\tcli := client.NewClient(\"Your notion token\", \"Your notion space ID\")\n\tcli.ContinueWriting(\"Today is friday!\")\n}\n```\n\n7. HelpMeDraft\n```go\n/*\nUsage: HelpMeDraft can generate a draft based on the given prompt.\nArgs:\n    prompt(string): prompt used to generate a draft\n*/\n// Example:\nfunc main() {\n\tcli := client.NewClient(\"Your notion token\", \"Your notion space ID\")\n\tcli.HelpMeDraft(\"How the nation AI work?\")\n}\n```\n\n8. HelpMeEdit\n```go\n/*\nUsage: HelpMeEdit can optimize content based on the given prompt.\nArgs:\n    content(string): content you need to optimize\n    prompt(string): prompt used to generate a draft\n*/\n// Example:\nfunc main() {\n\tcli := client.NewClient(\"Your notion token\", \"Your notion space ID\")\n\tcli.HelpMeEdit(\"The content is about how the nation AI work\", \"please help me make it longer.\")\n}\n```\n\n### Example\n\n```go\n\nfunc main() {\n\tcli := client.NewClient(\"Your notion token\", \"Your notion space ID\")\n\tresp, err := cli.ContinueWriting(\"Deploy a mysql service\")\n\tif err != nil {\n\t\tlog.Default().Panic(err)\n\t\treturn\n\t}\n\t/* resp:\n    To deploy a mysql service, you can use a containerization tool such as Docker or Kubernetes. \n    First, you'll need to create a Dockerfile or Kubernetes deployment file that includes the mysql image and any necessary environment variables or configuration options. \n    You can then use the appropriate tool to build and deploy the container, making sure to expose the necessary ports and configure any required network settings.\n    */\n}\n\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjyz0309%2Fnotionai-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjyz0309%2Fnotionai-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjyz0309%2Fnotionai-go/lists"}