# Webhooks & events

Connectors are not only called outward — many receive **inbound events** (a new CRM deal, an incoming message, an order status change). Those events land in a local journal and can trigger automated tasks.

## Webhook URLs

Connectors that support inbound events expose a per-service webhook URL you register with the provider. Fetch it programmatically:

```bash
curl "$BASE/connectors/$SERVICE/webhook-url" \
  -H "Authorization: Bearer $SAMRESHUUU_API_KEY"
```

The provider then POSTs events to that URL; the platform validates and records them.

## The event journal

`query_events` is a read-only tool over the **local journal** of inbound webhook events already saved by the platform — not a live call to the external service. Use it to inspect what has arrived (for example, the most recent messages or deal updates) without re-fetching from the source.

## Triggering tasks on events

A saved [task](/docs/agents) can run automatically when a matching event arrives. Set `trigger_type: "webhook"` and describe which events to react to:

<ParamTable rows={[
  { name: "trigger_type", type: "string", required: true, description: "Set to webhook for event-driven tasks (the alternative is schedule for cron-driven tasks)." },
  { name: "trigger_config.service", type: "string", required: true, description: "The connector whose events trigger the task." },
  { name: "trigger_config.event_types", type: "string[]", description: "Which event types to react to (for example new message, deal updated)." },
  { name: "filter_conditions", type: "object[]", description: "Extra conditions on the event payload before the task runs." },
]} />

When an inbound event matches, the task executes with the event as its input — turning any connector webhook into an automation. See the Tasks API in the [interactive explorer](/docs/api-explorer).
