Triggers

Delete several trigger subscriptions

Changed on

Deletes many trigger subscriptions on one connection, and reports what happened to each one separately. Use this endpoint to unsubscribe a selection from the subscription list, or every subscription a set of connected accounts holds to one trigger, instead of calling DeleteTriggerSubscription once per subscription. Pass the connection ID in the path, and name the subscriptions in the body in exactly one of two ways: by subscription_ids, or by trigger_name together with connected_account_ids, which deletes every subscription those accounts hold to that trigger on this connection, whatever its filter. trigger_name alone is refused, so no request can delete every subscription to a trigger. The call is best-effort rather than all-or-nothing: a subscription that could not be deleted does not bring back one that was. Retrying the whole request is safe: a subscription deleted by an earlier attempt comes back as NOT_FOUND, so treat DELETED and NOT_FOUND alike as gone. Unlike DeleteTriggerSubscription, which answers 404 for a missing subscription, the batch reports it as one NOT_FOUND result among many. Delivery stops for each deleted subscription exactly as with DeleteTriggerSubscription: an event already handed off for delivery is still delivered. Returns one result per subscription, each with its outcome (DELETED, NOT_FOUND, FAILED, or NOT_ATTEMPTED when the request ran out of time before reaching it) and a reason, plus deleted_count.

post/api/v1/connections/{connection_id}/trigger-subscriptions:batchDelete

Request

Path parameters

connection_idstring required

ID of the connection whose subscriptions to delete. Only subscriptions on this connection are deleted: a subscription ID from another connection comes back as NOT_FOUND.

Request body

connected_account_idsstring[]

With trigger_name, the other selector: connected account IDs (ca_) whose subscriptions to trigger_name to delete, at most 100, with no repeats. One account can hold several subscriptions to one trigger, one per filter; each is deleted and gets its own result. Results are grouped by account in the order sent and, within an account, ordered by ascending subscription ID. An account with no matching subscription gets one NOT_FOUND result with an empty subscription_id. A connection-scoped subscription names no account, so it is never matched here: delete it by subscription_ids.

subscription_idsstring[]

Trigger subscription IDs (trgs_) to delete, at most 100, with no repeats. One of the two selectors: send either this, or trigger_name with connected_account_ids, never both. Results come back one per ID, in the order sent. Works for account-scoped and connection-scoped subscriptions alike.

trigger_namestring

With connected_account_ids, the other selector: deletes every subscription the listed accounts hold to this trigger on this connection, whatever its filter. Must be sent together with connected_account_ids; sent alone it is refused, so no request can delete every subscription to a trigger. Not checked against the trigger catalogue: a name no subscription uses gives NOT_FOUND for every account. At most 128 characters.

Example request

{
  "connected_account_ids": [
    "ca_123456789012345",
    "ca_123456789012346"
  ],
  "subscription_ids": [
    "trgs_28128748834787841",
    "trgs_28128748834787842"
  ],
  "trigger_name": "slack_message_posted"
}

Response

Request processed; every subscription ID, or every subscription found for the named accounts, has its own result in results, and deleted_count says how many subscriptions this call deleted

deleted_countinteger

How many subscriptions this call deleted. Excludes NOT_FOUND results, so a subscription an earlier attempt already deleted is not counted again.

Example response

{
  "deleted_count": 2,
  "results": [
    {
      "connected_account_id": "ca_123456789012345",
      "reason": "trigger subscription not found",
      "subscription_id": "trgs_28128748834787841"
    }
  ]
}

Changes