Get started with Knock
In this guide, you'll integrate Knock with your backend web application and send your first notification using Knock.
Create a Knock account
First, create a Knock account if you don't already have one and log into the Knock dashboard.
Add the Knock SDK to your backend
We have SDKs available in most major languages. Don't see your language listed here? Let us know!
Set up environment variables
You can find your public and secret API keys under the Developers section of the Knock dashboard. Since we're working on the backend here, you'll want to use the secret key.
As a best practice, your API key should be set as an environment variable and should not be checked into source control.
Create a workflow in Knock
Next we'll design our first workflow in Knock via the dashboard.
A workflow encapsulates a notification in Knock. Each workflow takes a trigger call via the Knock API, runs the data you provide through a set of logic you configure, and outputs the actual messages that will be sent to your end users. All channel routing and message design takes place within the workflow.
Here's how to build your first workflow:
Now we're ready to trigger our workflow via the Knock API. You can also learn more about workflows and channels in Knock via our guide on designing workflows.
Trigger your workflow
Now, you'll trigger your workflow to notify a set of users. When triggering workflows, you need to provide the following required pieces of data in your call to the Knock API:
recipients
– The list of users to notify.data
– The variable data that will populate your notification templates. Here you'll use the sample data payload we grabbed in step 3.
In the example below, we trigger a new comment notification workflow for two project members, using inline identification.
Learn more about trigger calls in our API reference.
Publish to production
Knock uses logically separated environments to control the roll-out of your notifications. When you're happy with the way your workflows work and look, you just need to promote them to production to start sending notifications to your real users.
See our guide on going to production to review a complete set of steps you'll need to take to push your workflows to production.
Go deeper
This was a simple overview to send your first notification with Knock. Read on to see how Knock can drive your notification needs, no matter their complexity.