{
	"info": {
		"_postman_id": "kenalko-dev-api-wave1",
		"name": "Kenalko Developer API",
		"description": "Wave 1 — HTTP send (text, attachment, button, list, form).\n\nImport `kenalko-local.postman_environment.json`, set `api_key` and `peer_username`, then run requests.\n\nDocs: docs/developer-api.md · UI: http://localhost:5181",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"variable": [
		{
			"key": "base_url",
			"value": "http://localhost:8090"
		},
		{
			"key": "api_key",
			"value": "knk_live_REPLACE_ME"
		},
		{
			"key": "peer_username",
			"value": "peer_username"
		},
		{
			"key": "group_id",
			"value": "01GROUP00000000000000000000"
		},
		{
			"key": "file_id",
			"value": "01ARZ3NDEKTSV4RRFFQ69G5FAV"
		}
	],
	"item": [
		{
			"name": "Health",
			"item": [
				{
					"name": "GET /health",
					"request": {
						"method": "GET",
						"header": [],
						"url": "{{base_url}}/health",
						"description": "Quick check that the API is up before sending."
					},
					"response": []
				}
			]
		},
		{
			"name": "Messages",
			"item": [
				{
					"name": "GET /v1/me",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key}}",
								"type": "text"
							}
						],
						"url": "{{base_url}}/v1/me",
						"description": "Smoke-test API key and read owner username. Not billable; messages:send scope not required."
					},
					"response": []
				},
				{
					"name": "Send text (DM)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Idempotency-Key",
								"value": "postman-text-{{$timestamp}}",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"to\": \"{{peer_username}}\",\n  \"message\": \"Hello from Postman\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": "{{base_url}}/v1/messages/send",
						"description": "Baseline DM send. `to` = Kenalko username (not user id)."
					},
					"response": []
				},
				{
					"name": "Download attachment (GET /v1/files/:id)",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key}}",
								"type": "text"
							}
						],
						"url": "{{base_url}}/v1/files/{{file_id}}",
						"description": "Fetch file bytes from webhook `attachment.file_id`.\n\nSet `file_id` from a `message.received.*` webhook payload.\n\n200 = raw stream (save response body to disk in Postman).\n403 = not in conversation or view-once.\n410 = expired (7 days after send).\n\nDocs: /docs/webhooks/download"
					},
					"response": []
				},
				{
					"name": "Send list picker (DM) — E2",
					"event": [
						{
							"listen": "test",
							"script": {
								"type": "text/javascript",
								"exec": [
									"if (pm.response.code === 200 || pm.response.code === 201) {",
									"  const j = pm.response.json();",
									"  if (j.message_id) pm.environment.set('last_message_id', j.message_id);",
									"}"
								]
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Idempotency-Key",
								"value": "postman-list-{{$timestamp}}",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"to\": \"{{peer_username}}\",\n  \"type\": \"list\",\n  \"name\": \"support_menu\",\n  \"schema_version\": 1,\n  \"text\": \"Choose a topic\",\n  \"sections\": [\n    {\n      \"title\": \"Support\",\n      \"rows\": [\n        {\n          \"id\": \"billing\",\n          \"title\": \"Billing\",\n          \"description\": \"Invoices & payments\",\n          \"type\": \"reply\",\n          \"write\": true,\n          \"once\": true\n        },\n        {\n          \"id\": \"tech\",\n          \"title\": \"Technical help\",\n          \"description\": \"Login, bugs, outages\",\n          \"type\": \"reply\",\n          \"write\": true,\n          \"once\": false\n        }\n      ]\n    },\n    {\n      \"title\": \"Sales\",\n      \"rows\": [\n        {\n          \"id\": \"demo\",\n          \"title\": \"Book demo\",\n          \"description\": \"Talk to sales\",\n          \"type\": \"reply\",\n          \"write\": true\n        },\n        {\n          \"id\": \"pricing\",\n          \"title\": \"Pricing only\",\n          \"description\": \"Webhook only — no chat bubble\",\n          \"type\": \"reply\",\n          \"write\": false\n        }\n      ]\n    }\n  ],\n  \"expires_at\": \"2026-12-31T10:00:00.000Z\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": "{{base_url}}/v1/messages/send",
						"description": "11E.2 list picker — multi-section.\n\nRules:\n- Row `id` unique across all sections (max 30 rows, 10 sections)\n- `name` required (webhook card id)\n- HTTP send only (WS compose → 403)\n\nAfter send: open chat on web/mobile → **Choose/Pilih** → tap a row.\n\nSubscribe to `interactive.postback` on your webhook; `action_id` = row `id`."
					},
					"response": []
				},
				{
					"name": "Send list picker (group)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Idempotency-Key",
								"value": "postman-list-group-{{$timestamp}}",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"to\": \"{{group_id}}\",\n  \"type\": \"list\",\n  \"name\": \"group_menu\",\n  \"schema_version\": 1,\n  \"text\": \"Team menu — pick one\",\n  \"sections\": [\n    {\n      \"title\": \"Actions\",\n      \"rows\": [\n        {\n          \"id\": \"standup\",\n          \"title\": \"Join standup\",\n          \"type\": \"reply\",\n          \"write\": true\n        },\n        {\n          \"id\": \"docs\",\n          \"title\": \"Open docs\",\n          \"type\": \"reply\",\n          \"write\": false\n        }\n      ]\n    }\n  ]\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": "{{base_url}}/v1/messages/send",
						"description": "Group send — set `group_id` in environment (room ULID). Do not send both `to` and `group_id`."
					},
					"response": []
				},
				{
					"name": "Send button card (DM) — E1",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Idempotency-Key",
								"value": "postman-button-{{$timestamp}}",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"to\": \"{{peer_username}}\",\n  \"type\": \"button\",\n  \"name\": \"appt_confirm:tue10\",\n  \"schema_version\": 1,\n  \"text\": \"Confirm appointment for Tuesday 10:00?\",\n  \"actions\": [\n    {\n      \"id\": \"yes\",\n      \"type\": \"reply\",\n      \"label\": \"Yes\",\n      \"write\": true\n    },\n    {\n      \"id\": \"no\",\n      \"type\": \"reply\",\n      \"label\": \"No\",\n      \"write\": false\n    }\n  ],\n  \"expires_at\": \"2026-12-31T10:00:00.000Z\"\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": "{{base_url}}/v1/messages/send",
						"description": "Reference E1 button card for comparison with list picker."
					},
					"response": []
				},
				{
					"name": "Send form card (DM) — E3",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{api_key}}",
								"type": "text"
							},
							{
								"key": "Content-Type",
								"value": "application/json",
								"type": "text"
							},
							{
								"key": "Idempotency-Key",
								"value": "postman-form-{{$timestamp}}",
								"type": "text"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"to\": \"{{peer_username}}\",\n  \"type\": \"form\",\n  \"form_id\": \"01ARZ3NDEKTSV4RRFFQ69G5FAV\",\n  \"schema_version\": 1\n}",
							"options": {
								"raw": {
									"language": "json"
								}
							}
						},
						"url": "{{base_url}}/v1/messages/send",
						"description": "Send a saved form by ULID (`dashboard → Forms`). Inline `fields` on HTTP → 400.\n\nAfter send: peer opens form in chat → Submit.\n\nSubscribe to `interactive.submit`; answers in webhook `fields` map.\n\nReplace form_id with a form you own."
					},
					"response": []
				}
			]
		}
	]
}
