Environments allow you to manage different stages of your application development lifecycle. Each environment has its own set of API keys and configurations, enabling you to separate development, staging, and production workflows. https://docs.novu.co/platform/environments
- getTags - List environment tags
- diff - Compare resources between environments
- publish - Publish resources to target environment
- create - Create an environment
- list - List all environments
- update - Update an environment
- delete - Delete an environment
Retrieve all unique tags used in workflows within the specified environment. These tags can be used for filtering workflows.
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$response = $sdk->environments->getTags(
environmentId: '6615943e7ace93b0540ae377'
);
if ($response->getEnvironmentTagsDtos !== null) {
// handle response
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
environmentId |
string | ✔️ | Environment internal ID (MongoDB ObjectId) or identifier | 6615943e7ace93b0540ae377 |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\EnvironmentsControllerGetEnvironmentTagsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ErrorDto | 414 | application/json |
| Errors\ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Errors\ValidationErrorDto | 422 | application/json |
| Errors\ErrorDto | 500 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Compares workflows and other resources between the source and target environments, returning detailed diff information including additions, modifications, and deletions.
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$diffEnvironmentRequestDto = new Components\DiffEnvironmentRequestDto(
sourceEnvironmentId: '507f1f77bcf86cd799439011',
);
$response = $sdk->environments->diff(
targetEnvironmentId: '6615943e7ace93b0540ae377',
diffEnvironmentRequestDto: $diffEnvironmentRequestDto
);
if ($response->diffEnvironmentResponseDto !== null) {
// handle response
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
targetEnvironmentId |
string | ✔️ | Target environment ID (MongoDB ObjectId) to compare against | 6615943e7ace93b0540ae377 |
diffEnvironmentRequestDto |
Components\DiffEnvironmentRequestDto | ✔️ | Diff request configuration | |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\EnvironmentsControllerDiffEnvironmentResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ErrorDto | 414 | application/json |
| Errors\ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Errors\ValidationErrorDto | 422 | application/json |
| Errors\ErrorDto | 500 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Publishes all workflows and resources from the source environment to the target environment. Optionally specify specific resources to publish or use dryRun mode to preview changes.
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$publishEnvironmentRequestDto = new Components\PublishEnvironmentRequestDto(
sourceEnvironmentId: '507f1f77bcf86cd799439011',
resources: [
new Components\ResourceToPublishDto(
resourceType: Components\ResourceTypeEnum::Regular,
resourceId: 'workflow-id-1',
),
],
);
$response = $sdk->environments->publish(
targetEnvironmentId: '6615943e7ace93b0540ae377',
publishEnvironmentRequestDto: $publishEnvironmentRequestDto
);
if ($response->publishEnvironmentResponseDto !== null) {
// handle response
}| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
targetEnvironmentId |
string | ✔️ | Target environment ID (MongoDB ObjectId) to publish resources to | 6615943e7ace93b0540ae377 |
publishEnvironmentRequestDto |
Components\PublishEnvironmentRequestDto | ✔️ | Publish request configuration | |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\EnvironmentsControllerPublishEnvironmentResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ErrorDto | 414 | application/json |
| Errors\ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Errors\ValidationErrorDto | 422 | application/json |
| Errors\ErrorDto | 500 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Creates a new environment within the current organization. Environments allow you to manage different stages of your application development lifecycle. Each environment has its own set of API keys and configurations.
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$createEnvironmentRequestDto = new Components\CreateEnvironmentRequestDto(
name: 'Production Environment',
parentId: '60d5ecb8b3b3a30015f3e1a1',
color: '#3498db',
);
$response = $sdk->environments->create(
createEnvironmentRequestDto: $createEnvironmentRequestDto
);
if ($response->environmentResponseDto !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
createEnvironmentRequestDto |
Components\CreateEnvironmentRequestDto | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\EnvironmentsControllerV1CreateEnvironmentResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ErrorDto | 402, 414 | application/json |
| Errors\ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Errors\ValidationErrorDto | 422 | application/json |
| Errors\ErrorDto | 500 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
This API returns a list of environments for the current organization. Each environment contains its configuration, API keys (if user has access), and metadata.
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$response = $sdk->environments->list(
);
if ($response->environmentResponseDtos !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\EnvironmentsControllerV1ListMyEnvironmentsResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ErrorDto | 414 | application/json |
| Errors\ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Errors\ValidationErrorDto | 422 | application/json |
| Errors\ErrorDto | 500 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Update an environment by its unique identifier environmentId. You can modify the environment name, identifier, color, and other configuration settings.
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Components;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$updateEnvironmentRequestDto = new Components\UpdateEnvironmentRequestDto();
$response = $sdk->environments->update(
environmentId: '<id>',
updateEnvironmentRequestDto: $updateEnvironmentRequestDto
);
if ($response->environmentResponseDto !== null) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
environmentId |
string | ✔️ | The unique identifier of the environment |
updateEnvironmentRequestDto |
Components\UpdateEnvironmentRequestDto | ✔️ | N/A |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\EnvironmentsControllerV1UpdateMyEnvironmentResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ErrorDto | 414 | application/json |
| Errors\ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Errors\ValidationErrorDto | 422 | application/json |
| Errors\ErrorDto | 500 | application/json |
| Errors\APIException | 4XX, 5XX | */* |
Delete an environment by its unique identifier environmentId. This action is irreversible and will remove the environment and all its associated data.
declare(strict_types=1);
require 'vendor/autoload.php';
use novu;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$response = $sdk->environments->delete(
environmentId: '<id>'
);
if ($response->statusCode === 200) {
// handle response
}| Parameter | Type | Required | Description |
|---|---|---|---|
environmentId |
string | ✔️ | The unique identifier of the environment |
idempotencyKey |
?string | ➖ | A header for idempotency purposes |
?Operations\EnvironmentsControllerV1DeleteEnvironmentResponse
| Error Type | Status Code | Content Type |
|---|---|---|
| Errors\ErrorDto | 414 | application/json |
| Errors\ErrorDto | 400, 401, 403, 404, 405, 409, 413, 415 | application/json |
| Errors\ValidationErrorDto | 422 | application/json |
| Errors\ErrorDto | 500 | application/json |
| Errors\APIException | 4XX, 5XX | */* |