{"id":49764954,"url":"https://github.com/knocklabs/knock-node-example-app","last_synced_at":"2026-05-11T10:26:00.080Z","repository":{"id":37803492,"uuid":"486287807","full_name":"knocklabs/knock-node-example-app","owner":"knocklabs","description":"Example application to showcase how to integrate Knock (written in NodeJS)","archived":false,"fork":false,"pushed_at":"2024-03-14T16:42:17.000Z","size":400,"stargazers_count":8,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-03-14T17:36:36.060Z","etag":null,"topics":["blitzjs","knock","nodejs","notifications"],"latest_commit_sha":null,"homepage":"","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/knocklabs.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}},"created_at":"2022-04-27T17:24:09.000Z","updated_at":"2024-03-10T05:20:58.000Z","dependencies_parsed_at":"2022-08-18T15:21:12.417Z","dependency_job_id":"f6ddeab7-9a74-4825-9e6f-2296ed5e7364","html_url":"https://github.com/knocklabs/knock-node-example-app","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/knocklabs/knock-node-example-app","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knocklabs%2Fknock-node-example-app","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knocklabs%2Fknock-node-example-app/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knocklabs%2Fknock-node-example-app/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knocklabs%2Fknock-node-example-app/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/knocklabs","download_url":"https://codeload.github.com/knocklabs/knock-node-example-app/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/knocklabs%2Fknock-node-example-app/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32890458,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-10T13:40:02.631Z","status":"online","status_checked_at":"2026-05-11T02:00:05.975Z","response_time":120,"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":["blitzjs","knock","nodejs","notifications"],"created_at":"2026-05-11T10:25:59.071Z","updated_at":"2026-05-11T10:26:00.069Z","avatar_url":"https://github.com/knocklabs.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **Knock + Node.js example app**\n\n## Archive notice\nAs of March 2024, this repository has been moved to a read-only archive. It's still usable and contains useful information, but we'll be porting this application to a newer version of Next.js in the very near future. In the meantime, you can check out the [example apps section](https://docs.knock.app/getting-started/example-app) of the Knock docs for a list of our example apps.\n\n## About\n\nThis example app uses [Knock](https://knock.app) to power cross channel notifications via email, an in-app feed, and Slack inside of a full-stack Node application, written in [Blitz.js](https://blitzjs.com/). It uses the [Knock Node SDK](https://github.com/knocklabs/knock-node) and [React in-app feed components](https://github.com/knocklabs/react-notification-feed).\n\nYou can read more about this example app [in the Knock documentation](https://docs.knock.app/getting-started/example-app#nodejs-example-app).\n\n## Set up\n\n### In the Knock dashboard\n\n[Sign up for a Knock account](https://dashboard.knock.app/signup) to configure channels and workflows for the app to work as expected. Once you've created your Knock account you will need to create channels and workflows to work with your application.\n\n1. Create an email channel and an in-app feed channel.\n   - You'll need to use an existing email provider like [Postmark](https://postmark.com/) to use in your email channel in the Knock dashboard.\n2. A workflow in Knock with the key `welcome`. It should include an email step for your welcome email template.\n3. A workflow in Knock with the key `new-comment`. It should include: an in-app feed step and an email step. On these step's templates you can use the following variables which the example app is already configured to send as arguments on the workflow trigger call:\n   1. `comment_content`: The content of the created comment.\n   2. `asset_name`: The name of the commented asset.\n   3. `asset_url`: The url of the commented asset.\n   4. `project_name`: The name of the project that the comment asset belongs to.\n4. A workflow in Knock with the key `new-asset`. It should include: an in-app feed step and an email step. On these step's templates you can use the following variables which the example app is already configured to send as arguments on the workflow trigger call:\n   1. `asset_url`: The url of the commented asset.\n   2. `project_name`: The name of the project that the comment asset belongs to.\n\n\u003e **🚀 Tip: auto-create workflows with the CLI 🚀** \u003cbr\u003e The example app repo contains a `knock/workflows` directory with the three workflows listed above. You can use the [Knock CLI](https://docs.knock.app/cli) to push these workflows into your Knock account using the `knock workflow push --all` command.\n\n### On your machine\n\n**1. Clone project**\n\n```\ngit clone git@github.com:knocklabs/knock-node-example-app.git\ncd knock-node-example-app\n```\n\n**2. Install dependencies**\n\n```\nyarn\n```\n\n**3. Create your `.env` file and copy the content from `.env.sample`**\n\nSet the necessary environment variables. To get started with triggering workflows and the in-app feed, you must have variables set for the following:\n\n- `DATABASE_URL`\n- `KNOCK_API_KEY`\n- `BLITZ_PUBLIC_KNOCK_CLIENT_ID`\n- `BLITZ_PUBLIC_KNOCK_FEED_ID`\n\nHere's more context on where to find the Knock variables:\n\n- [Knock API keys](https://docs.knock.app/developer-tools/api-keys)\n- [Knock in-app feed channel ID](https://docs.knock.app/in-app-ui/react/feed#getting-started)\n- [Knock Slack channel ID](https://docs.knock.app/integrations/chat/slack/building-oauth-flow#how-to-set-slack-channel-data-in-knock)\n\n**4. If necessary, install and start postgres**\n\n```\nbrew install postgresql\nbrew services start postgresql\n\n# Verify postgres is running\npg_isready\n\u003e /tmp:5432 - accepting connections\n```\n\n**5. Migrate and seed database**\n\n```\n# Migrate\nyarn blitz prisma migrate dev\n\n# Seed\nyarn blitz db seed\n```\n\n## Running locally\n\nAfter you complete the setup steps, you can start running the app.\n\n```\nyarn blitz dev\n```\n\nThis will start your application at http://localhost:3000. You can log in with these credentials:\n\n- email: `jhammond@ingen.net`\n- pw: `password`\n\nYou can take a look at the users credentials in the seed file in order to log in as a different account; all passwords are `password`.\n\n## Next steps\n\nThis example app showcases a few features you can use with Knock. You'll want to explore:\n\n1. Triggering workflows when a user adds a comment\n2. Adjusting user preferences\n3. Using the notification feed\n4. Integrating Slack or Segment\n\n### Slack notifications\n\nIn order for Slack notifications to work, you will need to expose an endpoint that Slack can access\nas part of the OAuth workflow. An easy way of doing this is installing [ngrok](https://ngrok.com/) and creating a public tunnel\nto your local web server.\n\n### Segment integration\n\nIn order to send events to Segment, you'll need to the the write key from [a source you create](https://segment.com/docs/connections/sources/#create-a-source) in Segment and set it in your `.env` file as the `BLITZ_PUBLIC_SEGMENT_WRITE_KEY`, as well as setting `ENABLE_SEGMENT` to `true`. Check out the `app/lib/analytics.tsx` file to see how you can use [track, page and identify](https://segment.com/docs/connections/sources/catalog/libraries/website/javascript/#basic-tracking-methods) events throughout your code to send events from this app to Segment.\n\n## Connect with us\n\n❤️ **Knock community Slack**\n\nJoin the community, ask questions, and request new features in the [Slack community](https://knockcustomers.slack.com/).\n\n🤲 **Knock support**\n\nEmail us at [support@knock.app](mailto:support@knock.app).\n\n## Practice adding Knock\n\nIf you want to use this application to follow along adding Knock to an existing application, you can switch to the `sans-knock` branch which has a limited set of features and does not include a Knock integration yet. Follow the instructions in the README to see how to add Knock from scratch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknocklabs%2Fknock-node-example-app","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fknocklabs%2Fknock-node-example-app","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fknocklabs%2Fknock-node-example-app/lists"}