ALTER NOTIFICATION INTEGRATION (Webhook)

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

See also:

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

语法

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
}

参数

name

指定要更改的集成的标识符。

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 ...

为集成设置一个或多个属性:

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.

The value is case-insensitive.

The default is TRUE.

WEBHOOK_URL = 'url'

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

You can only specify the following URLs:

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'
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

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",
    }
  }'

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')

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')

Default: No value

COMMENT = 'string_literal'

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

Default: No value

UNSET ...

取消设置集成的一个或多个属性,这会将属性重置为其默认值:

  • 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.

访问控制要求

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

权限对象备注
OWNERSHIP集成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](/sql-reference/sql/grant-ownership) command to a different role by the owning role (or any role with the MANAGE GRANTS privilege).
USAGE密钥如果将 WEBHOOK_SECRET 属性设置为密钥对象,则必须对该密钥以及包含该密钥的数据库和架构拥有 USAGE 权限。

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.

使用说明

  • 关于元数据:

    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.