neuron-mcp-server 1.0.0 → 1.1.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.
Files changed (150) hide show
  1. package/.env +13 -0
  2. package/AI_PERSONALITY_DESIGN_RESEARCH.md +1020 -0
  3. package/Dockerfile +18 -0
  4. package/README.md +146 -131
  5. package/dist/client.d.ts +6 -0
  6. package/dist/client.js +50 -12
  7. package/dist/client.js.map +1 -1
  8. package/dist/index.js +51 -7
  9. package/dist/index.js.map +1 -1
  10. package/dist/tools/ai.js +9 -3
  11. package/dist/tools/ai.js.map +1 -1
  12. package/dist/tools/approvals.d.ts +2 -0
  13. package/dist/tools/approvals.js +181 -0
  14. package/dist/tools/approvals.js.map +1 -0
  15. package/dist/tools/audit.js +7 -4
  16. package/dist/tools/audit.js.map +1 -1
  17. package/dist/tools/auth.js +119 -19
  18. package/dist/tools/auth.js.map +1 -1
  19. package/dist/tools/billing.js +22 -6
  20. package/dist/tools/billing.js.map +1 -1
  21. package/dist/tools/blog.js +98 -34
  22. package/dist/tools/blog.js.map +1 -1
  23. package/dist/tools/bot-api-keys.js +27 -12
  24. package/dist/tools/bot-api-keys.js.map +1 -1
  25. package/dist/tools/bot-api.js +53 -27
  26. package/dist/tools/bot-api.js.map +1 -1
  27. package/dist/tools/bots.js +116 -68
  28. package/dist/tools/bots.js.map +1 -1
  29. package/dist/tools/broadcasts.js +78 -38
  30. package/dist/tools/broadcasts.js.map +1 -1
  31. package/dist/tools/builtin-tools.js +19 -12
  32. package/dist/tools/builtin-tools.js.map +1 -1
  33. package/dist/tools/campaigns.js +149 -61
  34. package/dist/tools/campaigns.js.map +1 -1
  35. package/dist/tools/channels.js +163 -53
  36. package/dist/tools/channels.js.map +1 -1
  37. package/dist/tools/contact-lists.js +111 -51
  38. package/dist/tools/contact-lists.js.map +1 -1
  39. package/dist/tools/contacts.js +117 -44
  40. package/dist/tools/contacts.js.map +1 -1
  41. package/dist/tools/conversations.js +95 -50
  42. package/dist/tools/conversations.js.map +1 -1
  43. package/dist/tools/flows.d.ts +2 -0
  44. package/dist/tools/flows.js +242 -0
  45. package/dist/tools/flows.js.map +1 -0
  46. package/dist/tools/group-management.d.ts +2 -0
  47. package/dist/tools/group-management.js +239 -0
  48. package/dist/tools/group-management.js.map +1 -0
  49. package/dist/tools/leads.d.ts +2 -0
  50. package/dist/tools/leads.js +100 -0
  51. package/dist/tools/leads.js.map +1 -0
  52. package/dist/tools/list-campaigns.d.ts +2 -0
  53. package/dist/tools/list-campaigns.js +152 -0
  54. package/dist/tools/list-campaigns.js.map +1 -0
  55. package/dist/tools/list-pool.js +250 -33
  56. package/dist/tools/list-pool.js.map +1 -1
  57. package/dist/tools/media.js +12 -7
  58. package/dist/tools/media.js.map +1 -1
  59. package/dist/tools/newsletters.js +106 -26
  60. package/dist/tools/newsletters.js.map +1 -1
  61. package/dist/tools/organizations.js +76 -35
  62. package/dist/tools/organizations.js.map +1 -1
  63. package/dist/tools/outbound-webhooks.js +32 -20
  64. package/dist/tools/outbound-webhooks.js.map +1 -1
  65. package/dist/tools/payouts.js +44 -17
  66. package/dist/tools/payouts.js.map +1 -1
  67. package/dist/tools/personas.d.ts +2 -0
  68. package/dist/tools/personas.js +141 -0
  69. package/dist/tools/personas.js.map +1 -0
  70. package/dist/tools/polls.d.ts +2 -0
  71. package/dist/tools/polls.js +30 -0
  72. package/dist/tools/polls.js.map +1 -0
  73. package/dist/tools/pool.js +101 -43
  74. package/dist/tools/pool.js.map +1 -1
  75. package/dist/tools/products.d.ts +2 -0
  76. package/dist/tools/products.js +277 -0
  77. package/dist/tools/products.js.map +1 -0
  78. package/dist/tools/profile-privacy.d.ts +2 -0
  79. package/dist/tools/profile-privacy.js +195 -0
  80. package/dist/tools/profile-privacy.js.map +1 -0
  81. package/dist/tools/reflections.js +25 -13
  82. package/dist/tools/reflections.js.map +1 -1
  83. package/dist/tools/scheduled-messages.d.ts +2 -0
  84. package/dist/tools/scheduled-messages.js +124 -0
  85. package/dist/tools/scheduled-messages.js.map +1 -0
  86. package/dist/tools/social-channels.d.ts +2 -0
  87. package/dist/tools/social-channels.js +318 -0
  88. package/dist/tools/social-channels.js.map +1 -0
  89. package/dist/tools/tasks.d.ts +2 -0
  90. package/dist/tools/tasks.js +155 -0
  91. package/dist/tools/tasks.js.map +1 -0
  92. package/dist/tools/tools.js +86 -40
  93. package/dist/tools/tools.js.map +1 -1
  94. package/dist/tools/wallets.js +34 -12
  95. package/dist/tools/wallets.js.map +1 -1
  96. package/dist/tools/webhooks.js +35 -20
  97. package/dist/tools/webhooks.js.map +1 -1
  98. package/dist/tools/whatsapp-actions.d.ts +2 -0
  99. package/dist/tools/whatsapp-actions.js +186 -0
  100. package/dist/tools/whatsapp-actions.js.map +1 -0
  101. package/package.json +4 -31
  102. package/scripts/setup-delivahere-bot.ts +804 -0
  103. package/scripts/test-delivahere-bot.ts +128 -0
  104. package/scripts/update-letschop-prompt.ts +194 -0
  105. package/server.json +26 -0
  106. package/smithery.yaml +19 -0
  107. package/src/client.ts +169 -0
  108. package/src/index.ts +256 -0
  109. package/src/tools/ai.ts +35 -0
  110. package/src/tools/approvals.ts +231 -0
  111. package/src/tools/audit.ts +49 -0
  112. package/src/tools/auth.ts +536 -0
  113. package/src/tools/billing.ts +79 -0
  114. package/src/tools/blog.ts +264 -0
  115. package/src/tools/bot-api-keys.ts +87 -0
  116. package/src/tools/bot-api.ts +193 -0
  117. package/src/tools/bots.ts +320 -0
  118. package/src/tools/broadcasts.ts +224 -0
  119. package/src/tools/builtin-tools.ts +108 -0
  120. package/src/tools/campaigns.ts +429 -0
  121. package/src/tools/channels.ts +520 -0
  122. package/src/tools/contact-lists.ts +320 -0
  123. package/src/tools/contacts.ts +395 -0
  124. package/src/tools/conversations.ts +349 -0
  125. package/src/tools/flows.ts +298 -0
  126. package/src/tools/group-management.ts +265 -0
  127. package/src/tools/knowledge-bases.ts +451 -0
  128. package/src/tools/leads.ts +104 -0
  129. package/src/tools/list-campaigns.ts +190 -0
  130. package/src/tools/list-pool.ts +389 -0
  131. package/src/tools/media.ts +50 -0
  132. package/src/tools/newsletters.ts +271 -0
  133. package/src/tools/organizations.ts +287 -0
  134. package/src/tools/outbound-webhooks.ts +181 -0
  135. package/src/tools/payouts.ts +133 -0
  136. package/src/tools/personas.ts +145 -0
  137. package/src/tools/polls.ts +32 -0
  138. package/src/tools/pool.ts +293 -0
  139. package/src/tools/products.ts +280 -0
  140. package/src/tools/profile-privacy.ts +215 -0
  141. package/src/tools/reflections.ts +124 -0
  142. package/src/tools/scheduled-messages.ts +144 -0
  143. package/src/tools/social-channels.ts +396 -0
  144. package/src/tools/tasks.ts +198 -0
  145. package/src/tools/tools.ts +255 -0
  146. package/src/tools/wallets.ts +107 -0
  147. package/src/tools/webhooks.ts +166 -0
  148. package/src/tools/whatsapp-actions.ts +203 -0
  149. package/tsconfig.json +20 -0
  150. package/LICENSE +0 -21
@@ -0,0 +1,804 @@
1
+ #!/usr/bin/env tsx
2
+ /**
3
+ * Demo script: Sets up a complete DelivaHere delivery bot using the Neuron API.
4
+ *
5
+ * This script demonstrates how the MCP server's tools would be used to:
6
+ * 1. Login to the Neuron platform
7
+ * 2. Create a delivery-focused bot
8
+ * 3. Create a knowledge base with comprehensive delivery platform docs
9
+ * 4. Attach the knowledge base to the bot
10
+ * 5. Create an HTTP tool for the DelivaHere application server
11
+ * 6. Generate an API key for programmatic access
12
+ *
13
+ * Usage:
14
+ * NEURON_EMAIL=admin@example.com NEURON_PASSWORD=secret tsx scripts/setup-delivahere-bot.ts
15
+ */
16
+
17
+ import axios from "axios";
18
+
19
+ const API = process.env.NEURON_API_URL || "http://localhost:4000/api/v1";
20
+ const EMAIL = process.env.NEURON_EMAIL || "a.rasheedalabi@gmail.com";
21
+ const PASSWORD = process.env.NEURON_PASSWORD || "12345678";
22
+
23
+ let token = "";
24
+
25
+ async function api(method: string, path: string, data?: unknown) {
26
+ const res = await axios({
27
+ method,
28
+ url: `${API}/${path}`,
29
+ data,
30
+ headers: {
31
+ "Content-Type": "application/json",
32
+ ...(token ? { Authorization: `Bearer ${token}` } : {}),
33
+ },
34
+ });
35
+ return res.data;
36
+ }
37
+
38
+ async function main() {
39
+ console.log("=== DelivaHere Bot Setup ===\n");
40
+
41
+ // --- Step 1: Login ---
42
+ console.log("1. Logging in...");
43
+ const auth = await api("POST", "auth/login", {
44
+ email: EMAIL,
45
+ password: PASSWORD,
46
+ });
47
+ token = auth.data.accessToken;
48
+ console.log(` Logged in as ${EMAIL}\n`);
49
+
50
+ // --- Step 2: Create the bot ---
51
+ console.log("2. Creating DelivaHere bot...");
52
+ const bot = await api("POST", "bots", {
53
+ name: "DelivaHere Assistant",
54
+ systemPrompt: SYSTEM_PROMPT,
55
+ model: "anthropic/claude-sonnet-4.5",
56
+ temperature: 0.4,
57
+ maxTokens: 2048,
58
+ });
59
+ const botId = bot.data.id;
60
+ console.log(` Bot created: ${botId}\n`);
61
+
62
+ // --- Step 3: Create knowledge base ---
63
+ console.log("3. Creating knowledge base...");
64
+ const kb = await api("POST", "knowledge-bases", {
65
+ name: "DelivaHere Platform Knowledge",
66
+ description:
67
+ "Comprehensive knowledge base for the DelivaHere peer-to-peer delivery platform",
68
+ rootInstruction:
69
+ "You are the DelivaHere delivery assistant. Use this knowledge base to answer questions about the platform, process delivery requests, provide tracking updates, and help customers with their deliveries. Always be helpful, concise, and proactive about gathering delivery details.",
70
+ });
71
+ const kbId = kb.data.id;
72
+ console.log(` Knowledge base created: ${kbId}\n`);
73
+
74
+ // --- Step 4: Add knowledge base entries ---
75
+ console.log("4. Adding knowledge base entries...");
76
+ for (const entry of KNOWLEDGE_ENTRIES) {
77
+ await api("POST", `knowledge-bases/${kbId}/entries`, entry);
78
+ console.log(` Added: ${entry.title}`);
79
+ }
80
+ console.log();
81
+
82
+ // --- Step 5: Attach KB to bot ---
83
+ console.log("5. Attaching knowledge base to bot...");
84
+ await api("POST", `bots/${botId}/knowledge-bases`, {
85
+ knowledgeBaseId: kbId,
86
+ priority: 10,
87
+ });
88
+ console.log(" Attached.\n");
89
+
90
+ // --- Step 6: Create delivery request tool ---
91
+ console.log("6. Creating DelivaHere API tool...");
92
+ const tool = await api("POST", `tools/bot/${botId}`, {
93
+ name: "create_delivery_request",
94
+ description:
95
+ "Creates a new delivery request on the DelivaHere platform. Call this when a customer wants to send a package. Returns a request ID, estimated pricing, and status.",
96
+ type: "http",
97
+ config: {
98
+ url: "https://api.delivahere.com/v1/delivery-requests",
99
+ method: "POST",
100
+ headers: {
101
+ "Content-Type": "application/json",
102
+ Authorization: "Bearer {{DELIVAHERE_API_KEY}}",
103
+ },
104
+ bodyTemplate: JSON.stringify({
105
+ sender_phone: "{{senderPhone}}",
106
+ sender_name: "{{senderName}}",
107
+ pickup_address: "{{pickupAddress}}",
108
+ dropoff_address: "{{dropoffAddress}}",
109
+ package_description: "{{packageDescription}}",
110
+ package_weight_kg: "{{packageWeight}}",
111
+ package_size: "{{packageSize}}",
112
+ delivery_type: "{{deliveryType}}",
113
+ preferred_pickup_time: "{{preferredPickupTime}}",
114
+ preferred_delivery_time: "{{preferredDeliveryTime}}",
115
+ special_instructions: "{{specialInstructions}}",
116
+ }),
117
+ responseMapping: {
118
+ requestId: "$.data.id",
119
+ status: "$.data.status",
120
+ estimatedPrice: "$.data.estimated_price",
121
+ estimatedDelivery: "$.data.estimated_delivery",
122
+ },
123
+ },
124
+ authType: "bearer",
125
+ rateLimit: 30,
126
+ timeoutMs: 15000,
127
+ });
128
+ console.log(` Tool created: ${tool.data.id}\n`);
129
+
130
+ // Create tracking tool
131
+ console.log(" Creating tracking tool...");
132
+ await api("POST", `tools/bot/${botId}`, {
133
+ name: "track_delivery",
134
+ description:
135
+ "Tracks the status of an existing delivery request. Returns current status, location, and ETA.",
136
+ type: "http",
137
+ config: {
138
+ url: "https://api.delivahere.com/v1/delivery-requests/{{requestId}}/track",
139
+ method: "GET",
140
+ headers: {
141
+ Authorization: "Bearer {{DELIVAHERE_API_KEY}}",
142
+ },
143
+ responseMapping: {
144
+ status: "$.data.status",
145
+ currentLocation: "$.data.current_location",
146
+ eta: "$.data.eta",
147
+ partnerName: "$.data.partner_agent.name",
148
+ partnerPhone: "$.data.partner_agent.phone",
149
+ },
150
+ },
151
+ authType: "bearer",
152
+ rateLimit: 60,
153
+ timeoutMs: 10000,
154
+ });
155
+ console.log(" Tracking tool created.\n");
156
+
157
+ // Create bid listing tool
158
+ console.log(" Creating bid listing tool...");
159
+ await api("POST", `tools/bot/${botId}`, {
160
+ name: "list_delivery_bids",
161
+ description:
162
+ "Lists all bids from delivery partner agents for a given delivery request. Returns bid amounts, estimated delivery times, and partner ratings.",
163
+ type: "http",
164
+ config: {
165
+ url: "https://api.delivahere.com/v1/delivery-requests/{{requestId}}/bids",
166
+ method: "GET",
167
+ headers: {
168
+ Authorization: "Bearer {{DELIVAHERE_API_KEY}}",
169
+ },
170
+ responseMapping: {
171
+ bids: "$.data.bids",
172
+ bidCount: "$.data.total",
173
+ },
174
+ },
175
+ authType: "bearer",
176
+ rateLimit: 60,
177
+ timeoutMs: 10000,
178
+ });
179
+ console.log(" Bid listing tool created.\n");
180
+
181
+ // Create bid acceptance tool
182
+ console.log(" Creating bid acceptance tool...");
183
+ await api("POST", `tools/bot/${botId}`, {
184
+ name: "accept_delivery_bid",
185
+ description:
186
+ "Accepts a specific bid from a delivery partner agent. This confirms the delivery and initiates the pickup process.",
187
+ type: "http",
188
+ config: {
189
+ url: "https://api.delivahere.com/v1/delivery-requests/{{requestId}}/bids/{{bidId}}/accept",
190
+ method: "POST",
191
+ headers: {
192
+ "Content-Type": "application/json",
193
+ Authorization: "Bearer {{DELIVAHERE_API_KEY}}",
194
+ },
195
+ responseMapping: {
196
+ status: "$.data.status",
197
+ partnerAgent: "$.data.partner_agent",
198
+ pickupTime: "$.data.pickup_time",
199
+ estimatedDelivery: "$.data.estimated_delivery",
200
+ },
201
+ },
202
+ authType: "bearer",
203
+ rateLimit: 10,
204
+ timeoutMs: 15000,
205
+ });
206
+ console.log(" Bid acceptance tool created.\n");
207
+
208
+ // --- Step 7: Create API key ---
209
+ console.log("7. Creating API key for programmatic access...");
210
+ const apiKey = await api("POST", `bots/${botId}/api-keys`, {
211
+ name: "DelivaHere WhatsApp Integration",
212
+ });
213
+ console.log(` API Key: ${apiKey.data.plaintext}`);
214
+ console.log(` (Save this key — it won't be shown again)\n`);
215
+
216
+ // --- Summary ---
217
+ console.log("=== Setup Complete ===");
218
+ console.log(`Bot ID: ${botId}`);
219
+ console.log(`Knowledge Base ID: ${kbId}`);
220
+ console.log(`API Key: ${apiKey.data.plaintext}`);
221
+ console.log(`\nTest with:`);
222
+ console.log(` curl -X POST ${API}/bot-api/chat \\`);
223
+ console.log(` -H "Authorization: Bearer ${apiKey.data.plaintext}" \\`);
224
+ console.log(` -H "Content-Type: application/json" \\`);
225
+ console.log(
226
+ ` -d '{"message":"I want to send a package from Lagos to Abuja","contactPhone":"+2348012345678"}'`,
227
+ );
228
+ }
229
+
230
+ // ---------------------------------------------------------------------------
231
+ // System Prompt
232
+ // ---------------------------------------------------------------------------
233
+
234
+ const SYSTEM_PROMPT = `You are the DelivaHere Delivery Assistant — a friendly, efficient AI that helps customers send packages through the DelivaHere peer-to-peer delivery platform.
235
+
236
+ ## Your Role
237
+ - Help customers create delivery requests by gathering required information
238
+ - Provide tracking updates on existing deliveries
239
+ - Present delivery bids from partner agents and help customers choose
240
+ - Answer questions about the platform, pricing, and policies
241
+ - Escalate complex issues to human support when needed
242
+
243
+ ## Conversation Flow for New Deliveries
244
+ 1. Greet the customer warmly
245
+ 2. Ask what they need (send a package, track, get help)
246
+ 3. For new deliveries, gather ALL required fields before creating the request:
247
+ - Pickup address (full address)
248
+ - Drop-off address (full address)
249
+ - Package description (what's being sent)
250
+ - Package weight (in kg, approximate is fine)
251
+ - Package size (small/medium/large/extra-large)
252
+ - Delivery type (local/inter-state/international)
253
+ - Preferred pickup time
254
+ - Preferred delivery time
255
+ - Any special instructions
256
+ 4. Confirm the details with the customer
257
+ 5. Create the delivery request using the create_delivery_request tool
258
+ 6. Share the request ID and estimated pricing
259
+ 7. When bids come in, present them clearly and help the customer choose
260
+
261
+ ## Communication Style
262
+ - Be warm, professional, and concise
263
+ - Use simple language — avoid jargon
264
+ - Confirm details before taking action
265
+ - If unsure, ask rather than assume
266
+ - For pricing questions, always say "estimated" — final price depends on partner bids
267
+ - Use the customer's name if available
268
+
269
+ ## Package Size Guide
270
+ - Small: Fits in a shoebox (< 5kg)
271
+ - Medium: Fits in a carry-on bag (5-15kg)
272
+ - Large: Needs both arms to carry (15-30kg)
273
+ - Extra-large: May need two people or a vehicle (30kg+)
274
+
275
+ ## Delivery Types
276
+ - Local: Same city, usually same-day or next-day
277
+ - Inter-state: Different states, 1-3 days
278
+ - International: Different countries, 3-14 days depending on destination
279
+
280
+ ## Important Rules
281
+ - NEVER share another customer's information
282
+ - NEVER make up tracking numbers or delivery statuses — always use the tools
283
+ - If a tool call fails, apologize and suggest the customer try again or contact support
284
+ - For complaints or refund requests, collect details and escalate to human support
285
+ - Always provide the delivery request ID after creating one`;
286
+
287
+ // ---------------------------------------------------------------------------
288
+ // Knowledge Base Entries
289
+ // ---------------------------------------------------------------------------
290
+
291
+ const KNOWLEDGE_ENTRIES = [
292
+ {
293
+ title: "DelivaHere Platform Overview",
294
+ content: `DelivaHere is a peer-to-peer delivery platform that connects senders with delivery partner agents. Unlike traditional courier services, DelivaHere uses a bidding system where multiple delivery partners can bid on a delivery request, and the sender chooses the best offer.
295
+
296
+ The platform serves three user types:
297
+ 1. **Senders** — People or businesses that need packages delivered
298
+ 2. **Delivery Partner Agents** — Individuals who earn money by delivering packages during their commutes and travels
299
+ 3. **Package Processing Centers** — Physical locations that serve as intermediary drop-off/pick-up points for inter-state and international deliveries
300
+
301
+ DelivaHere supports local, inter-state, and international deliveries across Africa and beyond.`,
302
+ folder: "general",
303
+ },
304
+ {
305
+ title: "How Delivery Requests Work",
306
+ content: `## Creating a Delivery Request
307
+
308
+ When a sender wants to send a package, the following information is required:
309
+ - **Pickup address**: Full address where the package will be collected
310
+ - **Drop-off address**: Full address where the package should be delivered
311
+ - **Package description**: What is being sent (for safety and customs if international)
312
+ - **Package weight**: Approximate weight in kilograms
313
+ - **Package size**: small (< 5kg, shoebox), medium (5-15kg, carry-on), large (15-30kg), extra-large (30kg+)
314
+ - **Delivery type**: local (same city), inter-state (different states), international
315
+ - **Preferred pickup time**: When the sender wants the package picked up
316
+ - **Preferred delivery time**: When the package should arrive
317
+ - **Special instructions**: Fragile handling, temperature sensitivity, etc.
318
+
319
+ ## The Bidding Process
320
+
321
+ After a delivery request is created:
322
+ 1. Partner agents in the area are notified
323
+ 2. Interested agents submit bids with their price and estimated delivery time
324
+ 3. The sender receives all bids and can compare price, delivery time, and agent ratings
325
+ 4. The sender accepts a bid, confirming the delivery
326
+ 5. The partner agent picks up the package at the agreed time
327
+
328
+ ## Delivery Statuses
329
+ - **pending** — Request created, waiting for bids
330
+ - **bidding** — Bids are being received from partner agents
331
+ - **accepted** — A bid has been accepted, partner assigned
332
+ - **pickup_scheduled** — Partner is en route to pick up
333
+ - **picked_up** — Package has been collected
334
+ - **in_transit** — Package is on its way
335
+ - **at_processing_center** — Package is at an intermediary center (inter-state/international)
336
+ - **out_for_delivery** — Final leg, partner heading to drop-off
337
+ - **delivered** — Successfully delivered
338
+ - **cancelled** — Request was cancelled
339
+ - **failed** — Delivery attempt failed`,
340
+ folder: "general",
341
+ },
342
+ {
343
+ title: "Pricing and Payment",
344
+ content: `## How Pricing Works
345
+
346
+ DelivaHere uses a market-driven bidding system:
347
+ - There is NO fixed price list — prices are determined by partner agent bids
348
+ - Factors that influence bid amounts:
349
+ - Distance between pickup and drop-off
350
+ - Package weight and size
351
+ - Delivery urgency (same-day costs more)
352
+ - Route popularity (common routes may be cheaper)
353
+ - Time of day and demand
354
+
355
+ ## Estimated Pricing Ranges (for reference only)
356
+
357
+ Local deliveries (same city):
358
+ - Small package: NGN 1,000 - 3,000
359
+ - Medium package: NGN 2,000 - 5,000
360
+ - Large package: NGN 3,500 - 8,000
361
+
362
+ Inter-state deliveries:
363
+ - Small package: NGN 3,000 - 8,000
364
+ - Medium package: NGN 5,000 - 15,000
365
+ - Large package: NGN 8,000 - 25,000
366
+
367
+ International deliveries: Varies significantly by destination. Typically NGN 15,000+
368
+
369
+ ## Payment
370
+ - Payment is held in escrow when a bid is accepted
371
+ - The partner agent is paid after successful delivery
372
+ - If delivery fails, the sender receives a full refund
373
+ - Accepted payment methods: Bank transfer, card, mobile money, USSD`,
374
+ folder: "general",
375
+ },
376
+ {
377
+ title: "Delivery Partner Agents",
378
+ content: `## Who Are Delivery Partner Agents?
379
+
380
+ Delivery partner agents are individuals who earn extra income by delivering packages during their daily commutes and travels. They are NOT traditional couriers — they are everyday people going about their day who can carry a package along the way.
381
+
382
+ ## How Partners Earn
383
+ - Partners browse available delivery requests in their area or along their route
384
+ - They submit bids with their price and estimated delivery time
385
+ - If a sender accepts their bid, they pick up and deliver the package
386
+ - Payment is released to their wallet after confirmed delivery
387
+
388
+ ## Partner Ratings
389
+ - Partners are rated 1-5 stars by senders after each delivery
390
+ - Rating factors: timeliness, package condition, communication, professionalism
391
+ - Higher-rated partners tend to get more accepted bids
392
+
393
+ ## Partner Requirements
394
+ - Valid government-issued ID
395
+ - Smartphone with the DelivaHere app
396
+ - Bank account for receiving payments
397
+ - Clean record (background check required)
398
+
399
+ ## Important for the Bot
400
+ When presenting bids to senders, always show:
401
+ - Partner name and rating (stars)
402
+ - Number of completed deliveries
403
+ - Bid amount
404
+ - Estimated pickup and delivery time
405
+ - Any special notes from the partner`,
406
+ folder: "general",
407
+ },
408
+ {
409
+ title: "Package Processing Centers",
410
+ content: `## What Are Processing Centers?
411
+
412
+ Package Processing Centers (PPCs) are authorized physical locations that serve as intermediary points for inter-state and international deliveries. They are typically existing businesses (shops, offices, logistics hubs) that have partnered with DelivaHere.
413
+
414
+ ## How PPCs Work
415
+
416
+ For inter-state and international deliveries:
417
+ 1. Sender's local partner agent picks up the package
418
+ 2. Partner delivers it to the nearest PPC
419
+ 3. PPC inspects and logs the package
420
+ 4. A long-haul partner picks it up for the inter-state/international leg
421
+ 5. Package arrives at the destination PPC
422
+ 6. A local partner in the destination city delivers to the final address
423
+
424
+ ## Benefits
425
+ - Pre-inspection of packages for safety
426
+ - Flexible pickup/drop-off hours for senders and partners
427
+ - Neutral handover locations
428
+ - Proper documentation for customs (international)
429
+ - Package insurance options
430
+
431
+ ## PPC Services
432
+ - Package receiving and temporary storage
433
+ - Package inspection and documentation
434
+ - Customs paperwork (international shipments)
435
+ - Insurance options
436
+ - Real-time status updates to sender`,
437
+ folder: "general",
438
+ },
439
+ {
440
+ title: "API Integration — Creating Delivery Requests",
441
+ content: `## DelivaHere API — Create Delivery Request
442
+
443
+ Endpoint: POST https://api.delivahere.com/v1/delivery-requests
444
+ Auth: Bearer token (DELIVAHERE_API_KEY)
445
+
446
+ ### Request Body
447
+ {
448
+ "sender_phone": "+2348012345678",
449
+ "sender_name": "John Doe",
450
+ "pickup_address": "15 Allen Avenue, Ikeja, Lagos",
451
+ "dropoff_address": "23 Wuse Zone 5, Abuja",
452
+ "package_description": "Electronics - Laptop computer",
453
+ "package_weight_kg": 3.5,
454
+ "package_size": "small",
455
+ "delivery_type": "inter-state",
456
+ "preferred_pickup_time": "2025-03-15T10:00:00Z",
457
+ "preferred_delivery_time": "2025-03-17T18:00:00Z",
458
+ "special_instructions": "Fragile - handle with care. Keep upright."
459
+ }
460
+
461
+ ### Response (Success)
462
+ {
463
+ "success": true,
464
+ "data": {
465
+ "id": "del_abc123",
466
+ "status": "pending",
467
+ "estimated_price": { "min": 4500, "max": 8000, "currency": "NGN" },
468
+ "estimated_delivery": "2025-03-17T15:00:00Z",
469
+ "created_at": "2025-03-14T12:00:00Z"
470
+ }
471
+ }
472
+
473
+ ### After Creation
474
+ The bot should:
475
+ 1. Tell the customer their request ID (e.g., del_abc123)
476
+ 2. Share the estimated price range
477
+ 3. Explain that partner agents will now submit bids
478
+ 4. Let them know they'll be notified when bids come in
479
+ 5. Ask if they have any questions`,
480
+ folder: "skills",
481
+ },
482
+ {
483
+ title: "API Integration — Tracking and Bids",
484
+ content: `## Track Delivery
485
+
486
+ Endpoint: GET https://api.delivahere.com/v1/delivery-requests/{requestId}/track
487
+ Auth: Bearer token
488
+
489
+ ### Response
490
+ {
491
+ "success": true,
492
+ "data": {
493
+ "status": "in_transit",
494
+ "current_location": "Along Lagos-Ibadan Expressway",
495
+ "eta": "2025-03-17T14:30:00Z",
496
+ "partner_agent": {
497
+ "name": "Adebayo O.",
498
+ "phone": "+234801XXXXXXX",
499
+ "rating": 4.8,
500
+ "completed_deliveries": 156
501
+ },
502
+ "timeline": [
503
+ { "event": "created", "timestamp": "2025-03-14T12:00:00Z" },
504
+ { "event": "bid_accepted", "timestamp": "2025-03-14T14:00:00Z" },
505
+ { "event": "picked_up", "timestamp": "2025-03-15T10:30:00Z" },
506
+ { "event": "in_transit", "timestamp": "2025-03-15T11:00:00Z" }
507
+ ]
508
+ }
509
+ }
510
+
511
+ ## List Bids
512
+
513
+ Endpoint: GET https://api.delivahere.com/v1/delivery-requests/{requestId}/bids
514
+
515
+ ### Response
516
+ {
517
+ "success": true,
518
+ "data": {
519
+ "total": 3,
520
+ "bids": [
521
+ {
522
+ "id": "bid_001",
523
+ "partner_name": "Adebayo O.",
524
+ "partner_rating": 4.8,
525
+ "completed_deliveries": 156,
526
+ "amount": 5500,
527
+ "currency": "NGN",
528
+ "estimated_pickup": "2025-03-15T10:00:00Z",
529
+ "estimated_delivery": "2025-03-17T14:00:00Z",
530
+ "note": "I travel this route weekly. Will handle with care."
531
+ },
532
+ {
533
+ "id": "bid_002",
534
+ "partner_name": "Chioma E.",
535
+ "partner_rating": 4.5,
536
+ "completed_deliveries": 89,
537
+ "amount": 4800,
538
+ "currency": "NGN",
539
+ "estimated_pickup": "2025-03-15T09:00:00Z",
540
+ "estimated_delivery": "2025-03-17T16:00:00Z",
541
+ "note": "Heading to Abuja tomorrow morning."
542
+ }
543
+ ]
544
+ }
545
+ }
546
+
547
+ ## Accept Bid
548
+
549
+ Endpoint: POST https://api.delivahere.com/v1/delivery-requests/{requestId}/bids/{bidId}/accept
550
+
551
+ ### Response
552
+ {
553
+ "success": true,
554
+ "data": {
555
+ "status": "accepted",
556
+ "partner_agent": { "name": "Adebayo O.", "phone": "+234801XXXXXXX" },
557
+ "pickup_time": "2025-03-15T10:00:00Z",
558
+ "estimated_delivery": "2025-03-17T14:00:00Z",
559
+ "payment_held": 5500
560
+ }
561
+ }
562
+
563
+ ## How the Bot Presents Bids
564
+ When bids come in, present them like this:
565
+ "You have 3 bids for your delivery (del_abc123):
566
+
567
+ 1. Adebayo O. (4.8 stars, 156 deliveries) — NGN 5,500
568
+ Pickup: Mar 15 at 10am | Delivery: Mar 17 by 2pm
569
+ Note: 'I travel this route weekly. Will handle with care.'
570
+
571
+ 2. Chioma E. (4.5 stars, 89 deliveries) — NGN 4,800
572
+ Pickup: Mar 15 at 9am | Delivery: Mar 17 by 4pm
573
+ Note: 'Heading to Abuja tomorrow morning.'
574
+
575
+ Which bid would you like to accept?"`,
576
+ folder: "skills",
577
+ },
578
+ {
579
+ title: "Customer Communication Templates",
580
+ content: `## Welcome Message
581
+ "Hello! Welcome to DelivaHere. I'm your delivery assistant. I can help you:
582
+ - Send a package anywhere in Nigeria or internationally
583
+ - Track an existing delivery
584
+ - View and accept bids from delivery partners
585
+
586
+ What would you like to do today?"
587
+
588
+ ## Gathering Delivery Details
589
+ "Great, let's get your package on its way! I'll need a few details:
590
+
591
+ 1. Where should we pick up the package? (Full address)
592
+ 2. Where is it going? (Full address)
593
+ 3. What are you sending? (Brief description)
594
+ 4. About how heavy is it? (kg)
595
+ 5. Is it small (shoebox), medium (carry-on bag), large (needs two arms), or extra-large?
596
+
597
+ Feel free to share all details at once, or I'll ask one at a time."
598
+
599
+ ## Confirming Details
600
+ "Here's a summary of your delivery request:
601
+ - From: {pickup_address}
602
+ - To: {dropoff_address}
603
+ - Package: {description} ({weight}kg, {size})
604
+ - Type: {delivery_type}
605
+ - Pickup: {pickup_time}
606
+ - Delivery by: {delivery_time}
607
+ - Instructions: {special_instructions}
608
+
609
+ Shall I go ahead and create this request?"
610
+
611
+ ## Request Created
612
+ "Your delivery request has been created!
613
+ - Request ID: {requestId}
614
+ - Estimated price range: NGN {min} - {max}
615
+ - Delivery partners in the area will now submit their bids.
616
+
617
+ I'll let you know as soon as bids come in. Is there anything else you need?"
618
+
619
+ ## Tracking Update
620
+ "Here's the latest on your delivery ({requestId}):
621
+ - Status: {status}
622
+ - Location: {current_location}
623
+ - ETA: {eta}
624
+ - Partner: {partner_name} ({partner_rating} stars)
625
+
626
+ Need anything else?"
627
+
628
+ ## Error / Fallback
629
+ "I'm sorry, I wasn't able to {action} at the moment. This could be a temporary issue. You can:
630
+ - Try again in a few minutes
631
+ - Contact our support team at support@delivahere.com
632
+ - Call us at +234-800-DELIVA
633
+
634
+ I apologize for the inconvenience."`,
635
+ folder: "contexts",
636
+ },
637
+ {
638
+ title: "Prohibited Items and Safety Policies",
639
+ content: `## Prohibited Items
640
+ The following items CANNOT be sent via DelivaHere:
641
+ - Illegal drugs or controlled substances
642
+ - Weapons, firearms, or ammunition
643
+ - Explosives or flammable materials
644
+ - Hazardous chemicals or biological materials
645
+ - Live animals
646
+ - Human remains
647
+ - Counterfeit goods
648
+ - Stolen property
649
+ - Cash or currency exceeding NGN 500,000 equivalent
650
+
651
+ ## Restricted Items (Require Special Handling)
652
+ These items CAN be sent but require declaration:
653
+ - Electronics (must be described accurately)
654
+ - Fragile items (must be marked, special packaging recommended)
655
+ - Perishable food (only for local/same-day delivery)
656
+ - Medication (must be legal and properly labeled)
657
+ - Documents (legal/official documents should use insured delivery)
658
+ - Jewelry or valuables (insurance recommended)
659
+
660
+ ## Insurance
661
+ - Basic insurance (up to NGN 50,000) is included with every delivery
662
+ - Extended insurance is available at 2% of declared value
663
+ - International deliveries include customs documentation support
664
+
665
+ ## If a Customer Asks About Prohibited Items
666
+ Politely decline: "I'm sorry, but {item} cannot be sent through DelivaHere for safety and legal reasons. Is there anything else I can help you with?"
667
+
668
+ ## Package Inspection
669
+ Processing centers inspect packages for:
670
+ - Prohibited items
671
+ - Accurate description matching
672
+ - Proper packaging
673
+ - Weight verification`,
674
+ folder: "contexts",
675
+ },
676
+ {
677
+ title: "Frequently Asked Questions",
678
+ content: `## General Questions
679
+
680
+ **Q: How long does delivery take?**
681
+ A: Local (same city): Usually same-day or next-day. Inter-state: 1-3 days. International: 3-14 days depending on destination.
682
+
683
+ **Q: How much does delivery cost?**
684
+ A: Prices are set by delivery partner bids, not fixed rates. After you create a request, partners submit their bids and you choose the best one. Estimated ranges are shown when the request is created.
685
+
686
+ **Q: Is my package insured?**
687
+ A: Yes, basic insurance up to NGN 50,000 is included free. You can opt for extended insurance at 2% of the declared value.
688
+
689
+ **Q: Can I cancel a delivery?**
690
+ A: Yes, you can cancel before a bid is accepted for free. After acceptance, cancellation may incur a small fee depending on the partner's progress.
691
+
692
+ **Q: How do I track my package?**
693
+ A: Share your request ID (e.g., del_abc123) and I'll give you a real-time update. You can also track in the DelivaHere app.
694
+
695
+ **Q: What if my package is damaged?**
696
+ A: Report it within 24 hours of delivery. We'll investigate and process a claim through the insurance coverage. Take photos of the damage.
697
+
698
+ **Q: Can I schedule a pickup for a specific time?**
699
+ A: Yes! When creating your request, specify your preferred pickup time. Partners who can meet that time will bid accordingly.
700
+
701
+ **Q: Do you deliver internationally?**
702
+ A: Yes, we support international deliveries. These go through Package Processing Centers for customs documentation.
703
+
704
+ ## Partner-Related Questions
705
+
706
+ **Q: How are delivery partners verified?**
707
+ A: All partners undergo ID verification and background checks before activation. They're also rated by senders after each delivery.
708
+
709
+ **Q: Can I choose a specific partner?**
710
+ A: You choose from the bids submitted. You can see each partner's rating, number of deliveries, and their bid notes.
711
+
712
+ **Q: What if the partner doesn't show up?**
713
+ A: Contact us immediately. We'll reassign your delivery and the partner's account will be reviewed.
714
+
715
+ ## Payment Questions
716
+
717
+ **Q: When am I charged?**
718
+ A: Payment is held in escrow when you accept a bid. It's released to the partner only after you confirm delivery.
719
+
720
+ **Q: What payment methods do you accept?**
721
+ A: Bank transfer, debit/credit cards, mobile money (Opay, PalmPay, etc.), and USSD banking.
722
+
723
+ **Q: Can I get a refund?**
724
+ A: Yes, full refund if the delivery fails or is cancelled before pickup. Partial refunds may apply for late deliveries.`,
725
+ folder: "faqs",
726
+ },
727
+ {
728
+ title: "Escalation and Human Support",
729
+ content: `## When to Escalate to Human Support
730
+
731
+ The bot should escalate when:
732
+ 1. Customer reports a lost or stolen package
733
+ 2. Customer reports significant damage (> NGN 10,000)
734
+ 3. Customer requests a refund exceeding NGN 20,000
735
+ 4. Customer reports a safety concern with a partner
736
+ 5. Customer has a complaint that isn't resolved after 2 attempts
737
+ 6. Legal or compliance questions
738
+ 7. Account suspension or verification issues
739
+ 8. Customer explicitly asks for a human agent
740
+
741
+ ## How to Escalate
742
+ Say: "I understand this needs personal attention. Let me connect you with our support team. A human agent will be with you shortly. Your reference number is {conversationId}."
743
+
744
+ ## Support Contact Info
745
+ - Email: support@delivahere.com
746
+ - Phone: +234-800-DELIVA (334482)
747
+ - In-app: Settings > Help & Support > Chat with Agent
748
+ - Hours: Mon-Sat 7am-10pm WAT, Sun 9am-6pm WAT
749
+
750
+ ## Common Issues and First Responses
751
+
752
+ **Late delivery**: Check tracking first. If partner is unresponsive for 2+ hours, escalate.
753
+ **Wrong address**: If not yet picked up, update the request. If in transit, contact partner directly.
754
+ **Price dispute**: Show the accepted bid details. If customer claims overcharge, escalate.
755
+ **App issues**: Suggest: clear cache, update app, reinstall. If persists, escalate.`,
756
+ folder: "contexts",
757
+ },
758
+ {
759
+ title: "Service Coverage Areas",
760
+ content: `## Local Delivery Coverage
761
+
762
+ DelivaHere operates in major cities across Nigeria:
763
+ - Lagos (all areas including Island, Mainland, Lekki, Ikorodu, Badagry)
764
+ - Abuja (FCT and satellite towns)
765
+ - Port Harcourt
766
+ - Ibadan
767
+ - Kano
768
+ - Kaduna
769
+ - Enugu
770
+ - Benin City
771
+ - Calabar
772
+ - Warri/Asaba
773
+
774
+ Coverage is expanding — if a customer's city isn't listed, they can still create a request. If partners are available in the area, they'll receive bids.
775
+
776
+ ## Inter-State Delivery
777
+ All 36 states + FCT are supported for inter-state delivery via the Processing Center network.
778
+
779
+ ## International Delivery
780
+ Currently supported corridors:
781
+ - Nigeria to/from Ghana
782
+ - Nigeria to/from UK
783
+ - Nigeria to/from USA
784
+ - Nigeria to/from South Africa
785
+ - Nigeria to/from UAE (Dubai)
786
+ - More corridors being added regularly
787
+
788
+ For unlisted international destinations, customers should contact support for availability.
789
+
790
+ ## Delivery Time Estimates
791
+ - Local (same city): 2-8 hours (same-day) or next business day
792
+ - Inter-state: 1-3 business days
793
+ - International (Africa): 3-7 business days
794
+ - International (Europe/Americas): 7-14 business days
795
+
796
+ Note: These are estimates. Actual times depend on partner availability and route.`,
797
+ folder: "general",
798
+ },
799
+ ];
800
+
801
+ main().catch((err) => {
802
+ console.error("Setup failed:", err.response?.data || err.message);
803
+ process.exit(1);
804
+ });