pinto-app-openclaw 1.3.17 → 1.3.19
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 +436 -31
- package/dist/channel.d.ts +1 -1
- package/dist/channel.d.ts.map +1 -1
- package/dist/channel.js +242 -54
- package/dist/channel.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/openclaw.plugin.json +84 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ flow การทำงาน:
|
|
|
29
29
|
- OpenClaw ที่รันได้แล้ว
|
|
30
30
|
- Node.js 20+ และ npm
|
|
31
31
|
- Pinto bot ที่สร้างไว้แล้ว
|
|
32
|
-
- Bot
|
|
32
|
+
- Bot ID จริงของ Pinto
|
|
33
33
|
- Pinto API base URL ที่ถูกต้อง เช่น `https://api.pinto-app.com`
|
|
34
34
|
- URL ที่ Pinto เข้าถึง OpenClaw ได้จริง เช่น domain, reverse proxy, Tailscale, tunnel
|
|
35
35
|
|
|
@@ -82,16 +82,21 @@ openclaw plugins install .
|
|
|
82
82
|
- ใส่ได้ทั้งแบบมี `/` ท้ายหรือไม่มี `/` ท้าย
|
|
83
83
|
- ตัวอย่าง `https://api.pinto-app.com`
|
|
84
84
|
- `Bot Id`
|
|
85
|
-
- ต้องเป็น Bot
|
|
86
|
-
-
|
|
85
|
+
- ต้องเป็น Bot ID จริงของ Pinto
|
|
86
|
+
- ต้องตรงกับค่า `bot_id` ที่ Pinto ส่งมา
|
|
87
87
|
- `Enabled`
|
|
88
88
|
- เปิดหรือปิด channel
|
|
89
89
|
- `Agent Id`
|
|
90
90
|
- optional
|
|
91
91
|
- ถ้าตั้งค่าไว้ bot นี้จะถูก route ไปยัง agent ที่ระบุโดยตรง
|
|
92
92
|
- ถ้าไม่ตั้งค่า OpenClaw จะใช้ routing/config ปกติของระบบ
|
|
93
|
+
- `Observer Agent Ids`
|
|
94
|
+
- optional
|
|
95
|
+
- เป็นรายชื่อ agent เสริมที่รับข้อความเดียวกัน
|
|
96
|
+
- observer จะไม่ตอบกลับ Pinto โดยตรง
|
|
93
97
|
- `Webhook Secret`
|
|
94
98
|
- secret ที่ใช้ร่วมกับ header `X-Pinto-Secret`
|
|
99
|
+
- ระบบไม่ generate ค่านี้ให้อัตโนมัติ
|
|
95
100
|
- ถ้าไม่ได้ตั้งค่าไว้ ระบบจะไม่บังคับตรวจ secret ขาเข้า
|
|
96
101
|
- `Webhook Path`
|
|
97
102
|
- path ของ webhook endpoint บน OpenClaw
|
|
@@ -104,9 +109,11 @@ openclaw plugins install .
|
|
|
104
109
|
- ระบบจะเติม `apiUrl` เป็น `https://api.pinto-app.com`
|
|
105
110
|
- ระบบจะเติม `botId` เป็นสตริงว่าง `""`
|
|
106
111
|
- ระบบจะเติม `agentId` เป็นสตริงว่าง `""`
|
|
107
|
-
-
|
|
112
|
+
- ระบบจะไม่เติม `observerAgentIds` ถ้ายังไม่ได้ใช้
|
|
113
|
+
- ระบบจะเติม `webhookSecret` เป็นสตริงว่าง `""`
|
|
108
114
|
- ระบบจะเติม `webhookPath` เป็น `/plugins/pinto/webhook`
|
|
109
115
|
- ผู้ใช้ยังต้องกรอก `botId` เองจาก Pinto bot จริง
|
|
116
|
+
- ถ้าต้องการตรวจ secret ผู้ใช้ต้องกรอก `webhookSecret` เอง และตั้งค่าเดียวกันใน Pinto
|
|
110
117
|
|
|
111
118
|
ตัวอย่าง config:
|
|
112
119
|
|
|
@@ -118,7 +125,7 @@ openclaw plugins install .
|
|
|
118
125
|
"apiUrl": "https://api.pinto-app.com",
|
|
119
126
|
"botId": "",
|
|
120
127
|
"agentId": "",
|
|
121
|
-
"webhookSecret": "
|
|
128
|
+
"webhookSecret": "",
|
|
122
129
|
"webhookPath": "/plugins/pinto/webhook"
|
|
123
130
|
}
|
|
124
131
|
}
|
|
@@ -140,15 +147,16 @@ openclaw plugins install .
|
|
|
140
147
|
"sales": {
|
|
141
148
|
"enabled": true,
|
|
142
149
|
"apiUrl": "https://api.pinto-app.com",
|
|
143
|
-
"botId": "
|
|
150
|
+
"botId": "bot-sales",
|
|
144
151
|
"agentId": "sales-agent",
|
|
152
|
+
"observerAgentIds": ["audit-agent", "memory-agent"],
|
|
145
153
|
"webhookSecret": "pinto-oc-sales-secret",
|
|
146
154
|
"webhookPath": "/plugins/pinto/sales"
|
|
147
155
|
},
|
|
148
156
|
"support": {
|
|
149
157
|
"enabled": true,
|
|
150
158
|
"apiUrl": "https://api.pinto-app.com",
|
|
151
|
-
"botId": "
|
|
159
|
+
"botId": "bot-support",
|
|
152
160
|
"agentId": "support-agent",
|
|
153
161
|
"webhookSecret": "pinto-oc-support-secret",
|
|
154
162
|
"webhookPath": "/plugins/pinto/support"
|
|
@@ -163,8 +171,10 @@ openclaw plugins install .
|
|
|
163
171
|
|
|
164
172
|
- Pinto bot แต่ละตัวควรมี `botId`, `webhookSecret`, และ `webhookPath` ของตัวเอง
|
|
165
173
|
- ถ้าต้องการแยก agent ต่อ bot ให้กำหนด `agentId` ของแต่ละ account
|
|
174
|
+
- ถ้าต้องการให้ agent เสริมช่วยวิเคราะห์หรือบันทึกข้อมูล ให้กำหนด `observerAgentIds`
|
|
166
175
|
- ให้ตั้ง `webhook_url` ของแต่ละ bot ไปยัง path ของตัวเอง
|
|
167
176
|
- ถ้ากำหนด `agentId` ไว้ ปลั๊กอินจะ route bot นั้นไป agent ที่ระบุทันที
|
|
177
|
+
- ถ้ากำหนด `observerAgentIds` ไว้ observer จะได้รับ inbound context เดียวกัน แต่จะไม่ตอบกลับ Pinto
|
|
168
178
|
- ถ้าไม่กำหนด `agentId` ปลั๊กอินจะ fallback ไปใช้ routing/config ปกติของ OpenClaw
|
|
169
179
|
- ห้ามใช้ `webhookPath` ซ้ำกันหลาย account เพราะ route จะชนกัน
|
|
170
180
|
- `botId` ต้องตรงกับค่าที่ Pinto ส่งมาใน `payload.bot_id` จริง ไม่ควรใช้ alias ที่ตั้งเอง
|
|
@@ -174,6 +184,201 @@ openclaw plugins install .
|
|
|
174
184
|
- channel id ของปลั๊กอินคือ `pinto`
|
|
175
185
|
- package name คือ `pinto-app-openclaw`
|
|
176
186
|
|
|
187
|
+
### วิธีสร้าง Agent และผูกกับ Pinto Bot
|
|
188
|
+
|
|
189
|
+
`agentId` เป็น id ของ agent ฝั่ง OpenClaw ไม่ได้มาจาก Pinto
|
|
190
|
+
|
|
191
|
+
แนวคิด:
|
|
192
|
+
|
|
193
|
+
- `botId` คือ id ของ bot ใน Pinto
|
|
194
|
+
- `agentId` คือ id ของ agent ใน OpenClaw
|
|
195
|
+
- Pinto bot แต่ละตัวสามารถชี้ไป agent คนละตัวได้
|
|
196
|
+
|
|
197
|
+
#### ขั้นตอนที่ 1: เพิ่ม agent ใน OpenClaw config
|
|
198
|
+
|
|
199
|
+
แก้ไฟล์ `openclaw.json`
|
|
200
|
+
|
|
201
|
+
ตำแหน่งไฟล์โดยทั่วไป:
|
|
202
|
+
|
|
203
|
+
- macOS: `~/.openclaw/openclaw.json`
|
|
204
|
+
- Windows: `%USERPROFILE%\.openclaw\openclaw.json`
|
|
205
|
+
|
|
206
|
+
ตัวอย่าง:
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"agents": {
|
|
211
|
+
"list": [
|
|
212
|
+
{
|
|
213
|
+
"id": "main",
|
|
214
|
+
"name": "Main Agent",
|
|
215
|
+
"workspace": "~/.openclaw/workspace-main"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"id": "sales-agent",
|
|
219
|
+
"name": "Sales Agent",
|
|
220
|
+
"workspace": "~/.openclaw/workspace-sales"
|
|
221
|
+
}
|
|
222
|
+
]
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
ความหมาย:
|
|
228
|
+
|
|
229
|
+
- `id` คือ `agentId` ที่จะเอาไปใส่ใน Pinto config
|
|
230
|
+
- `name` คือชื่อที่อ่านง่าย
|
|
231
|
+
- `workspace` คือโฟลเดอร์งานของ agent ตัวนั้น
|
|
232
|
+
|
|
233
|
+
บน Windows ใช้ path แบบนี้ได้เช่นกัน:
|
|
234
|
+
|
|
235
|
+
```json
|
|
236
|
+
{
|
|
237
|
+
"agents": {
|
|
238
|
+
"list": [
|
|
239
|
+
{
|
|
240
|
+
"id": "main",
|
|
241
|
+
"name": "Main Agent",
|
|
242
|
+
"workspace": "C:\\Users\\Administrator\\.openclaw\\workspace-main"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"id": "sales-agent",
|
|
246
|
+
"name": "Sales Agent",
|
|
247
|
+
"workspace": "C:\\Users\\Administrator\\.openclaw\\workspace-sales"
|
|
248
|
+
}
|
|
249
|
+
]
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
#### ขั้นตอนที่ 2: สร้าง workspace ของ agent
|
|
255
|
+
|
|
256
|
+
ตัวอย่าง path:
|
|
257
|
+
|
|
258
|
+
- macOS:
|
|
259
|
+
- `~/.openclaw/workspace-main`
|
|
260
|
+
- `~/.openclaw/workspace-sales`
|
|
261
|
+
- Windows:
|
|
262
|
+
- `C:\Users\Administrator\.openclaw\workspace-main`
|
|
263
|
+
- `C:\Users\Administrator\.openclaw\workspace-sales`
|
|
264
|
+
|
|
265
|
+
ถ้าต้องการให้ agent มีบุคลิกหรือหน้าที่เฉพาะ ให้เพิ่มไฟล์ `AGENTS.md` ใน workspace ของ agent นั้น
|
|
266
|
+
|
|
267
|
+
ตัวอย่าง `AGENTS.md`:
|
|
268
|
+
|
|
269
|
+
```md
|
|
270
|
+
You are the sales assistant for Pinto.
|
|
271
|
+
Focus on product guidance, pricing, promotions, and converting leads.
|
|
272
|
+
When a message comes from Pinto, answer with normal user-facing text.
|
|
273
|
+
Do not call the Pinto API or include bot_id/chat_id JSON in the reply.
|
|
274
|
+
Be concise and helpful.
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
#### ขั้นตอนที่ 3: restart หรือ reload OpenClaw
|
|
278
|
+
|
|
279
|
+
หลังแก้ `openclaw.json` ให้ restart OpenClaw หรือ reload plugins/config เพื่อให้ระบบรู้จัก agent ใหม่
|
|
280
|
+
|
|
281
|
+
#### ขั้นตอนที่ 4: ใส่ agentId ใน Pinto config
|
|
282
|
+
|
|
283
|
+
ตัวอย่าง single-account:
|
|
284
|
+
|
|
285
|
+
```json
|
|
286
|
+
{
|
|
287
|
+
"channels": {
|
|
288
|
+
"pinto": {
|
|
289
|
+
"enabled": true,
|
|
290
|
+
"apiUrl": "https://api.pinto-app.com",
|
|
291
|
+
"botId": "bot-sales",
|
|
292
|
+
"agentId": "sales-agent",
|
|
293
|
+
"webhookSecret": "pinto-oc-9f3a1b7c5d2e8k4m",
|
|
294
|
+
"webhookPath": "/plugins/pinto/webhook"
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
ตัวอย่าง multi-account:
|
|
301
|
+
|
|
302
|
+
```json
|
|
303
|
+
{
|
|
304
|
+
"channels": {
|
|
305
|
+
"pinto": {
|
|
306
|
+
"defaultAccount": "sales",
|
|
307
|
+
"accounts": {
|
|
308
|
+
"sales": {
|
|
309
|
+
"enabled": true,
|
|
310
|
+
"apiUrl": "https://api.pinto-app.com",
|
|
311
|
+
"botId": "bot-sales",
|
|
312
|
+
"agentId": "sales-agent",
|
|
313
|
+
"webhookSecret": "secret-sales",
|
|
314
|
+
"webhookPath": "/plugins/pinto/sales"
|
|
315
|
+
},
|
|
316
|
+
"support": {
|
|
317
|
+
"enabled": true,
|
|
318
|
+
"apiUrl": "https://api.pinto-app.com",
|
|
319
|
+
"botId": "bot-support",
|
|
320
|
+
"agentId": "main",
|
|
321
|
+
"webhookSecret": "secret-support",
|
|
322
|
+
"webhookPath": "/plugins/pinto/support"
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
#### ขั้นตอนที่ 5: ตั้งค่าฝั่ง Pinto
|
|
331
|
+
|
|
332
|
+
ใน Pinto bot ให้ตั้ง:
|
|
333
|
+
|
|
334
|
+
- `webhook_url = <public-openclaw-base-url> + <webhookPath>`
|
|
335
|
+
- `X-Pinto-Secret` ให้ตรงกับ `webhookSecret`
|
|
336
|
+
|
|
337
|
+
ตัวอย่าง:
|
|
338
|
+
|
|
339
|
+
- `sales-agent` ใช้ path `/plugins/pinto/sales`
|
|
340
|
+
- `webhook_url` เป็น `https://bot.example.com/plugins/pinto/sales`
|
|
341
|
+
|
|
342
|
+
#### ขั้นตอนที่ 6: ทดสอบ
|
|
343
|
+
|
|
344
|
+
ทดสอบ healthcheck:
|
|
345
|
+
|
|
346
|
+
```bash
|
|
347
|
+
curl -i https://bot.example.com/plugins/pinto/sales
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
ควรได้:
|
|
351
|
+
|
|
352
|
+
```json
|
|
353
|
+
{"ok":true,"channel":"pinto"}
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
ทดสอบ webhook:
|
|
357
|
+
|
|
358
|
+
```bash
|
|
359
|
+
curl -i -X POST https://bot.example.com/plugins/pinto/sales \
|
|
360
|
+
-H 'Content-Type: application/json' \
|
|
361
|
+
-H 'X-Pinto-Secret: secret-sales' \
|
|
362
|
+
-d '{
|
|
363
|
+
"bot_id":"bot-sales",
|
|
364
|
+
"chat_id":"chat-001",
|
|
365
|
+
"message":"โปรโมชั่นวันนี้มีอะไรบ้าง",
|
|
366
|
+
"user_id":"user-123"
|
|
367
|
+
}'
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
ผลที่ควรเกิด:
|
|
371
|
+
|
|
372
|
+
- Pinto ยิง webhook เข้ามา
|
|
373
|
+
- plugin ตรวจ `botId`, `webhookSecret`, และ `webhookPath`
|
|
374
|
+
- ถ้าตั้ง `agentId` ไว้ ระบบจะ route ไป agent ตัวนั้นทันที
|
|
375
|
+
- จากนั้นคำตอบของ agent จะถูกส่งกลับไป Pinto
|
|
376
|
+
|
|
377
|
+
หมายเหตุ:
|
|
378
|
+
|
|
379
|
+
- ถ้ายังไม่ได้แยก agent หลายตัว ให้ใช้ `agentId: "main"` ได้เลย
|
|
380
|
+
- ถ้าไม่ใส่ `agentId` ปลั๊กอินจะ fallback ไปใช้ routing ปกติของ OpenClaw
|
|
381
|
+
|
|
177
382
|
### การตั้งค่าฝั่ง Pinto
|
|
178
383
|
|
|
179
384
|
Pinto bot ต้องมีข้อมูลต่อไปนี้:
|
|
@@ -186,8 +391,8 @@ Pinto bot ต้องมีข้อมูลต่อไปนี้:
|
|
|
186
391
|
- `webhook_url = <public-openclaw-base-url> + <Webhook Path>`
|
|
187
392
|
- ตัวอย่างเช่น ถ้า OpenClaw เปิดผ่าน `https://bot.example.com` และ `Webhook Path` เป็น `/plugins/pinto/custom-webhook`
|
|
188
393
|
- ให้ใส่ `https://bot.example.com/plugins/pinto/custom-webhook`
|
|
189
|
-
- Bot
|
|
190
|
-
- ใช้ค่า `
|
|
394
|
+
- Bot ID
|
|
395
|
+
- ใช้ค่า `bot_id` ของ bot เป็นค่า `Bot Id` ใน OpenClaw
|
|
191
396
|
- ถ้ามีการเปิดใช้ secret
|
|
192
397
|
- Pinto ต้องส่ง header `X-Pinto-Secret` เข้ามา
|
|
193
398
|
- ค่า secret ต้องตรงกับ `Webhook Secret` ใน OpenClaw
|
|
@@ -240,7 +445,7 @@ POST /plugins/pinto/webhook
|
|
|
240
445
|
|
|
241
446
|
```json
|
|
242
447
|
{
|
|
243
|
-
"bot_id": "
|
|
448
|
+
"bot_id": "bot-sales",
|
|
244
449
|
"chat_id": "5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
245
450
|
"message": "hello",
|
|
246
451
|
"user_id": "a7c3fe36-cf41-42b5-a290-ca98e6129fac",
|
|
@@ -260,7 +465,7 @@ POST <apiUrl>/v1/bots/webhook/receive
|
|
|
260
465
|
|
|
261
466
|
```json
|
|
262
467
|
{
|
|
263
|
-
"bot_id": "
|
|
468
|
+
"bot_id": "bot-sales",
|
|
264
469
|
"chat_id": "5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
265
470
|
"reply_message": "สวัสดีจาก OpenClaw"
|
|
266
471
|
}
|
|
@@ -270,7 +475,7 @@ POST <apiUrl>/v1/bots/webhook/receive
|
|
|
270
475
|
|
|
271
476
|
```json
|
|
272
477
|
{
|
|
273
|
-
"bot_id": "
|
|
478
|
+
"bot_id": "bot-sales",
|
|
274
479
|
"chat_id": "5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
275
480
|
"reply_message": "ดูรูปนี้",
|
|
276
481
|
"media_url": "https://example.com/image.png"
|
|
@@ -303,7 +508,7 @@ curl -i -X POST http://127.0.0.1:18789/plugins/pinto/webhook \
|
|
|
303
508
|
-H 'Content-Type: application/json' \
|
|
304
509
|
-H 'X-Pinto-Secret: pinto-oc-9f3a1b7c5d2e8k4m' \
|
|
305
510
|
-d '{
|
|
306
|
-
"bot_id":"
|
|
511
|
+
"bot_id":"bot-sales",
|
|
307
512
|
"chat_id":"5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
308
513
|
"message":"hello",
|
|
309
514
|
"user_id":"a7c3fe36-cf41-42b5-a290-ca98e6129fac"
|
|
@@ -323,7 +528,7 @@ curl -i -X POST https://your-host.example.com/plugins/pinto/webhook \
|
|
|
323
528
|
-H 'Content-Type: application/json' \
|
|
324
529
|
-H 'X-Pinto-Secret: pinto-oc-9f3a1b7c5d2e8k4m' \
|
|
325
530
|
-d '{
|
|
326
|
-
"bot_id":"
|
|
531
|
+
"bot_id":"bot-sales",
|
|
327
532
|
"chat_id":"5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
328
533
|
"message":"hello",
|
|
329
534
|
"user_id":"a7c3fe36-cf41-42b5-a290-ca98e6129fac"
|
|
@@ -337,7 +542,7 @@ curl -i -X POST https://api.pinto-app.com/v1/bots/webhook/receive \
|
|
|
337
542
|
-H 'Content-Type: application/json' \
|
|
338
543
|
-H 'X-Pinto-Secret: pinto-oc-9f3a1b7c5d2e8k4m' \
|
|
339
544
|
-d '{
|
|
340
|
-
"bot_id":"
|
|
545
|
+
"bot_id":"bot-sales",
|
|
341
546
|
"chat_id":"5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
342
547
|
"reply_message":"OpenClaw outbound test"
|
|
343
548
|
}'
|
|
@@ -365,7 +570,7 @@ curl -i -X POST https://api.pinto-app.com/v1/bots/webhook/receive \
|
|
|
365
570
|
|
|
366
571
|
สาเหตุที่พบบ่อย:
|
|
367
572
|
|
|
368
|
-
- `Bot Id`
|
|
573
|
+
- `Bot Id` ไม่ตรงกับค่า `bot_id` จริงของ Pinto
|
|
369
574
|
- `chat_id` อยู่คนละ environment
|
|
370
575
|
- payload ที่ส่งไป `POST /v1/bots/webhook/receive` ไม่ตรงกับ backend Pinto
|
|
371
576
|
|
|
@@ -412,7 +617,7 @@ Main features:
|
|
|
412
617
|
- A working OpenClaw instance
|
|
413
618
|
- Node.js 20+ and npm
|
|
414
619
|
- An existing Pinto bot
|
|
415
|
-
- The real Pinto bot
|
|
620
|
+
- The real Pinto bot ID
|
|
416
621
|
- A valid Pinto API base URL such as `https://api.pinto-app.com`
|
|
417
622
|
- A public or reachable URL that Pinto can call
|
|
418
623
|
|
|
@@ -464,16 +669,21 @@ Fields:
|
|
|
464
669
|
- Pinto API base URL
|
|
465
670
|
- With or without a trailing slash is supported
|
|
466
671
|
- `Bot Id`
|
|
467
|
-
- Must be the real Pinto bot
|
|
468
|
-
-
|
|
672
|
+
- Must be the real Pinto bot ID
|
|
673
|
+
- Must match the `bot_id` value Pinto sends
|
|
469
674
|
- `Enabled`
|
|
470
675
|
- Enables or disables the channel
|
|
471
676
|
- `Agent Id`
|
|
472
677
|
- Optional
|
|
473
678
|
- If set, this bot will be routed directly to that OpenClaw agent
|
|
474
679
|
- If empty, the plugin falls back to normal OpenClaw routing
|
|
680
|
+
- `Observer Agent Ids`
|
|
681
|
+
- Optional
|
|
682
|
+
- Additional agents that receive the same inbound context
|
|
683
|
+
- Observer agents do not reply back to Pinto
|
|
475
684
|
- `Webhook Secret`
|
|
476
685
|
- Shared secret used with `X-Pinto-Secret`
|
|
686
|
+
- The plugin does not generate this value by default
|
|
477
687
|
- If empty, inbound secret validation is not enforced
|
|
478
688
|
|
|
479
689
|
Example config:
|
|
@@ -486,7 +696,7 @@ Example config:
|
|
|
486
696
|
"apiUrl": "https://api.pinto-app.com",
|
|
487
697
|
"botId": "",
|
|
488
698
|
"agentId": "",
|
|
489
|
-
"webhookSecret": "
|
|
699
|
+
"webhookSecret": "",
|
|
490
700
|
"webhookPath": "/plugins/pinto/webhook"
|
|
491
701
|
}
|
|
492
702
|
}
|
|
@@ -504,15 +714,16 @@ Multi-account example:
|
|
|
504
714
|
"sales": {
|
|
505
715
|
"enabled": true,
|
|
506
716
|
"apiUrl": "https://api.pinto-app.com",
|
|
507
|
-
"botId": "
|
|
717
|
+
"botId": "bot-sales",
|
|
508
718
|
"agentId": "sales-agent",
|
|
719
|
+
"observerAgentIds": ["audit-agent", "memory-agent"],
|
|
509
720
|
"webhookSecret": "pinto-oc-sales-secret",
|
|
510
721
|
"webhookPath": "/plugins/pinto/sales"
|
|
511
722
|
},
|
|
512
723
|
"support": {
|
|
513
724
|
"enabled": true,
|
|
514
725
|
"apiUrl": "https://api.pinto-app.com",
|
|
515
|
-
"botId": "
|
|
726
|
+
"botId": "bot-support",
|
|
516
727
|
"agentId": "support-agent",
|
|
517
728
|
"webhookSecret": "pinto-oc-support-secret",
|
|
518
729
|
"webhookPath": "/plugins/pinto/support"
|
|
@@ -527,8 +738,10 @@ Multi-account notes:
|
|
|
527
738
|
|
|
528
739
|
- Each Pinto bot should have its own `botId`, `webhookSecret`, and `webhookPath`
|
|
529
740
|
- If you want a specific bot to use a specific agent, set `agentId` on that account
|
|
741
|
+
- If you want helper agents to observe the same inbound message, set `observerAgentIds`
|
|
530
742
|
- Each bot's `webhook_url` should point to its own unique path
|
|
531
743
|
- When `agentId` is set, the plugin routes that bot directly to the named agent
|
|
744
|
+
- When `observerAgentIds` is set, those observer agents receive the same inbound context but do not reply to Pinto
|
|
532
745
|
- When `agentId` is empty, the plugin falls back to normal OpenClaw routing
|
|
533
746
|
- Do not reuse the same `webhookPath` across multiple accounts, or routes will collide
|
|
534
747
|
- `botId` must exactly match the value Pinto sends in `payload.bot_id`
|
|
@@ -538,6 +751,198 @@ Notes:
|
|
|
538
751
|
- The channel id is `pinto`
|
|
539
752
|
- The package name is `pinto-app-openclaw`
|
|
540
753
|
|
|
754
|
+
### How To Create An Agent And Connect It To A Pinto Bot
|
|
755
|
+
|
|
756
|
+
`agentId` comes from OpenClaw, not from Pinto.
|
|
757
|
+
|
|
758
|
+
Concept:
|
|
759
|
+
|
|
760
|
+
- `botId` is the Pinto bot id
|
|
761
|
+
- `agentId` is the OpenClaw agent id
|
|
762
|
+
- Each Pinto bot can use a different OpenClaw agent
|
|
763
|
+
|
|
764
|
+
#### Step 1: Add the agent to OpenClaw config
|
|
765
|
+
|
|
766
|
+
Edit `openclaw.json`
|
|
767
|
+
|
|
768
|
+
Common locations:
|
|
769
|
+
|
|
770
|
+
- macOS: `~/.openclaw/openclaw.json`
|
|
771
|
+
- Windows: `%USERPROFILE%\.openclaw\openclaw.json`
|
|
772
|
+
|
|
773
|
+
Example:
|
|
774
|
+
|
|
775
|
+
```json
|
|
776
|
+
{
|
|
777
|
+
"agents": {
|
|
778
|
+
"list": [
|
|
779
|
+
{
|
|
780
|
+
"id": "main",
|
|
781
|
+
"name": "Main Agent",
|
|
782
|
+
"workspace": "~/.openclaw/workspace-main"
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
"id": "sales-agent",
|
|
786
|
+
"name": "Sales Agent",
|
|
787
|
+
"workspace": "~/.openclaw/workspace-sales"
|
|
788
|
+
}
|
|
789
|
+
]
|
|
790
|
+
}
|
|
791
|
+
}
|
|
792
|
+
```
|
|
793
|
+
|
|
794
|
+
Windows path example:
|
|
795
|
+
|
|
796
|
+
```json
|
|
797
|
+
{
|
|
798
|
+
"agents": {
|
|
799
|
+
"list": [
|
|
800
|
+
{
|
|
801
|
+
"id": "main",
|
|
802
|
+
"name": "Main Agent",
|
|
803
|
+
"workspace": "C:\\Users\\Administrator\\.openclaw\\workspace-main"
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
"id": "sales-agent",
|
|
807
|
+
"name": "Sales Agent",
|
|
808
|
+
"workspace": "C:\\Users\\Administrator\\.openclaw\\workspace-sales"
|
|
809
|
+
}
|
|
810
|
+
]
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
#### Step 2: Create the agent workspace
|
|
816
|
+
|
|
817
|
+
Example paths:
|
|
818
|
+
|
|
819
|
+
- macOS:
|
|
820
|
+
- `~/.openclaw/workspace-main`
|
|
821
|
+
- `~/.openclaw/workspace-sales`
|
|
822
|
+
- Windows:
|
|
823
|
+
- `C:\Users\Administrator\.openclaw\workspace-main`
|
|
824
|
+
- `C:\Users\Administrator\.openclaw\workspace-sales`
|
|
825
|
+
|
|
826
|
+
If you want a dedicated persona or behavior for that agent, add `AGENTS.md` inside that workspace.
|
|
827
|
+
|
|
828
|
+
Example `AGENTS.md`:
|
|
829
|
+
|
|
830
|
+
```md
|
|
831
|
+
You are the sales assistant for Pinto.
|
|
832
|
+
Focus on product guidance, pricing, promotions, and converting leads.
|
|
833
|
+
When a message comes from Pinto, answer with normal user-facing text.
|
|
834
|
+
Do not call the Pinto API or include bot_id/chat_id JSON in the reply.
|
|
835
|
+
Be concise and helpful.
|
|
836
|
+
```
|
|
837
|
+
|
|
838
|
+
#### Step 3: Restart or reload OpenClaw
|
|
839
|
+
|
|
840
|
+
After editing `openclaw.json`, restart OpenClaw or reload config/plugins so the new agent becomes available.
|
|
841
|
+
|
|
842
|
+
#### Step 4: Set `agentId` in Pinto config
|
|
843
|
+
|
|
844
|
+
Single-account example:
|
|
845
|
+
|
|
846
|
+
```json
|
|
847
|
+
{
|
|
848
|
+
"channels": {
|
|
849
|
+
"pinto": {
|
|
850
|
+
"enabled": true,
|
|
851
|
+
"apiUrl": "https://api.pinto-app.com",
|
|
852
|
+
"botId": "bot-sales",
|
|
853
|
+
"agentId": "sales-agent",
|
|
854
|
+
"observerAgentIds": ["audit-agent", "memory-agent"],
|
|
855
|
+
"webhookSecret": "pinto-oc-9f3a1b7c5d2e8k4m",
|
|
856
|
+
"webhookPath": "/plugins/pinto/webhook"
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
```
|
|
861
|
+
|
|
862
|
+
Multi-account example:
|
|
863
|
+
|
|
864
|
+
```json
|
|
865
|
+
{
|
|
866
|
+
"channels": {
|
|
867
|
+
"pinto": {
|
|
868
|
+
"defaultAccount": "sales",
|
|
869
|
+
"accounts": {
|
|
870
|
+
"sales": {
|
|
871
|
+
"enabled": true,
|
|
872
|
+
"apiUrl": "https://api.pinto-app.com",
|
|
873
|
+
"botId": "bot-sales",
|
|
874
|
+
"agentId": "sales-agent",
|
|
875
|
+
"observerAgentIds": ["audit-agent", "memory-agent"],
|
|
876
|
+
"webhookSecret": "secret-sales",
|
|
877
|
+
"webhookPath": "/plugins/pinto/sales"
|
|
878
|
+
},
|
|
879
|
+
"support": {
|
|
880
|
+
"enabled": true,
|
|
881
|
+
"apiUrl": "https://api.pinto-app.com",
|
|
882
|
+
"botId": "bot-support",
|
|
883
|
+
"agentId": "main",
|
|
884
|
+
"webhookSecret": "secret-support",
|
|
885
|
+
"webhookPath": "/plugins/pinto/support"
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
```
|
|
892
|
+
|
|
893
|
+
#### Step 5: Configure Pinto
|
|
894
|
+
|
|
895
|
+
In your Pinto bot settings:
|
|
896
|
+
|
|
897
|
+
- set `webhook_url = <public-openclaw-base-url> + <webhookPath>`
|
|
898
|
+
- set `X-Pinto-Secret` to match `webhookSecret`
|
|
899
|
+
|
|
900
|
+
Example:
|
|
901
|
+
|
|
902
|
+
- `sales-agent` uses `/plugins/pinto/sales`
|
|
903
|
+
- `webhook_url` becomes `https://bot.example.com/plugins/pinto/sales`
|
|
904
|
+
|
|
905
|
+
#### Step 6: Test it
|
|
906
|
+
|
|
907
|
+
Healthcheck:
|
|
908
|
+
|
|
909
|
+
```bash
|
|
910
|
+
curl -i https://bot.example.com/plugins/pinto/sales
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
Expected:
|
|
914
|
+
|
|
915
|
+
```json
|
|
916
|
+
{"ok":true,"channel":"pinto"}
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
Webhook test:
|
|
920
|
+
|
|
921
|
+
```bash
|
|
922
|
+
curl -i -X POST https://bot.example.com/plugins/pinto/sales \
|
|
923
|
+
-H 'Content-Type: application/json' \
|
|
924
|
+
-H 'X-Pinto-Secret: secret-sales' \
|
|
925
|
+
-d '{
|
|
926
|
+
"bot_id":"bot-sales",
|
|
927
|
+
"chat_id":"chat-001",
|
|
928
|
+
"message":"What promotions are available today?",
|
|
929
|
+
"user_id":"user-123"
|
|
930
|
+
}'
|
|
931
|
+
```
|
|
932
|
+
|
|
933
|
+
Expected behavior:
|
|
934
|
+
|
|
935
|
+
- Pinto sends the webhook
|
|
936
|
+
- the plugin validates `botId`, `webhookSecret`, and `webhookPath`
|
|
937
|
+
- if `agentId` is set, the message is routed directly to that agent
|
|
938
|
+
- the reply is sent back to Pinto
|
|
939
|
+
|
|
940
|
+
Notes:
|
|
941
|
+
|
|
942
|
+
- If you do not need multiple agents yet, start with `agentId: "main"`
|
|
943
|
+
- If `agentId` is omitted, the plugin falls back to normal OpenClaw routing
|
|
944
|
+
- If you use `observerAgentIds`, they observe the same inbound message but do not send replies to Pinto
|
|
945
|
+
|
|
541
946
|
### Pinto Configuration
|
|
542
947
|
|
|
543
948
|
Your Pinto bot must have:
|
|
@@ -546,8 +951,8 @@ Your Pinto bot must have:
|
|
|
546
951
|
- The URL Pinto calls
|
|
547
952
|
- Example:
|
|
548
953
|
- `https://your-host.example.com/plugins/pinto/webhook`
|
|
549
|
-
- Bot
|
|
550
|
-
- Use the bot `
|
|
954
|
+
- Bot ID
|
|
955
|
+
- Use the bot `bot_id` as `Bot Id` in OpenClaw
|
|
551
956
|
- If webhook security is enabled
|
|
552
957
|
- Pinto must send `X-Pinto-Secret`
|
|
553
958
|
- The value must match the OpenClaw `Webhook Secret`
|
|
@@ -602,7 +1007,7 @@ Example request body:
|
|
|
602
1007
|
|
|
603
1008
|
```json
|
|
604
1009
|
{
|
|
605
|
-
"bot_id": "
|
|
1010
|
+
"bot_id": "bot-sales",
|
|
606
1011
|
"chat_id": "5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
607
1012
|
"message": "hello",
|
|
608
1013
|
"user_id": "a7c3fe36-cf41-42b5-a290-ca98e6129fac",
|
|
@@ -622,7 +1027,7 @@ Example body:
|
|
|
622
1027
|
|
|
623
1028
|
```json
|
|
624
1029
|
{
|
|
625
|
-
"bot_id": "
|
|
1030
|
+
"bot_id": "bot-sales",
|
|
626
1031
|
"chat_id": "5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
627
1032
|
"reply_message": "Hello from OpenClaw"
|
|
628
1033
|
}
|
|
@@ -632,7 +1037,7 @@ Media example:
|
|
|
632
1037
|
|
|
633
1038
|
```json
|
|
634
1039
|
{
|
|
635
|
-
"bot_id": "
|
|
1040
|
+
"bot_id": "bot-sales",
|
|
636
1041
|
"chat_id": "5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
637
1042
|
"reply_message": "See this image",
|
|
638
1043
|
"media_url": "https://example.com/image.png"
|
|
@@ -665,7 +1070,7 @@ curl -i -X POST http://127.0.0.1:18789/plugins/pinto/webhook \
|
|
|
665
1070
|
-H 'Content-Type: application/json' \
|
|
666
1071
|
-H 'X-Pinto-Secret: pinto-oc-9f3a1b7c5d2e8k4m' \
|
|
667
1072
|
-d '{
|
|
668
|
-
"bot_id":"
|
|
1073
|
+
"bot_id":"bot-sales",
|
|
669
1074
|
"chat_id":"5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
670
1075
|
"message":"hello",
|
|
671
1076
|
"user_id":"a7c3fe36-cf41-42b5-a290-ca98e6129fac"
|
|
@@ -685,7 +1090,7 @@ curl -i -X POST https://your-host.example.com/plugins/pinto/webhook \
|
|
|
685
1090
|
-H 'Content-Type: application/json' \
|
|
686
1091
|
-H 'X-Pinto-Secret: pinto-oc-9f3a1b7c5d2e8k4m' \
|
|
687
1092
|
-d '{
|
|
688
|
-
"bot_id":"
|
|
1093
|
+
"bot_id":"bot-sales",
|
|
689
1094
|
"chat_id":"5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
690
1095
|
"message":"hello",
|
|
691
1096
|
"user_id":"a7c3fe36-cf41-42b5-a290-ca98e6129fac"
|
|
@@ -699,7 +1104,7 @@ curl -i -X POST https://api.pinto-app.com/v1/bots/webhook/receive \
|
|
|
699
1104
|
-H 'Content-Type: application/json' \
|
|
700
1105
|
-H 'X-Pinto-Secret: pinto-oc-9f3a1b7c5d2e8k4m' \
|
|
701
1106
|
-d '{
|
|
702
|
-
"bot_id":"
|
|
1107
|
+
"bot_id":"bot-sales",
|
|
703
1108
|
"chat_id":"5f315d4e-cf22-4054-bbb0-2fe074bd3892",
|
|
704
1109
|
"reply_message":"OpenClaw outbound test"
|
|
705
1110
|
}'
|
|
@@ -727,7 +1132,7 @@ Common causes:
|
|
|
727
1132
|
|
|
728
1133
|
Common causes:
|
|
729
1134
|
|
|
730
|
-
- `Bot Id`
|
|
1135
|
+
- `Bot Id` does not match the real Pinto `bot_id`
|
|
731
1136
|
- `chat_id` belongs to a different environment
|
|
732
1137
|
- The payload sent to `POST /v1/bots/webhook/receive` does not match Pinto backend expectations
|
|
733
1138
|
|