{
  "info": {
    "name": "Peep OA - Public API",
    "description": "Public API สำหรับ Peep Official Account (OA)\n\n## Authentication Flow\n1. ใช้ `api_key` + `api_secret` เรียก `/auth/token` เพื่อรับ access_token & refresh_token\n2. ใส่ access_token ใน Header `Authorization: Bearer <token>` สำหรับ endpoint อื่นๆ\n3. เมื่อ token หมดอายุ ใช้ `/auth/refresh-token` เพื่อขอ token ใหม่\n\n## Rate Limiting\n- 200 requests / minute (ทุก endpoint)\n\n## Message Item Types\n- `message` — ข้อความ text\n- `oa_image_link` — รูปภาพพร้อม link\n- `flex` — flex message\n- `image` — รูปภาพ",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "variable": [
    {
      "key": "base_url",
      "value": "https://your-domain.com",
      "description": "Base URL ของ Peep OA API"
    },
    {
      "key": "access_token",
      "value": "",
      "description": "Access token ได้จาก /auth/token"
    },
    {
      "key": "refresh_token",
      "value": "",
      "description": "Refresh token ได้จาก /auth/token"
    },
    {
      "key": "api_key",
      "value": "",
      "description": "API Key ที่ได้จากระบบ internal"
    },
    {
      "key": "api_secret",
      "value": "",
      "description": "API Secret ที่ได้จากระบบ internal"
    },
    {
      "key": "user_id",
      "value": "",
      "description": "User ID ของผู้รับข้อความ"
    }
  ],
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{access_token}}",
        "type": "string"
      }
    ]
  },
  "item": [
    {
      "name": "Authentication",
      "description": "Endpoints สำหรับจัดการ token authentication",
      "item": [
        {
          "name": "Generate Token",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "auth": {
              "type": "noauth"
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"api_key\": \"{{api_key}}\",\n  \"api_secret\": \"{{api_secret}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/v2/public/auth/token",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "public", "auth", "token"]
            },
            "description": "สร้าง access_token และ refresh_token โดยใช้ api_key + api_secret\n\n**Request Body:**\n- `api_key` (string, required) — API Key ที่ได้รับ\n- `api_secret` (string, required) — API Secret ที่ได้รับ\n\n**Response:**\n- `access_token` — ใช้สำหรับเรียก API (มีอายุจำกัด)\n- `refresh_token` — ใช้สำหรับขอ access_token ใหม่"
          },
          "response": []
        },
        {
          "name": "Refresh Token",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "auth": {
              "type": "noauth"
            },
            "body": {
              "mode": "raw",
              "raw": "{\n  \"refresh_token\": \"{{refresh_token}}\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/v2/public/auth/refresh-token",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "public", "auth", "refresh-token"]
            },
            "description": "ขอ access_token ใหม่โดยใช้ refresh_token\n\n**Request Body:**\n- `refresh_token` (string, required) — Refresh token ที่ได้จาก Generate Token\n\n**Response:**\n- `access_token` — token ใหม่\n- `refresh_token` — refresh token ใหม่"
          },
          "response": []
        }
      ]
    },
    {
      "name": "Webhook (Single User)",
      "description": "ส่งข้อความไปหา user เฉพาะราย (ต้องมี Bearer Token)",
      "item": [
        {
          "name": "Broadcast Greeting",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"user_id\": \"user_123456\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/v2/public/webhook/broadcast-greeting",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "public", "webhook", "broadcast-greeting"]
            },
            "description": "ส่ง greeting message ไปหา user ที่ระบุ\n\n**Request Body:**\n- `user_id` (string, required) — User ID ที่ต้องการส่ง greeting"
          },
          "response": []
        },
        {
          "name": "Broadcast Image Link",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"user_id\": \"{{user_id}}\",\n  \"image_url\": \"https://images.unsplash.com/photo-1564760290292-23341e4df6ec?q=80&w=1740&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D\",\n  \"link\": \"https://example.com/landing-page\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/v2/public/webhook/broadcast-image-link",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "public", "webhook", "broadcast-image-link"]
            },
            "description": "ส่งรูปภาพไปหา user ที่ระบุ\n\n**Request Body:**\n- `user_id` (string, required) — User ID ที่ต้องการส่ง\n- `image_url` (string, required) — URL ของรูปภาพ\n- `link` (string, optional) — ใส่ก็ได้ไม่ใส่ก็ได้ ถ้าใส่จะฝัง link ลงในรูป (กดรูปแล้วเปิด URL)"
          },
          "response": []
        },
        {
          "name": "Broadcast Message",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"user_id\": \"{{user_id}}\",\n  \"msg\": \"สวัสดีครับ นี่คือข้อความทดสอบ\",\n  \"desc\": \"ข้อความเล็กบน push notification\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/v2/public/webhook/broadcast-message",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "public", "webhook", "broadcast-message"]
            },
            "description": "ส่งข้อความ text ไปหา user ที่ระบุ\n\n**Request Body:**\n- `user_id` (string, required) — User ID ที่ต้องการส่ง\n- `msg` (string, required) — เนื้อหาข้อความหลัก\n- `desc` (string, optional) — ข้อความเล็กที่แสดงบน push notification"
          },
          "response": []
        }
      ]
    },
    {
      "name": "Message Broadcast (Mass)",
      "description": "ส่งข้อความแบบ broadcast ไปหาหลาย users (ต้องมี Bearer Token)\n\nRate Limit: 200 requests / minute",
      "item": [
        {
          "name": "Broadcast - type message",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"target\": \"selected\",\n  \"user_ids\": [\"user_001\", \"user_002\", \"user_003\"],\n  \"items\": [\n    {\n      \"type\": \"message\",\n      \"msg\": \"สวัสดีครับ นี่คือข้อความ broadcast\",\n      \"desc\": \"ข้อความเล็กบน push notification\"\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/v2/public/message/broadcast-message",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "public", "message", "broadcast-message"]
            },
            "description": "Broadcast ข้อความ text ไปหา users ที่เลือก\n\n**target:** `all`, `selected`, `single`\n**type:** `message`\n**msg:** เนื้อหาข้อความหลัก\n**desc:** ข้อความเล็กบน push notification (optional, max 170 chars)\n\n**Rate Limit:** 200 requests / minute"
          },
          "response": []
        },
        {
          "name": "Broadcast - type oa_image_link",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"target\": \"all\",\n  \"items\": [\n    {\n      \"type\": \"oa_image_link\",\n      \"msg\": \"https://images.unsplash.com/photo-1564760290292-23341e4df6ec?q=80&w=1740&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D\",\n      \"link\": \"https://example.com/promo\",\n      \"desc\": \"โปรโมชั่นพิเศษวันนี้\"\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/v2/public/message/broadcast-message",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "public", "message", "broadcast-message"]
            },
            "description": "Broadcast รูปภาพพร้อม link ไปหาทุกคน\n\n**type:** `oa_image_link`\n**msg:** URL ของรูปภาพ\n**link:** URL ที่ฝังในรูป (กดรูปแล้วเปิด link)\n**desc:** ข้อความเล็กบน push notification (optional)\n\n**Rate Limit:** 200 requests / minute"
          },
          "response": []
        },
        {
          "name": "Broadcast - type image",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"target\": \"single\",\n  \"user_ids\": [\"user_001\"],\n  \"items\": [\n    {\n      \"type\": \"image\",\n      \"msg\": \"https://images.unsplash.com/photo-1564760290292-23341e4df6ec?q=80&w=1740&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D\"\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/v2/public/message/broadcast-message",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "public", "message", "broadcast-message"]
            },
            "description": "Broadcast รูปภาพธรรมดา (ไม่มี link) ไปหา user\n\n**type:** `image`\n**msg:** URL ของรูปภาพ\n\n**Rate Limit:** 200 requests / minute"
          },
          "response": []
        },
        {
          "name": "Broadcast - type flex",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"target\": \"selected\",\n  \"user_ids\": [\"user_001\"],\n  \"items\": [\n    {\n      \"type\": \"flex\",\n      \"msg\": \"{\\\"type\\\":\\\"bubble\\\",\\\"hero\\\":{\\\"type\\\":\\\"image\\\",\\\"url\\\":\\\"https://developers-resource.landpress.line.me/fx/img/01_1_cafe.png\\\",\\\"size\\\":\\\"full\\\",\\\"aspectRatio\\\":\\\"20:13\\\",\\\"aspectMode\\\":\\\"cover\\\",\\\"action\\\":{\\\"type\\\":\\\"uri\\\",\\\"uri\\\":\\\"https://line.me/\\\"}},\\\"body\\\":{\\\"type\\\":\\\"box\\\",\\\"layout\\\":\\\"vertical\\\",\\\"contents\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Brown Cafe\\\",\\\"weight\\\":\\\"bold\\\",\\\"size\\\":\\\"xl\\\"},{\\\"type\\\":\\\"box\\\",\\\"layout\\\":\\\"vertical\\\",\\\"margin\\\":\\\"lg\\\",\\\"spacing\\\":\\\"sm\\\",\\\"contents\\\":[{\\\"type\\\":\\\"box\\\",\\\"layout\\\":\\\"baseline\\\",\\\"spacing\\\":\\\"sm\\\",\\\"contents\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Place\\\",\\\"color\\\":\\\"#aaaaaa\\\",\\\"size\\\":\\\"sm\\\",\\\"flex\\\":1},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Flex Tower, 7-7-4 Midori-ku, Tokyo\\\",\\\"wrap\\\":true,\\\"color\\\":\\\"#666666\\\",\\\"size\\\":\\\"sm\\\",\\\"flex\\\":5}]},{\\\"type\\\":\\\"box\\\",\\\"layout\\\":\\\"baseline\\\",\\\"spacing\\\":\\\"sm\\\",\\\"contents\\\":[{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"Time\\\",\\\"color\\\":\\\"#aaaaaa\\\",\\\"size\\\":\\\"sm\\\",\\\"flex\\\":1},{\\\"type\\\":\\\"text\\\",\\\"text\\\":\\\"10:00 - 23:00\\\",\\\"wrap\\\":true,\\\"color\\\":\\\"#666666\\\",\\\"size\\\":\\\"sm\\\",\\\"flex\\\":5}]}]}]},\\\"footer\\\":{\\\"type\\\":\\\"box\\\",\\\"layout\\\":\\\"vertical\\\",\\\"spacing\\\":\\\"sm\\\",\\\"contents\\\":[{\\\"type\\\":\\\"button\\\",\\\"style\\\":\\\"link\\\",\\\"height\\\":\\\"sm\\\",\\\"action\\\":{\\\"type\\\":\\\"uri\\\",\\\"label\\\":\\\"CALL\\\",\\\"uri\\\":\\\"https://line.me/\\\"}},{\\\"type\\\":\\\"button\\\",\\\"style\\\":\\\"link\\\",\\\"height\\\":\\\"sm\\\",\\\"action\\\":{\\\"type\\\":\\\"uri\\\",\\\"label\\\":\\\"WEBSITE\\\",\\\"uri\\\":\\\"https://line.me/\\\"}},{\\\"type\\\":\\\"box\\\",\\\"layout\\\":\\\"vertical\\\",\\\"contents\\\":[],\\\"margin\\\":\\\"sm\\\"}],\\\"flex\\\":0}}\",\n      \"desc\": \"Brown Cafe\"\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/v2/public/message/broadcast-message",
              "host": ["{{base_url}}"],
              "path": ["api", "v2", "public", "message", "broadcast-message"]
            },
            "description": "Broadcast flex message ไปหา user\n\n**type:** `flex`\n**msg:** JSON string ของ flex message (stringify แล้ว)\n**desc:** ข้อความเล็กบน push notification (optional)\n\n**Rate Limit:** 200 requests / minute"
          },
          "response": []
        },
        {
          "name": "Broadcast Group Message",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"account_provider_group_id\": \"group_abc123\",\n  \"items\": [\n    {\n      \"type\": \"message\",\n      \"msg\": \"ข้อความถึงสมาชิกในกลุ่ม\"\n    },\n    {\n      \"type\": \"oa_image_link\",\n      \"msg\": \"https://example.com/promo.jpg\",\n      \"link\": \"https://example.com/promo\",\n      \"desc\": \"โปรโมชั่นพิเศษ\"\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/v2/public/message/broadcast-group-message",
              "host": ["{{base_url}}"],
              "path": [
                "api",
                "v2",
                "public",
                "message",
                "broadcast-group-message"
              ]
            },
            "description": "Broadcast ข้อความไปหาสมาชิกทั้งหมดในกลุ่ม\n\n**Request Body:**\n- `account_provider_group_id` (string, required) — ID ของกลุ่มที่ต้องการส่ง\n- `items` (array, required, max 5 items) — รายการข้อความที่จะส่ง\n\n**Item Object:**\n- `type` (string, required) — ประเภทข้อความ: `message`, `oa_image_link`, `flex`, `image`\n- `msg` (string | string[], required) — เนื้อหาข้อความ\n- `desc` (string, optional, max 170 chars) — คำอธิบาย\n- `link` (string, optional) — URL link\n\n**Rate Limit:** 200 requests / minute"
          },
          "response": []
        },
        {
          "name": "Broadcast Member Session",
          "request": {
            "method": "POST",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"member_group_broadcast_id\": \"mgb_xyz789\",\n  \"items\": [\n    {\n      \"type\": \"message\",\n      \"msg\": \"ข้อความสำหรับ member session broadcast\"\n    }\n  ]\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            },
            "url": {
              "raw": "{{base_url}}/api/v2/public/message/broadcast-member-session",
              "host": ["{{base_url}}"],
              "path": [
                "api",
                "v2",
                "public",
                "message",
                "broadcast-member-session"
              ]
            },
            "description": "Broadcast ข้อความแบบ member session\n\n**Request Body:**\n- `member_group_broadcast_id` (string, required) — ID ของ member group broadcast\n- `items` (array, required, max 5 items) — รายการข้อความที่จะส่ง\n\n**Item Object:**\n- `type` (string, required) — ประเภทข้อความ: `message`, `oa_image_link`, `flex`, `image`\n- `msg` (string | string[], required) — เนื้อหาข้อความ\n- `desc` (string, optional, max 170 chars) — คำอธิบาย\n- `link` (string, optional) — URL link\n\n**Rate Limit:** 200 requests / minute"
          },
          "response": []
        }
      ]
    }
  ]
}
