Environments
Learn how to use Knock environments.
Knock environments enable you to test and review changes before you ship them to production.
Each Knock environment has its own isolated data (such as users, tenants, and objects) and its own version-controlled content (such as workflows, guides, and layouts.)
How environments work
#Your Knock account starts with two environments: development and production.
You can create additional environments (for example, a Staging environment to mirror your own development lifecycle.)
Environments contain isolated data (such as users, objects, and logs) and version-controlled content (such as workflows, layouts, and partials.)
With Knock environments you:
- Use environment-specific API keys to send data to your environments.
- Create, update, and version content within any environment.
- For production-critical use cases, create content in your development environment, then promote it to production.
Send data to environments
#Each environment has a set of data resources that are per-environment and will never be shared between environments. These data resources are not version-controlled.
An example: the users you identify in Knock. Your real production users are identified in your production environment, while your test development users are identified in your development environment.
Each environment has its own set of API keys which you use to send data to the environment. You can find your environment-specific API keys under "Platform" > "API keys" in the Knock dashboard.
Create content in environments
#Each environment has a set of content resources that are managed via version control. These are resources associated with the creation and orchestration of the content you send to your customers, such as workflows, layouts, and templates.
Here's how content resources work:
- Content can be created in any environment.
- Content can be promoted upwards through environments.
- Content can only be edited in the environment in which it was created.
- Content is versioned with commits. You can roll back to earlier commits at any time.
These rules enable two ways of working with content and shipping it to your end users in production:
Clone resources across environments
#You can clone supported resources from one environment to another in the Knock dashboard. Cloning creates a new copy of the resource in the destination environment. The clone gets a new key by default (with a -copy suffix) and is independent from the original.
Open a resource's action menu and select Clone (or Duplicate for email layouts) to start a clone. When your account has more than one writable destination environment, you can choose which environment to clone into.
Cloning is a dashboard-only feature. It is not available through the Knock CLI or Management API at this time.
Supported resources
#You can clone the following resources across environments:
- Workflows
- Broadcasts
- Guides
- Message types
- Email layouts
- Audiences
- Partials
- Translations
- Reusable requests
- Source event mappings
Archived resources cannot be cloned.
Clone vs promote
#Clone and promote solve different problems:
- Clone. Creates a new resource in another environment. Use this when you want a copy to exist in both environments, or when you need to copy content to an environment lower in the promotion chain (for example, from production to development).
- Promote. Moves committed changes for an existing resource up through your environment chain, keeping the same key. Use this when you are following the development-to-production workflow and want the same resource to exist across environments.
When you clone a workflow, Knock also copies its channel step templates and workflow schema into the destination environment.
Environment targeting
#Which environments you can clone into depends on your account's production write access setting on the Permissions page in your account settings:
- Production write access enabled. You can clone into any environment in your project.
- Production write access disabled. You can only clone into your Development environment.
This follows the same rules as creating and editing content in an environment. If production write access is disabled, environments other than Development are read-only and cannot be selected as a clone destination.
Branch environments cannot be used as clone targets.
Common use cases
#- Copy a broadcast from development to production. Create and test a broadcast in development, then clone it to production when you are ready to send it to real users.
- Copy production content back to development. If you created a workflow directly in production and want to edit it using the promotion model, clone it into your development environment. You can give the clone the same key as the production resource if you plan to promote it back and overwrite the production version later.
- Duplicate a workflow for experimentation. Clone a workflow within the same environment (or into another environment) to try changes without affecting the original.
Create additional environments
#By default your Knock account comes with two environments: development and production. If you need an additional environment in Knock to mirror your own development lifecycle (for example, a staging environment) you can add it on the settings page of the Knock dashboard.
To create a new environment, go to the Environments page under the Version control section of your account settings. You'll see a button to "Create environment."
When you create an additional environment, it will be inserted between development and production for environment promotion purposes. Any additional new environments will always be added one "level" lower than Production; environments cannot be re-ordered, as this would break the promotion model for previously-promoted changes.
Environment access controls
#We recognize the importance of protecting your sensitive data, so we designed Knock from the ground-up with privacy and security in mind.
There are two tools you can use to control access to your data in the Knock dashboard:
- Roles and permissions. Knock offers granular roles for the different functions your team members may want to carry out in Knock, such as support team members that need to debug issues for customers but shouldn't be making changes to notification logic.
- Customer data obfuscation. You can use our per-environment data obfuscation controls to configure whether you want your team members to be able to view customer data in the Knock dashboard.