webhookagent 1.3.2 → 1.4.0
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 +15 -0
- package/lib/heartbeat.js +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,6 +37,21 @@ webhookagent --auto-restart --fetch --ack
|
|
|
37
37
|
|
|
38
38
|
No open ports needed. Works behind any firewall. Events are queued so nothing is lost.
|
|
39
39
|
|
|
40
|
+
## Chat Messages
|
|
41
|
+
|
|
42
|
+
Chat endpoints let people message your agent through a shareable link (`webhookagent.com/agentchat/{name}?t={token}`). Chat messages arrive as `ACTION:` lines with `type: "chat_message"`:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
ACTION:{"type":"chat_message","webhook_name":"support","sender_name":"Alex","message":"hey, is my order ready?","chat_reply_command":"curl -s -X POST ..."}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Key fields:
|
|
49
|
+
- `sender_name` — who sent the message
|
|
50
|
+
- `message` — what they said
|
|
51
|
+
- `chat_reply_command` — run this with your reply text replacing `YOUR_REPLY`
|
|
52
|
+
|
|
53
|
+
After replying, **RESTART the heartbeat immediately** (same as always). Create a chat endpoint by passing `"endpoint_type":"chat"` when creating a webhook.
|
|
54
|
+
|
|
40
55
|
## Options
|
|
41
56
|
|
|
42
57
|
| Flag | Default | Description |
|
package/lib/heartbeat.js
CHANGED
|
@@ -238,7 +238,7 @@ async function api(path, method = 'GET', body = null) {
|
|
|
238
238
|
const headers = {
|
|
239
239
|
'Authorization': `Bearer ${API_KEY}`,
|
|
240
240
|
'Content-Type': 'application/json',
|
|
241
|
-
'User-Agent': 'WebhookAgent-Heartbeat/1.
|
|
241
|
+
'User-Agent': 'WebhookAgent-Heartbeat/1.4 (Node.js)',
|
|
242
242
|
};
|
|
243
243
|
const opts = { method, headers };
|
|
244
244
|
if (body) opts.body = JSON.stringify(body);
|
|
@@ -360,7 +360,7 @@ async function processActions(actions, heartbeatData) {
|
|
|
360
360
|
// ============================================================
|
|
361
361
|
|
|
362
362
|
async function main() {
|
|
363
|
-
log('WebhookAgent Heartbeat Runtime v1.
|
|
363
|
+
log('WebhookAgent Heartbeat Runtime v1.4');
|
|
364
364
|
log(`Polling ${BASE_URL} every ${INTERVAL / 1000}s${MAX_CYCLES === Infinity ? '' : `, max ${MAX_CYCLES} cycles`}${AUTO_RESTART ? ' (continuous)' : ''}${SHOW_MODE ? ' (show mode — no break)' : ''}`);
|
|
365
365
|
|
|
366
366
|
// Resolve webhook names to IDs if needed
|