openclawnotify

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: May 9, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HookTokenEnv   = "OPENCLAW_HOOK_TOKEN"
	GatewayPortEnv = "OPENCLAW_GATEWAY_PORT"
	ConfigPathEnv  = "OPENCLAW_CONFIG_PATH"

	DefaultGatewayPort = 18789
	DefaultHooksPath   = "/hooks"
	FixedHookName      = "AWiki"
)

Variables

This section is empty.

Functions

func AddRoute

func AddRoute(paths appconfig.Paths, route Route) (Route, bool, []Route, error)

func OpenClawConfigPath

func OpenClawConfigPath() string

func RemoveRoute

func RemoveRoute(paths appconfig.Paths, route Route) (Route, bool, []Route, error)

func ResolveHookToken

func ResolveHookToken(paths appconfig.Paths, probe OpenClawConfigProbe) (string, string)

func RoutesPath

func RoutesPath(paths appconfig.Paths) string

func ValidateHookURL

func ValidateHookURL(rawURL string) error

func WriteRoutes

func WriteRoutes(paths appconfig.Paths, routes []Route) error

Types

type EffectiveSettings

type EffectiveSettings struct {
	HookURL                 string        `json:"hook_url"`
	HookURLSource           string        `json:"hook_url_source"`
	DetectedWebhookPort     int           `json:"detected_webhook_port"`
	DetectedWebhookPortInfo GatewayProbe  `json:"-"`
	DetectedWebhookPath     string        `json:"detected_webhook_path"`
	DetectedWebhookPathInfo HookPathProbe `json:"-"`
	Token                   string        `json:"-"`
	TokenConfigured         bool          `json:"token_configured"`
	TokenSource             string        `json:"token_source"`
}

func ResolveSettings

func ResolveSettings(resolved *appconfig.Resolved) (EffectiveSettings, error)

type GatewayProbe

type GatewayProbe struct {
	Port       int    `json:"port"`
	Source     string `json:"source"`
	ConfigPath string `json:"config_path,omitempty"`
}

func ProbeGatewayPort

func ProbeGatewayPort(defaultPort int) GatewayProbe

type HookPathProbe

type HookPathProbe struct {
	Path       string `json:"path"`
	Source     string `json:"source"`
	ConfigPath string `json:"config_path,omitempty"`
}

type HookRequest

type HookRequest struct {
	Message  string `json:"message"`
	Name     string `json:"name,omitempty"`
	WakeMode string `json:"wakeMode,omitempty"`
	Deliver  bool   `json:"deliver"`
	Channel  string `json:"channel,omitempty"`
	To       string `json:"to,omitempty"`
}

type HookResponse

type HookResponse struct {
	RunID string `json:"run_id"`
}

type OpenClawConfigProbe

type OpenClawConfigProbe struct {
	ConfigPath string
	Gateway    GatewayProbe
	HooksPath  HookPathProbe
	HookToken  string
}

func ProbeOpenClawConfig

func ProbeOpenClawConfig(defaultPort int, defaultHooksPath string) OpenClawConfigProbe

type Registry

type Registry struct {
	Routes []Route `json:"routes"`
}

type Route

type Route struct {
	Channel string `json:"channel"`
	To      string `json:"to"`
}

func LoadRoutes

func LoadRoutes(paths appconfig.Paths) ([]Route, error)

func NormalizeRoute

func NormalizeRoute(route Route) (Route, error)

func ParseSessionKey

func ParseSessionKey(sessionKey string) (Route, error)

func ResolveRouteInput

func ResolveRouteInput(channel string, to string, sessionKey string) (Route, error)

type WebhookClient

type WebhookClient struct {
	// contains filtered or unexported fields
}

func NewWebhookClient

func NewWebhookClient(hookURL string, token string) (*WebhookClient, error)

func (*WebhookClient) Send

Jump to

Keyboard shortcuts

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