Skip to main content

notification_rules

Creates, updates, deletes, gets or lists a notification_rules resource.

Overview​

Namenotification_rules
TypeResource
Idrailway.observability.notification_rules

Fields​

The following fields are returned by SELECT queries:

One row per NotificationRule.

NameDatatypeDescription
idstring
environment_idstring
project_idstring
service_idstring
workspace_idstring
channelsarrayList of NotificationChannel objects
created_atstring (date-time)
ephemeral_environmentsboolean
event_typesarray
severitiesarray
updated_atstring (date-time)

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectworkspace_idproject_idGet all notification rules for a workspace and project. Backed by the Railway GraphQL query notificationRules.
createinsertchannel_configs, event_types, workspace_idCreate a new notification rule. Backed by the Railway GraphQL mutation notificationRuleCreate.
updateupdateidUpdate a notification rule. Backed by the Railway GraphQL mutation notificationRuleUpdate.
deletedeleteidDelete a notification rule. Backed by the Railway GraphQL mutation notificationRuleDelete.
test_webhookexecpayload, urlTest a webhook URL by sending a sample payload. Returns the HTTP status code. Backed by the Railway GraphQL mutation webhookTest.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
workspace_idstring
project_idstring
channel_configsarray
event_typesarray
idstring
payloadstring
urlstring

SELECT examples​

Get all notification rules for a workspace and project. Backed by the Railway GraphQL query notificationRules.

SELECT
id,
environment_id,
project_id,
service_id,
workspace_id,
channels,
created_at,
ephemeral_environments,
event_types,
severities,
updated_at
FROM railway.observability.notification_rules
WHERE workspace_id = '{{ workspace_id }}' -- required
AND project_id = '{{ project_id }}'
;

INSERT examples​

Create a new notification rule. Backed by the Railway GraphQL mutation notificationRuleCreate.

INSERT INTO railway.observability.notification_rules (
channel_configs,
ephemeral_environments,
event_types,
project_id,
severities,
workspace_id
)
SELECT
'{{ channel_configs }}' /* required */,
{{ ephemeral_environments }},
'{{ event_types }}' /* required */,
'{{ project_id }}',
'{{ severities }}',
'{{ workspace_id }}' /* required */
RETURNING
id,
environment_id,
project_id,
service_id,
workspace_id,
channels,
created_at,
ephemeral_environments,
event_types,
severities,
updated_at
;

UPDATE examples​

Update a notification rule. Backed by the Railway GraphQL mutation notificationRuleUpdate.

UPDATE railway.observability.notification_rules
SET
channel_configs = '{{ channel_configs }}',
ephemeral_environments = '{{ ephemeral_environments }}',
event_types = '{{ event_types }}',
severities = '{{ severities }}'
WHERE
id = '{{ id }}' --required
RETURNING
id,
environment_id,
project_id,
service_id,
workspace_id,
channels,
created_at,
ephemeral_environments,
event_types,
severities,
updated_at;

DELETE examples​

Delete a notification rule. Backed by the Railway GraphQL mutation notificationRuleDelete.

DELETE FROM railway.observability.notification_rules
WHERE
id = '{{ id }}' --required
;

Lifecycle Methods​

Test a webhook URL by sending a sample payload. Returns the HTTP status code. Backed by the Railway GraphQL mutation webhookTest.

EXEC railway.observability.notification_rules.test_webhook
@payload='{{ payload }}', --required
@url='{{ url }}' --required
;