ALTER NOTIFICATION INTEGRATION (webhooks)

Modifies the properties for an existing notification integration for a webhook.

See also:

CREATE NOTIFICATION INTEGRATION (webhooks) , DESCRIBE INTEGRATION , DROP INTEGRATION , SHOW INTEGRATIONS

Syntax

ALTER [ NOTIFICATION ] INTEGRATION [ IF EXISTS ] <name> SET
  [ ENABLED = { TRUE | FALSE } ]
  [ WEBHOOK_URL = '<url>' ]
  [ WEBHOOK_SECRET = <secret_name> ]
  [ WEBHOOK_BODY_TEMPLATE = '<template_for_http_request_body>' ]
  [ WEBHOOK_HEADERS = ( '<header_1>'='<value_1>' [ , '<header_N>'='<value_N>', ... ] ) ]
  [ COMMENT = '<string_literal>' ]

ALTER [ NOTIFICATION ] INTEGRATION [ IF EXISTS ] <name> UNSET {
  ENABLED               |
  WEBHOOK_SECRET        |
  WEBHOOK_BODY_TEMPLATE |
  WEBHOOK_HEADERS       |
  COMMENT
}
Copy

Parameters

name

Specifies the identifier for the integration to alter.

If the identifier contains spaces or special characters, the entire string must be enclosed in double quotes. Identifiers enclosed in double quotes are also case-sensitive.

For more information, see Identifier requirements.

SET ...

Sets one or more properties for the integration:

ENABLED = { TRUE | FALSE }

Specifies whether to initiate operation of the integration or suspend it.

  • TRUE enables the integration.

  • FALSE disables the integration for maintenance. Any integration between Snowflake and a third-party service fails to work.

WEBHOOK_URL = 'url'

Specifies the URL for the webhook. The URL must use the https:// protocol.

You can only specify the following URLs:

  • URLs for Slack webhooks. These URLs must start with https://hooks.slack.com/services/.

  • URLs for Teams webhooks. These URLs must use the following general format:

    https://<hostname>.webhook.office.com/webhookb2/<path_components>/IncomingWebhook/<path_components>
    
    Copy
  • URLs for PagerDuty webhooks. This URL must be https://events.pagerduty.com/v2/enqueue.

If the URL includes a secret and you created a secret object for that secret, replace that secret in the URL with SNOWFLAKE_WEBHOOK_SECRET. For example, if you created a secret object for the secret in a Slack webhook URL, set WEBHOOK_URL to:

WEBHOOK_URL='https://hooks.slack.com/services/SNOWFLAKE_WEBHOOK_SECRET'
Copy
WEBHOOK_SECRET = secret_name

Specifies the secret to use with this integration.

If you are using the SNOWFLAKE_WEBHOOK_SECRET placeholder in WEBHOOK_URL, WEBHOOK_BODY_TEMPLATE, or WEBHOOK_HEADERS, the placeholder is replaced by this secret when you send a notification.

If the database and schema containing the secret object will not be active when you send a notification, qualify the secret name with the schema name or the database and schema names. For example:

WEBHOOK_SECRET = my_secrets_db.my_secrets_schema.my_slack_webhook_secret
Copy

You must have the USAGE privilege on the secret (and the database and schema that contain it) to specify this parameter.

Default: No value

WEBHOOK_BODY_TEMPLATE = 'template_for_http_request_body'

Specifies a template for the body of the HTTP request to send for the notification.

If the webhook requires a specific format for the body of the HTTP request (for example, a specific JSON format), set this to a string that specifies the format. In this string:

  • If the message needs to include a secret and you created a secret object for that secret, use the SNOWFLAKE_WEBHOOK_SECRET placeholder where the secret should appear in the message.

  • Use the SNOWFLAKE_WEBHOOK_MESSAGE placeholder where the notification message needs to be included.

For example:

WEBHOOK_BODY_TEMPLATE='{
  "routing_key": "SNOWFLAKE_WEBHOOK_SECRET",
  "event_action": "trigger",
  "payload":
    {
      "summary": "SNOWFLAKE_WEBHOOK_MESSAGE",
      "source": "Snowflake monitoring",
      "severity": "INFO",
    }
  }'
Copy

If you set WEBHOOK_BODY_TEMPLATE, you must also set WEBHOOK_HEADERS to include the Content-Type header with the type of your message. For example, if you set WEBHOOK_BODY_TEMPLATE to a template in JSON format, set WEBHOOK_HEADERS to include the header Content-Type: application/json:

WEBHOOK_HEADERS=('Content-Type'='application/json')
Copy

Default: No value

WEBHOOK_HEADERS = ( 'header'='value' [ , 'header'='value', ... ] )

Specifies a list of HTTP headers and values to include in the HTTP request for the webhook.

If an HTTP header must include a secret (for example, the Authorization header) and you created a secret object for that secret, use the SNOWFLAKE_WEBHOOK_SECRET placeholder in the header value. For example:

WEBHOOK_HEADERS=('Authorization'='Basic SNOWFLAKE_WEBHOOK_SECRET')
Copy

Default: No value

COMMENT = 'string_literal'

String (literal) that specifies a comment for the integration.

Default: No value

UNSET ...

Unsets one or more properties for the integration, which resets the properties to their default values:

  • ENABLED

  • WEBHOOK_SECRET

  • WEBHOOK_BODY_TEMPLATE

  • WEBHOOK_HEADERS

  • COMMENT

To unset multiple properties or parameters with a single ALTER statement, separate each property or parameter with a comma.

When unsetting a property or parameter, specify only the property or parameter name (unless the syntax above indicates that you should specify the value). Specifying the value returns an error.

Access control requirements

A role used to execute this SQL command must have the following privileges at a minimum:

Privilege

Object

Notes

OWNERSHIP

Integration

OWNERSHIP is a special privilege on an object that is automatically granted to the role that created the object, but can also be transferred using the GRANT OWNERSHIP command to a different role by the owning role (or any role with the MANAGE GRANTS privilege).

USAGE

Secret

If you set the WEBHOOK_SECRET property to a secret object, you must have the USAGE privilege on that secret and on the database and schema containing that secret.

For instructions on creating a custom role with a specified set of privileges, see Creating custom roles.

For general information about roles and privilege grants for performing SQL actions on securable objects, see Overview of Access Control.

Usage notes

  • Regarding metadata:

    Attention

    Customers should ensure that no personal data (other than for a User object), sensitive data, export-controlled data, or other regulated data is entered as metadata when using the Snowflake service. For more information, see Metadata fields in Snowflake.

Language: English