-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevents.mdx.vel
More file actions
146 lines (119 loc) · 5.37 KB
/
Copy pathevents.mdx.vel
File metadata and controls
146 lines (119 loc) · 5.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
---
title: Webhook events
description: Headers and JSON fields delivered for inbound messaging events
---
Spectrum currently emits one webhook event type: `message.received`. It carries
the inbound provider request in a stable JSON envelope.
## Example delivery
```http
POST /spectrum-webhook HTTP/1.1
Content-Type: application/json
webhook-id: 0198f123-4567-7000-8000-123456789abc
webhook-timestamp: 1785788130
webhook-signature: v1,SGVsbG8...
{
"type": "message.received",
"timestamp": "2026-08-03T20:15:30.123Z",
"schemaVersion": 1,
"eventId": "0198f123-4567-7000-8000-123456789abc",
"projectId": "2c8f1234-5678-4000-8000-123456789abc",
"platform": "whatsapp",
"receivedAt": "2026-08-03T20:15:30.123Z",
"sourceId": "provider-request-123",
"prevSubjectSeq": 41,
"request": {
"method": "POST",
"path": "/events",
"headers": {
"content-type": "application/json",
"user-agent": "provider-webhook/1.0"
},
"bodyEncoding": "json",
"body": {
"message": "hello"
},
"rawBodyBase64": "eyJtZXNzYWdlIjoiaGVsbG8ifQ=="
}
}
```
Spectrum uses the Standard Webhooks convention that data fields may be
squashed into the top-level object. There is no additional `data` wrapper.
Selecting `schemaVersion: "raw-inbound.v1"` when you register an endpoint pins
this payload contract. The numeric `schemaVersion` inside the delivered JSON is
the revision of this raw inbound envelope.
## Standard Webhooks headers
| Header | Description |
| --- | --- |
| `Content-Type` | `application/json`. |
| `webhook-id` | Stable id for the logical event. It equals `eventId` in the body. |
| `webhook-timestamp` | UNIX epoch seconds at signing time. |
| `webhook-signature` | One or more space-delimited `v1,<base64>` signatures. |
The event id never contains a period, so the Standard Webhooks signed-content
serialization remains unambiguous. The same event keeps its id across retries
and multiple endpoints.
See [Verifying signatures](/webhooks/verifying-signatures) before processing a
delivery.
## Payload fields
| Field | Type | Description |
| --- | --- | --- |
| `type` | `"message.received"` | Subscription and routing discriminator. |
| `timestamp` | RFC 3339 string | When Spectrum received the source request. |
| `schemaVersion` | `1` | Version of this JSON envelope. |
| `eventId` | string | Stable logical event id; same value as `webhook-id`. |
| `projectId` | UUID | Spectrum project that owns the event. |
| `platform` | string | Source provider, such as `imessage` or `whatsapp`. Treat new values as forward-compatible. |
| `receivedAt` | RFC 3339 string | Source-ingress receipt time. Normally the same as `timestamp`. |
| `sourceId` | string, optional | Provider or ingress source identifier when available. |
| `prevSubjectSeq` | integer | Previous sequence observed for the source subject; `0` means none was recorded. |
| `request` | object | Normalized representation of the original inbound HTTP request. |
Consumers should ignore unknown fields so Spectrum can add optional metadata
without breaking existing handlers.
## Request fields
| Field | Type | Description |
| --- | --- | --- |
| `method` | string | Original HTTP method. |
| `path` | string | Original request target, including its query string when present. |
| `headers` | object | Original headers with lowercase names. Repeated values are comma-joined. |
| `bodyEncoding` | `json`, `form`, `text`, or `base64` | How `body` was decoded. |
| `body` | JSON, object, or string | Convenient decoded representation. |
| `rawBodyBase64` | string | Original request-body bytes encoded as Base64. |
`bodyEncoding` is selected as follows:
| Source body | `bodyEncoding` | `body` value |
| --- | --- | --- |
| Valid `application/json` or `*+json` UTF-8 | `json` | Parsed JSON value. |
| `application/x-www-form-urlencoded` UTF-8 | `form` | Object; repeated keys become arrays. |
| Other valid UTF-8, including malformed JSON | `text` | Original text. |
| Non-UTF-8 bytes | `base64` | Base64 string. |
`rawBodyBase64` is always present, including when `body` has already been
decoded. Use it when byte-for-byte source fidelity matters.
<Warning>
The request envelope can contain provider message content and original headers.
Treat webhook payloads as sensitive data: require HTTPS, verify signatures, and
avoid logging the complete body or header map.
</Warning>
## Compatibility headers
Fusor also sends additive transport metadata:
| Header | Purpose |
| --- | --- |
| `idempotency-key`, `x-fusor-event-id` | Same event id as `webhook-id`. |
| `x-fusor-project-id` | Project id. |
| `x-fusor-source` | Source platform. |
| `ce-*` | CloudEvents 1.0 binary-mode context for delivery observability. |
| `X-Spectrum-Event` | Legacy event label, currently `messages`. |
| `X-Spectrum-Webhook-Id` | Endpoint registration id. |
| `X-Spectrum-Timestamp` | Legacy signing timestamp. |
| `X-Spectrum-Signature` | Legacy `v0=<hex>` signature. |
The Standard and legacy signatures cover the same exact JSON body. New
integrations should route with `type`, deduplicate with `webhook-id`, and verify
`webhook-signature`.
## Event subscriptions
Set an endpoint's `eventTypes` to the events it should receive. The only
currently accepted value is:
```json
{
"eventTypes": ["message.received"]
}
```
Spectrum filters before publishing endpoint delivery work. Additional event
types can therefore be introduced without sending them to endpoints that did
not subscribe.