Skip to main content
Version: Next

subscribe

Method to subscribe to an SNS topic

Returns following columns:

  • arn: The ARN of the subscription that has been confirmed
  • status: status of the trigger call. OK if succeeded
  • error: Error message in case of failure

Accepts the following parameters:

  • arn: The ARN of the topic you want to subscribe to.
  • endpoint: The endpoint that you want to receive notifications. Endpoints vary by protocol
  • protocol: The protocol that you want to use.
  • attributes: A map of attributes with their corresponding values
  • region: Region where the subscription is stored

Depending on the subscription endpoint, it will need to be confirmed with the ConfirmSubscription RPC call.

Example

SELECT * FROM subscribe('(SELECT arn FROM topic WHERE name='topic_name')', 'my@email.com', 'email', '{"RawMessageDelivery": "true"}');

See