{"id":23400095,"url":"https://github.com/khalby786/slack-cms","last_synced_at":"2025-08-24T19:35:25.117Z","repository":{"id":230766644,"uuid":"513439870","full_name":"khalby786/slack-cms","owner":"khalby786","description":"Simple Slack-based CMS for Node.js that finesses through time and space to get your messages easily and fancily.","archived":false,"fork":false,"pushed_at":"2024-04-05T18:29:36.000Z","size":139,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T18:04:19.190Z","etag":null,"topics":["blog","cms","slack","slack-api"],"latest_commit_sha":null,"homepage":"https://khalby786.github.io/slack-cms/","language":"TypeScript","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/khalby786.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2022-07-13T08:26:49.000Z","updated_at":"2024-04-07T00:47:55.000Z","dependencies_parsed_at":"2024-04-04T20:32:46.098Z","dependency_job_id":"c3afb719-22b9-4429-9c36-ad67cb686118","html_url":"https://github.com/khalby786/slack-cms","commit_stats":null,"previous_names":["khalby786/slack-cms"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalby786%2Fslack-cms","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalby786%2Fslack-cms/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalby786%2Fslack-cms/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/khalby786%2Fslack-cms/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/khalby786","download_url":"https://codeload.github.com/khalby786/slack-cms/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248456374,"owners_count":21106602,"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":["blog","cms","slack","slack-api"],"created_at":"2024-12-22T10:19:24.261Z","updated_at":"2025-04-11T18:07:39.681Z","avatar_url":"https://github.com/khalby786.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# slack-cms\n\n[![npm](https://nodei.co/npm/slack-cms.png)](https://npmjs.com/package/slack-cms)\n\nWhat if you could run [a blog from a Slack channel](https://slack-cms.vercel.app/)?\n\nThis package lets you fetch messages from a particular Slack channel as \"posts\" and includes all the data you will need to display them. It comes with batteries included, so you can render Slack data easily.\n\n## Getting Started\n\nFirst, you need to [create a Slack app](https://api.slack.com/apps) and install it in your workspace.\n\nMake sure it has the following scopes:\n\n- `channels:history`\n- `channels:read`\n- `chat:write`\n- `emoji:read`\n- `groups:history`\n- `groups:read`\n- `pins:read`\n- `reactions:read`\n- `user:read`\n\nThen, you can install the package:\n\n```bash\nnpm install slack-cms\n\n# or yarn\nyarn add slack-cms\n```\n\n## Usage\n\n```javascript\nimport { SlackCMS } from \"slack-cms\";\n\n// A token usually begins with xoxb or xoxp.\n// You get them from each workspace an app is installed onto.\n\nconst SLACK_TOKEN = process.env.SLACK_TOKEN;\n\nconst cms = new SlackCMS(SLACK_TOKEN, {\n\t// default options\n\tlimit: 200,\n\tallowEmptyMetadata: true,\n\tallowEmptyContent: false,\n\tallowOnlyMedia: false,\n\tpinnedOnly: false,\n});\n\nawait cms.posts(\"#channel_name\"); // or channel ID\n// ^ THATS LITERALLY IT\n```\n\n### Options\n\n```js\nexport interface Options {\n\t/**\n\t * The maximum number of posts to return\n\t */\n\tlimit?: number;\n\n\t/**\n\t * If true, posts with empty metadata will be included in the array\n\t */\n\tallowEmptyMetadata?: boolean;\n\n\t/**\n\t * If true, posts with empty content will be included in the array\n\t */\n\tallowEmptyContent?: boolean;\n\n\t/**\n\t * If true, only posts with media will be included in the array\n\t */\n\tallowOnlyMedia?: boolean;\n\n\t/**\n\t * If true, only pinned posts will be included in the array\n\t */\n\tpinnedOnly?: boolean;\n\n\t/**\n\t * A list of uesrs to exclude from the posts\n\t */\n\toptUserOutFromPosts?: string[];\n\n\t/**\n\t * Options to pass to gray-matter\n\t * {@link https://github.com/jonschlinkert/gray-matter?tab=readme-ov-file#options}\n\t */\n\tgrayMatterOptions?: {\n\t\texcerpt?: boolean | ((input: string | Buffer, output: Options[\"grayMatterOptions\"]) =\u003e string);\n\t\texcerpt_separator?: string;\n\t\tengines?: {\n\t\t\t[index: string]:\n\t\t\t\t| ((input: string) =\u003e object)\n\t\t\t\t| { parse: (input: string) =\u003e object; stringify?: (data: object) =\u003e string };\n\t\t};\n\t\tlanguage?: string;\n\t\tdelimiters?: string | [string, string];\n\t};\n\n\t/**\n\t * Options to pass to slack-markdown\n\t * {@link https://www.npmjs.com/package/slack-markdown#options}\n\t */\n\tslackParserOptions?: SlackMarkdownOptions;\n}\n```\n\n## Features\n\n### Parse post content as HTML\n\nslack-cms automatically parses the content of your Slack messages (yes, even custom emojis) as HTML using a standalone parser built atop [slack-markdown](https://npmjs.com/package/slack-markdown).\n\n\u003cdetails\u003e\n  \u003csummary\u003eUse only the parser and not the rest of the package lol\u003c/summary\u003e\n  \n  ```javascript\n  import { parse } from \"slack-cms\";\n\n  // workaround to render custom Slack emojis\n  // omit the next two lines if you don't mind not rendering custom emojis\n  const { WebClient } = require(\"@slack/web-api\");\n  const web = new WebClient(process.env.SLACK_TOKEN);\n\n  parse(\"*hello*\").then((post) =\u003e {\n    console.log(post, web, options); // \u003cb\u003ehello\u003c/b\u003e\n  });\n\n  // Parsing options:\n  // https://khalby786.github.io/slack-cms/functions/helpers_parse.parse.html\n  ```\n\u003c/details\u003e\n\n### Parse front-matter\n\nYou can add metadata to your Slack messages using front-matter, and slack-cms will parse it for you!\n\n### Thread replies as comments\n\nslack-cms will automatically fetch thread replies and attach them to the main post as main comments.\n\n### Continue post in thread reply\n\nIf you hit the character limit, you can continue your post in a thread reply, and slack-cms will append it to the main post.\n\n\u003cdetails\u003e\n  \u003csummary\u003eDisable continue post in thread reply\u003c/summary\u003e\n  Add a \n\n  ```\n  ---\n  continuation: false\n  ---\n  ```\n  to the front-matter to your thread reply.\n\u003c/details\u003e\n\n### Get only pinned messages\n\nYou can fetch only pinned messages from a channel using the `pinnedOnly` option. Read more in the [documentation](https://khalby786.github.io/slack-cms/interfaces/interfaces_Options.Options.html#pinnedOnly).\n\n### Restrict to only media messages\n\nYou can fetch only media messages (messages with files) from a channel using the `allowOnlyMedia` option. Read more in the [documentation](https://khalby786.github.io/slack-cms/interfaces/interfaces_Options.Options.html#allowOnlyMedia).\n\n### Opt users out of being included in posts\n\nYou can opt users out of being included in posts by adding their user IDs to `optUserOutFromPosts` in the options. Read more in the [documentation](https://khalby786.github.io/slack-cms/interfaces/interfaces_Options.Options.html#optUserOutFromPosts).\n\n## Documentation\n\nYou can find the full documentation [here](https://khalby786.github.io/slack-cms/).\n\nAdditionally, check out the [example](https://slack-cms.vercel.app/) of a blog running on [Hack Club](https://hackclub.com/)'s #happenings channel. You can find the source code in the [example](https://github.com/khalby786/slack-cms/tree/main/example) directory.\n\n## License\n\nThis project is licensed under the [MIT License](https://github.com/khalby786/slack-cms/blob/main/LICENSE.md).\n\n## Why\n\n![What if?](https://upload.wikimedia.org/wikipedia/en/b/b6/What_If...%3F_%28TV_series%29_logo.png)\n\n...you could run a blog from a Slack channel?\n\nSeeing how the [first commit](https://github.com/khalby786/slack-cms/commit/f16402a5332a6891b9fcae6975ea8e9f903064cb) was made two years ago, I'm not too sure on the exact reason why I started this project. I remember thinking it'd be cool if there was an easy way to aggregate data from a Slack channel and display it nicely on a website.\n\nI was going through my GitHub repositories, and it was also one of the first times I used Typescript in an actual production(?) environment. It worked well with the Slack SDK which made me really happy.\n\n![https://www.reddit.com/r/ProgrammerHumor/comments/s9fech/typescript_evangelists/ by u/\nkwietog\n](https://preview.redd.it/typescript-evangelists-v0-0qompm4ao2d81.jpg?width=1080\u0026crop=smart\u0026auto=webp\u0026s=1ce3a727cb9853275ded3681d97e99a6c8013723)\n\nFor two years, it was just me and Slack CMS Test in a private channel talking to each other because I had no other real friends. I'm glad that I got the motivation to finish this project, and I hope it can be useful to someone.\n\nNow, I can sleep peacefully. I'm tired.\n\n## If you're interested...\nCheck out [Jsoning](https://github.com/khalby786/jsoning)! It's another cool package I've made!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalby786%2Fslack-cms","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkhalby786%2Fslack-cms","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkhalby786%2Fslack-cms/lists"}