@orgloop/connector-webhook 0.1.0 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +22 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -19,6 +19,7 @@ sources:
|
|
|
19
19
|
config:
|
|
20
20
|
secret: "${WEBHOOK_SECRET}" # optional — HMAC-SHA256 secret for signature validation
|
|
21
21
|
event_type_field: "type" # optional — dot-path to extract event type from payload (default: "type")
|
|
22
|
+
buffer_dir: "/tmp/orgloop-webhooks" # optional — persist events to disk
|
|
22
23
|
poll:
|
|
23
24
|
interval: "30s" # how often to drain received webhook events
|
|
24
25
|
```
|
|
@@ -27,8 +28,10 @@ sources:
|
|
|
27
28
|
|
|
28
29
|
| Field | Type | Required | Default | Description |
|
|
29
30
|
|-------|------|----------|---------|-------------|
|
|
31
|
+
| `path` | `string` | no | — | URL path for this webhook endpoint |
|
|
30
32
|
| `secret` | `string` | no | — | HMAC-SHA256 secret for validating signatures. Supports `${ENV_VAR}` syntax |
|
|
31
33
|
| `event_type_field` | `string` | no | `"type"` | Dot-notation path to extract a platform event type from the incoming JSON payload |
|
|
34
|
+
| `buffer_dir` | `string` | no | — | Directory for buffering received events to disk (JSONL). If set, events survive engine restarts |
|
|
32
35
|
|
|
33
36
|
### Events emitted
|
|
34
37
|
|
|
@@ -87,6 +90,9 @@ actors:
|
|
|
87
90
|
auth: # optional — authentication
|
|
88
91
|
type: "bearer" # "bearer" or "basic"
|
|
89
92
|
token: "${WEBHOOK_AUTH_TOKEN}" # for bearer auth (env var ref)
|
|
93
|
+
body_template: # optional — custom payload shape
|
|
94
|
+
text: "Event {{ event.type }} from {{ event.source }}"
|
|
95
|
+
data: "{{ event.payload }}"
|
|
90
96
|
```
|
|
91
97
|
|
|
92
98
|
#### Target config options
|
|
@@ -100,10 +106,11 @@ actors:
|
|
|
100
106
|
| `auth.token` | `string` | no | — | Bearer token (for `type: "bearer"`). Supports `${ENV_VAR}` |
|
|
101
107
|
| `auth.username` | `string` | no | — | Username (for `type: "basic"`). Supports `${ENV_VAR}` |
|
|
102
108
|
| `auth.password` | `string` | no | — | Password (for `type: "basic"`). Supports `${ENV_VAR}` |
|
|
109
|
+
| `body_template` | `object` | no | — | Template object with `{{ path }}` placeholders (see below) |
|
|
103
110
|
|
|
104
111
|
### Delivery payload
|
|
105
112
|
|
|
106
|
-
|
|
113
|
+
By default, the target sends a JSON body containing the full event and the resolved launch prompt:
|
|
107
114
|
|
|
108
115
|
```json
|
|
109
116
|
{
|
|
@@ -112,6 +119,19 @@ The target sends a JSON body containing the full event and the resolved launch p
|
|
|
112
119
|
}
|
|
113
120
|
```
|
|
114
121
|
|
|
122
|
+
### Body templates
|
|
123
|
+
|
|
124
|
+
Use `body_template` to customize the outbound payload shape. Template strings support `{{ path }}` placeholders resolved against the event context:
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
body_template:
|
|
128
|
+
text: "New event from {{ event.source }}: {{ event.type }}"
|
|
129
|
+
channel: "#alerts"
|
|
130
|
+
payload: "{{ event.payload }}"
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Available template variables: `event` (the full event object), `launch_prompt` (the route's resolved prompt).
|
|
134
|
+
|
|
115
135
|
### Delivery results
|
|
116
136
|
|
|
117
137
|
| HTTP Status | Result |
|
|
@@ -144,7 +164,6 @@ routes:
|
|
|
144
164
|
|
|
145
165
|
## Limitations / known issues
|
|
146
166
|
|
|
147
|
-
- **Source is push-based** --
|
|
167
|
+
- **Source is push-based** -- By default, events are buffered in memory until the next `poll()` call drains them. Configure `buffer_dir` to persist events to disk and survive restarts.
|
|
148
168
|
- **No batching** -- The target sends one HTTP request per event.
|
|
149
|
-
- **No custom body templates** -- The target always sends `{ event, launch_prompt }`. For custom payload shapes, use a transform before delivery.
|
|
150
169
|
- **Nested event type extraction** -- The `event_type_field` supports dot-notation (e.g., `"data.event_type"`) for extracting the platform event type from deeply nested payloads.
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orgloop/connector-webhook",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "OrgLoop generic webhook connector — inbound and outbound",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@orgloop/sdk": "0.1.
|
|
9
|
+
"@orgloop/sdk": "0.1.3"
|
|
10
10
|
},
|
|
11
11
|
"orgloop": {
|
|
12
12
|
"type": "connector",
|