What is Knock?
Knock is notifications infrastructure that helps you implement notifications your users will love, without the effort of building and maintaining your own in-house notifications system.
In this overview, we’ll cover some of the foundational concepts of Knock. Knock is designed with both developers and product teams in mind: it’s easy for developers to implement quickly, and simple for less-technical users to maintain with our intuitive dashboard.
Workflows
Workflows are a foundational concept in Knock. They allow you to easily model complex messaging flows across channels using a variety of logical function steps while respecting a user’s individual preferences. All Knock notifications are sent by triggering a workflow.
Your application can trigger workflows using our REST API, any one of our available SDKs, or by integrating a CDP like Segment as an event source. You can use the dropdown menu on the code sample below to look at a sample in your language of choice:
Knock processes each workflow run using a combination of the following concepts:
Recipients
Recipients are in most cases users in your application. As you trigger workflows for recipients, Knock creates a cache of the data needed to notify them on different platforms, like an email address, phone number, avatar URL, or push token. Knock also stores custom properties you pass from your application to customize their notifications, like a plan type, user role, or timezone.
Channels
Channels in Knock represent a specific provider you have configured to send notifications. You can include channel steps in your workflows to send notifications with the providers you already use in production. Knock supports the following channel types and providers:
A notification that is generated as a part of a workflow is called a Message
, and Knock allows you to define dynamic message templates using a combination of a drag-and-drop editor and the Liquid templating language.
This helps product and marketing teams standardize on one templating system instead of using different templating languages for different providers. It also has the added benefit of lifting these messages out of your codebase so you can iterate quickly on customer communications without a developer.
Functions
Each workflow can combine multiple function steps to model complex logic that creates better notification experiences. You can combine the following function steps with any number of channel steps to create personalized notifications for your users:
In addition to combining channel steps and function steps to create complex workflows, you can augment these steps with additional logic based on the user recipient, inputs from your application, or the status of previous workflow steps. These are called step conditions.
Step conditions
Step conditions exist across both channel and function steps, and they allow you to conditionally execute steps based on trigger payload data, user properties, or the status of previous steps
Examples:
- Only send an email message if an in-app message has not been seen
- Only send an in-app notification if
recipient.plan === "pro"
- Only execute a delay step if
delay === true
in the trigger payload
In addition to giving your technical and non-technical users the ability to construct these workflows via a drag-and-drop editor, Knock also enables your users to exercise control over their own notification experience using a flexible preferences model.
Preferences
In Knock, each workflow run is executed on behalf of a recipient, and each recipient can specify their preferences to receive notifications across a number of different criteria: channel types, individual workflows, and workflow categories.
Application developers have control over how these preference sets are presented to the user and which options to surface, but Knock enforces these preferences during every workflow run automatically.
You can learn more about how to set a user's preferences in our preferences overview.
Next steps
Now that you understand some of the core concepts of Knock, you can either start building with Knock or explore some of the more advanced features Knock offers.
Build something
If you want to start by adding Knock to your existing system, you can check out our quick start guide to implement your first workflow. This quick start will help you integrate Knock with your backend codebase.
If you want to keep learning about Knock using a curated example application, check out our catalog of examples apps. Here are some recommendations:
Keep learning
While the workflow engine is at the heart of Knock, our goal is to build a complete notification system for our customers. Here is an overview of some of the more-advanced features that we provide:
UI components
Knock provides developers with React components like <NotificationFeed/>
and <SlackAuthButton/>
to use in their applications. You can read more about building in-app UI with Knock for both web and mobile here.
Advanced concepts
There is a lot more to learn about Knock, and our concepts overview page is a good place to start. Here are use cases our customers commonly solve with Knock:
- Powering translation and localization and managing timezone-aware delivery
- Creating advanced notification logic using subscriptions and schedules
- Integrating Knock with your application's data model, using tenants and objects to power customized experiences
- Using the template editor to standarize messaging templates across providers
Developer tools
Knock is a developer-first platform, with both environment and commit models. If you want to work with Knock resources in code, you can use our Management API or CLI.
Once you're sending notifications through Knock, we offer observability tools like workflow run logs (to examine all steps of workflow execution in your dashboard) and data streaming into a monitoring system like Datadog with extensions.