slack

package
v1.18.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package slack provides the Slack integration definition for integrations

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrOAuthTokenMissing indicates the Slack OAuth access token is missing from the credential
	ErrOAuthTokenMissing = errors.New("slack: oauth token missing")
	// ErrBotTokenMissing indicates the Slack bot token is missing from the credential
	ErrBotTokenMissing = errors.New("slack: bot token missing")
	// ErrNoCredentialResolved indicates neither OAuth nor bot token credential was found
	ErrNoCredentialResolved = errors.New("slack: no credential resolved")
	// ErrChannelMissing indicates the Slack channel is missing from the operation config
	ErrChannelMissing = errors.New("slack: channel missing")
	// ErrMessageEmpty indicates the Slack message has no content
	ErrMessageEmpty = errors.New("slack: message must have text, blocks, or attachments")
	// ErrClientType indicates the provided client is not a Slack client
	ErrClientType = errors.New("slack: unexpected client type")
	// ErrAuthTestFailed indicates auth.test failed
	ErrAuthTestFailed = errors.New("slack: auth test failed")
	// ErrOperationConfigInvalid indicates operation config could not be decoded
	ErrOperationConfigInvalid = errors.New("slack: operation config invalid")
	// ErrMessageSendFailed indicates chat.postMessage failed
	ErrMessageSendFailed = errors.New("slack: message send failed")
	// ErrResultEncode indicates an operation result could not be serialized
	ErrResultEncode = errors.New("slack: result encode failed")
	// ErrUsersFetchFailed indicates the workspace users list request failed
	ErrUsersFetchFailed = errors.New("slack: users fetch failed")
	// ErrPayloadEncode indicates a collected Slack payload could not be serialized for ingest
	ErrPayloadEncode = errors.New("slack: ingest payload encode failed")
	// ErrCredentialEncode indicates the credential could not be serialized
	ErrCredentialEncode = errors.New("slack: credential encode failed")
	// ErrCredentialDecode indicates the credential could not be deserialized
	ErrCredentialDecode = errors.New("slack: credential decode failed")
)

Functions

func Builder

func Builder(cfg Config) registry.Builder

Builder returns the Slack definition builder with the supplied operator config applied

Types

type Client

type Client struct{}

Client builds Slack Web API clients for one installation

func (Client) Build

Build constructs the Slack Web API client for one installation

type Config

type Config struct {
	// ClientID is the Slack OAuth application client identifier
	ClientID string `json:"clientid" koanf:"clientid"`
	// ClientSecret is the Slack OAuth application client secret
	ClientSecret string `json:"clientsecret" koanf:"clientsecret" sensitive:"true"`
	// RedirectURL is the OAuth callback URL registered with the Slack application
	RedirectURL string `json:"redirecturl" koanf:"redirecturl" default:"https://api.theopenlane.io/v1/integrations/auth/callback"`
}

Config holds operator-level credentials for the Slack definition

type DirectorySync

type DirectorySync struct {
	// Disable is used to disable the directory sync operation from GitHub
	Disable bool `json:"disable,omitempty" jsonschema:"title=Disable,description=Disable the syncing of users from Slack"`
	// FilterExpr limits imported records to envelopes matching the CEL expression
	FilterExpr string `` /* 185-byte string literal not displayed */
}

func (DirectorySync) IngestHandle

func (d DirectorySync) IngestHandle() types.IngestHandler

IngestHandle adapts directory sync to the ingest operation registration boundary

func (DirectorySync) Run

Run collects Slack workspace users and emits directory account ingest payloads

type HealthCheck

type HealthCheck struct {
	// Team is the Slack team name
	Team string `json:"team"`
	// URL is the Slack team URL
	URL string `json:"url"`
	// User is the authenticated Slack user
	User string `json:"user"`
}

HealthCheck holds the result of a Slack health check

func (HealthCheck) Handle

func (h HealthCheck) Handle() types.OperationHandler

Handle adapts the health check to the generic operation registration boundary

func (HealthCheck) Run

Run executes the Slack auth.test health check

type InstallationMetadata

type InstallationMetadata struct {
	// TeamID is the Slack workspace identifier
	TeamID string `json:"teamId,omitempty" jsonschema:"title=Team ID"`
	// TeamName is the Slack workspace display name
	TeamName string `json:"teamName,omitempty" jsonschema:"title=Team Name"`
}

InstallationMetadata holds the stable Slack workspace identity for one installation

func (InstallationMetadata) InstallationIdentity

InstallationIdentity implements types.InstallationIdentifiable

type MessageDelivery

type MessageDelivery struct {
	// Channel is the channel the message was posted to
	Channel string `json:"channel"`
	// TS is the message timestamp
	TS string `json:"ts"`
}

MessageDelivery captures one Slack message delivery

type MessageSend

type MessageSend struct {
	// Channel is the first channel the message was posted to
	Channel string `json:"channel,omitempty"`
	// TS is the first message timestamp
	TS string `json:"ts,omitempty"`
	// Deliveries captures every channel delivery performed by the operation
	Deliveries []MessageDelivery `json:"deliveries,omitempty"`
}

MessageSend sends a Slack message via chat.postMessage

func (MessageSend) Handle

func (m MessageSend) Handle() types.OperationHandler

Handle adapts message send to the generic operation registration boundary

func (MessageSend) Run

Run sends a Slack message via chat.postMessage

type MessageSendOperation

type MessageSendOperation struct {
	// Channel is the Slack channel identifier to post to
	Channel string `json:"channel,omitempty" jsonschema:"title=Channel"`
	// Destinations are Slack channel identifiers to post the same message to
	Destinations []string `json:"destinations,omitempty" jsonschema:"title=Destinations"`
	// Text is the plain-text message content
	Text string `json:"text,omitempty" jsonschema:"title=Message Text"`
	// Blocks is a Block Kit payload for rich messages
	Blocks []json.RawMessage `json:"blocks,omitempty" jsonschema:"title=Block Kit Payload"`
	// ThreadTS is the thread timestamp for replies
	ThreadTS string `json:"thread_ts,omitempty" jsonschema:"title=Thread Timestamp"`
	// UnfurlLinks controls whether links are unfurled
	UnfurlLinks *bool `json:"unfurl_links,omitempty" jsonschema:"title=Unfurl Links"`
}

MessageSendOperation holds per-invocation parameters for the message.send operation

type UserInput

type UserInput struct {
	// DirectorySync includes the configuration for identity accounts from Slack members
	DirectorySync DirectorySync `json:"directorySync,omitempty" jsonschema:"title=Directory Account Sync"`
}

UserInput holds installation-specific configuration collected from the user

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL