Event Subscriptions

An EventSubscription selects EventRecords for an EventChannel and sends them to one or more EventTargets.

List Event Subscriptions

SDK Method

event_subscription.List()

Return Values

Returns a *event_subscription.Iter and an error. Range over All() to receive files_sdk.EventSubscription values and errors. Check each loop error before using its resource. Next() and Err() remain supported.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

Additional Arguments

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    event_subscription "github.com/Files-com/files-sdk-go/v3/eventsubscription"
)

eventSubscriptionIterator, err := event_subscription.List(files_sdk.EventSubscriptionListParams{})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}

for eventSubscription, err := range eventSubscriptionIterator.All() {
    if err != nil {
        var respErr files_sdk.ResponseError
        if errors.As(err, &respErr) {
            fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
        } else {
            fmt.Printf("Request failed: %v\n", err)
        }
        return
    }
    fmt.Println(eventSubscription)
}

Show Event Subscription

SDK Method

event_subscription.Find()

Return Values

Returns a files_sdk.EventSubscription value and an error.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

EventSubscriptionFindParams Fields

FieldDescription
Id
int64
Required
Event Subscription ID.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    event_subscription "github.com/Files-com/files-sdk-go/v3/eventsubscription"
)

eventSubscription, err := event_subscription.Find(files_sdk.EventSubscriptionFindParams{Id: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}
fmt.Println(eventSubscription)

Create Event Subscription

SDK Method

event_subscription.Create()

Return Values

Returns a files_sdk.EventSubscription value and an error.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

EventSubscriptionCreateParams Fields

FieldDefaultDescription
EventChannelId
int64
Event Channel ID
WorkspaceId
int64
0Workspace ID. 0 means the default workspace or site-wide.
ApplyToAllWorkspaces
boolean
falseIf true, this default-workspace subscription applies to events from all workspaces.
Name
string
Required
Event Subscription name.
Subject
string
Custom subject line to use for notification emails.
Message
string
Custom message to include in notification emails.
MessageOnly
boolean
falseIf true, notification email bodies contain only the custom message, omitting event details and the review button. Requires a custom message, defaults to false, and does not affect non-email targets.
Enabled
boolean
trueWhether this Event Subscription can dispatch events.
EventTypes
array(string)
Event type strings matched by this subscription. Blank means all event types. Valid values: automation_run.canceled.v1, automation_run.failure.v1, automation_run.failure_will_retry.v1, automation_run.partial_failure.v1, automation_run.partial_failure_will_retry.v1, automation_run.skipped.v1, automation_run.success.v1, expectation_evaluation.invalid.v1, expectation_evaluation.late.v1, expectation_evaluation.missing.v1, expectation_evaluation.success.v1, expectation_incident.acknowledged.v1, expectation_incident.open.v1, expectation_incident.resolved.v1, expectation_incident.snoozed.v1, external_event.client_log.failure.v1, external_event.client_log.partial_failure.v1, external_event.client_log.skipped.v1, external_event.client_log.success.v1, pending_work_event.failure.v1, pending_work_event.partial_failure.v1, pending_work_event.skipped.v1, pending_work_event.success.v1, siem_http_destination_event.failure.v1, siem_http_destination_event.partial_failure.v1, siem_http_destination_event.skipped.v1, siem_http_destination_event.success.v1, sso_event.ldap_login.failure.v1, sso_event.ldap_login.partial_failure.v1, sso_event.ldap_login.skipped.v1, sso_event.ldap_login.success.v1, sso_event.ldap_sync.failure.v1, sso_event.ldap_sync.partial_failure.v1, sso_event.ldap_sync.skipped.v1, sso_event.ldap_sync.success.v1, sso_event.saml_login.failure.v1, sso_event.saml_login.partial_failure.v1, sso_event.saml_login.skipped.v1, sso_event.saml_login.success.v1, sync_run.failure.v1, sync_run.partial_failure.v1, sync_run.skipped.v1, sync_run.success.v1, user_security_event.lockout.v1
Filter
object
Conditions on event fields that an event must meet to be delivered, keyed by dot-notation field path. All conditions must match.
DeliveryPolicy
object
Event Subscription delivery policy.
EventTargetIds
array(int64)
Event Target IDs this subscription sends to.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    event_subscription "github.com/Files-com/files-sdk-go/v3/eventsubscription"
)

eventSubscription, err := event_subscription.Create(files_sdk.EventSubscriptionCreateParams{Name: "example"})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}
fmt.Println(eventSubscription)

Update Event Subscription

SDK Method

event_subscription.Update()

Return Values

Returns a files_sdk.EventSubscription value and an error.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

EventSubscriptionUpdateParams Fields

FieldDescription
Id
int64
Required
Event Subscription ID.
EventChannelId
int64
Event Channel ID
WorkspaceId
int64
Workspace ID. 0 means the default workspace or site-wide.
ApplyToAllWorkspaces
boolean
If true, this default-workspace subscription applies to events from all workspaces.
Name
string
Event Subscription name.
Subject
string
Custom subject line to use for notification emails.
Message
string
Custom message to include in notification emails.
MessageOnly
boolean
If true, notification email bodies contain only the custom message, omitting event details and the review button. Requires a custom message, defaults to false, and does not affect non-email targets.
Enabled
boolean
Whether this Event Subscription can dispatch events.
EventTypes
array(string)
Event type strings matched by this subscription. Blank means all event types. Valid values: automation_run.canceled.v1, automation_run.failure.v1, automation_run.failure_will_retry.v1, automation_run.partial_failure.v1, automation_run.partial_failure_will_retry.v1, automation_run.skipped.v1, automation_run.success.v1, expectation_evaluation.invalid.v1, expectation_evaluation.late.v1, expectation_evaluation.missing.v1, expectation_evaluation.success.v1, expectation_incident.acknowledged.v1, expectation_incident.open.v1, expectation_incident.resolved.v1, expectation_incident.snoozed.v1, external_event.client_log.failure.v1, external_event.client_log.partial_failure.v1, external_event.client_log.skipped.v1, external_event.client_log.success.v1, pending_work_event.failure.v1, pending_work_event.partial_failure.v1, pending_work_event.skipped.v1, pending_work_event.success.v1, siem_http_destination_event.failure.v1, siem_http_destination_event.partial_failure.v1, siem_http_destination_event.skipped.v1, siem_http_destination_event.success.v1, sso_event.ldap_login.failure.v1, sso_event.ldap_login.partial_failure.v1, sso_event.ldap_login.skipped.v1, sso_event.ldap_login.success.v1, sso_event.ldap_sync.failure.v1, sso_event.ldap_sync.partial_failure.v1, sso_event.ldap_sync.skipped.v1, sso_event.ldap_sync.success.v1, sso_event.saml_login.failure.v1, sso_event.saml_login.partial_failure.v1, sso_event.saml_login.skipped.v1, sso_event.saml_login.success.v1, sync_run.failure.v1, sync_run.partial_failure.v1, sync_run.skipped.v1, sync_run.success.v1, user_security_event.lockout.v1
Filter
object
Conditions on event fields that an event must meet to be delivered, keyed by dot-notation field path. All conditions must match.
DeliveryPolicy
object
Event Subscription delivery policy.
EventTargetIds
array(int64)
Event Target IDs this subscription sends to.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    event_subscription "github.com/Files-com/files-sdk-go/v3/eventsubscription"
)

eventSubscription, err := event_subscription.Update(files_sdk.EventSubscriptionUpdateParams{
  Id: 1,
  EventChannelId: 1,
})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}
fmt.Println(eventSubscription)

Delete Event Subscription

SDK Method

event_subscription.Delete()

Return Values

Returns an error, or nil on success.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

EventSubscriptionDeleteParams Fields

FieldDescription
Id
int64
Required
Event Subscription ID.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    event_subscription "github.com/Files-com/files-sdk-go/v3/eventsubscription"
)

err := event_subscription.Delete(files_sdk.EventSubscriptionDeleteParams{Id: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}

The EventSubscription Object

Some of the methods above return a EventSubscription object. The attributes of this object are listed below.

AttributeDescription
Id
int64
Event Subscription ID
EventChannelId
int64
Event Channel ID
WorkspaceId
int64
Workspace ID. 0 means the default workspace or site-wide.
ApplyToAllWorkspaces
boolean
If true, this default-workspace subscription applies to events from all workspaces.
Name
string
Event Subscription name.
Subject
string
Custom subject line to use for notification emails.
Message
string
Custom message to include in notification emails.
MessageOnly
boolean
If true, notification email bodies contain only the custom message, omitting event details and the review button. Requires a custom message, defaults to false, and does not affect non-email targets.
Enabled
boolean
Whether this Event Subscription can dispatch events.
EventTypes
array(string)
Event type strings matched by this subscription. Blank means all event types. Valid values: automation_run.canceled.v1, automation_run.failure.v1, automation_run.failure_will_retry.v1, automation_run.partial_failure.v1, automation_run.partial_failure_will_retry.v1, automation_run.skipped.v1, automation_run.success.v1, expectation_evaluation.invalid.v1, expectation_evaluation.late.v1, expectation_evaluation.missing.v1, expectation_evaluation.success.v1, expectation_incident.acknowledged.v1, expectation_incident.open.v1, expectation_incident.resolved.v1, expectation_incident.snoozed.v1, external_event.client_log.failure.v1, external_event.client_log.partial_failure.v1, external_event.client_log.skipped.v1, external_event.client_log.success.v1, pending_work_event.failure.v1, pending_work_event.partial_failure.v1, pending_work_event.skipped.v1, pending_work_event.success.v1, siem_http_destination_event.failure.v1, siem_http_destination_event.partial_failure.v1, siem_http_destination_event.skipped.v1, siem_http_destination_event.success.v1, sso_event.ldap_login.failure.v1, sso_event.ldap_login.partial_failure.v1, sso_event.ldap_login.skipped.v1, sso_event.ldap_login.success.v1, sso_event.ldap_sync.failure.v1, sso_event.ldap_sync.partial_failure.v1, sso_event.ldap_sync.skipped.v1, sso_event.ldap_sync.success.v1, sso_event.saml_login.failure.v1, sso_event.saml_login.partial_failure.v1, sso_event.saml_login.skipped.v1, sso_event.saml_login.success.v1, sync_run.failure.v1, sync_run.partial_failure.v1, sync_run.skipped.v1, sync_run.success.v1, user_security_event.lockout.v1
Filter
object
Conditions on event fields that an event must meet to be delivered, keyed by dot-notation field path. All conditions must match.
DeliveryPolicy
object
Event Subscription delivery policy.
EventTargetIds
array(int64)
Event Target IDs this subscription sends to.
CreatedAt
date-time
Event Subscription create date/time.
UpdatedAt
date-time
Event Subscription update date/time.

filter

Each key is the full dot-notation path to a field in the event JSON that webhook targets receive, such as payload.status. Paths can reference top-level fields such as type, workspace_id, and occurred_at, actor fields such as actor.username, human-readable fields such as human.title, and event-specific fields under payload, such as payload.status, payload.sync_name, or payload.automation_name. Fields under payload vary by event type. Every segment of a path must name an object key.
Each value is the condition that field must meet: a plain value, an array of values, or an object with exactly one operator key. A plain value works the same as equals, and an array works the same as one_of.
An event matches only when every condition matches. An empty object matches every event of the subscription's event types.

Example filter

{
  "payload.sync_name": {
    "prefix": "Nightly"
  },
  "payload.event_errors": {
    "exists": true
  }
}

Filter operators