API Reference
Pulse
Pulse API

Pulse API

Base URL: https://pulse.pcampus.co

Pulse คือ Business Story Explorer ที่สร้างบน PBCP Story API — developer สามารถ embed Pulse widget หรือดึงข้อมูล Story สำหรับแสดงใน UI ของตัวเองได้

Note: Story data ดึงได้โดยตรงจาก PBCP Story API และ Intelligence API ด้วย — Pulse เป็น reference UI ที่ใช้ APIs เหล่านั้น


Embed Widget

แปะ Pulse Story view เข้าใน admin UI ของธุรกิจด้วย iframe:

<iframe
  src="https://pulse.pcampus.co/embed/customer/{customerId}?token={embedToken}"
  width="100%"
  height="600"
  frameborder="0"
></iframe>

Generate embed token

POST https://pulse.pcampus.co/embed/token
Authorization: Bearer <pip_api_key>
 
{
  "entityType": "customer",
  "entityId": "cust_xxx",
  "tenantId": "your-tenant-id",
  "expiresIn": 3600
}

Response:

{
  "embedToken": "emb_xxx",
  "expiresAt": "2026-07-16T12:00:00.000Z"
}

Endpoints

GET /v1/stories

List recent stories สำหรับ tenant

GET https://pulse.pcampus.co/v1/stories?entityType=customer&limit=20
Authorization: Bearer <pip_api_key>
x-tenant-id: your-tenant-id

Query params:

ParamTypeDescription
entityTypestringcustomer | order | product
limitnumberMax results (default 20, max 100)
cursorstringPagination cursor
segmentstringfilter by Intelligence segment (e.g. at_risk)

GET /v1/stories/search

ค้นหา story ด้วย identity (ชื่อ / เบอร์ / email / orderId)

GET https://pulse.pcampus.co/v1/stories/search?q=สมชาย&tenantId=pharmacy-demo
Authorization: Bearer <pip_api_key>

Response:

{
  "results": [
    {
      "entityType": "customer",
      "entityId": "cust_001",
      "displayName": "สมชาย จันทร์ดี",
      "storyUrl": "/v1/stories/customer/cust_001",
      "segment": "loyal",
      "lastEventAt": "2026-07-15T10:00:00.000Z"
    }
  ]
}

GET /v1/stories/:entityType/:entityId

ดู story เต็มของ entity — delegates ไป PBCP Story API

GET https://pulse.pcampus.co/v1/stories/customer/cust_001
Authorization: Bearer <pip_api_key>
x-tenant-id: your-tenant-id

Response shape เหมือนกับ PBCP Story API + Intelligence layer


Configuration

GET /v1/config

ดู Pulse configuration สำหรับ tenant

GET https://pulse.pcampus.co/v1/config
Authorization: Bearer <pip_api_key>
x-tenant-id: your-tenant-id

Response:

{
  "tenantId": "pharmacy-demo",
  "domain": "pharmacy",
  "defaultView": "story",
  "enabledStoryTypes": ["customer", "order", "product"],
  "developerModeEnabled": true,
  "theme": { "primaryColor": "#2563eb" }
}

PATCH /v1/config

PATCH https://pulse.pcampus.co/v1/config
Authorization: Bearer <pip_api_key>
x-tenant-id: your-tenant-id
 
{
  "defaultView": "story",
  "developerModeEnabled": false,
  "enabledStoryTypes": ["customer", "order"]
}

PBCP Story API → · Intelligence API →

Pulse API

Base URL: https://pulse.pcampus.co

Pulse is the Business Story Explorer built on top of the PBCP Story API — developers can embed the Pulse widget or fetch Story data to display in their own UI.

Note: Story data can also be fetched directly from the PBCP Story API and Intelligence API — Pulse is a reference UI that consumes those same APIs.


Embed Widget

Embed a Pulse Story view into your business admin UI via iframe:

<iframe
  src="https://pulse.pcampus.co/embed/customer/{customerId}?token={embedToken}"
  width="100%"
  height="600"
  frameborder="0"
></iframe>

Generate embed token

POST https://pulse.pcampus.co/embed/token
Authorization: Bearer <pip_api_key>
 
{
  "entityType": "customer",
  "entityId": "cust_xxx",
  "tenantId": "your-tenant-id",
  "expiresIn": 3600
}

Response:

{
  "embedToken": "emb_xxx",
  "expiresAt": "2026-07-16T12:00:00.000Z"
}

Endpoints

GET /v1/stories

List recent stories for the tenant.

GET https://pulse.pcampus.co/v1/stories?entityType=customer&limit=20
Authorization: Bearer <pip_api_key>
x-tenant-id: your-tenant-id

Query params:

ParamTypeDescription
entityTypestringcustomer | order | product
limitnumberMax results (default 20, max 100)
cursorstringPagination cursor
segmentstringFilter by Intelligence segment (e.g. at_risk)

GET /v1/stories/search

Search stories by identity (name / phone / email / orderId).

GET https://pulse.pcampus.co/v1/stories/search?q=สมชาย&tenantId=pharmacy-demo
Authorization: Bearer <pip_api_key>

Response:

{
  "results": [
    {
      "entityType": "customer",
      "entityId": "cust_001",
      "displayName": "สมชาย จันทร์ดี",
      "storyUrl": "/v1/stories/customer/cust_001",
      "segment": "loyal",
      "lastEventAt": "2026-07-15T10:00:00.000Z"
    }
  ]
}

GET /v1/stories/:entityType/:entityId

View the full story for an entity — delegates to the PBCP Story API.

GET https://pulse.pcampus.co/v1/stories/customer/cust_001
Authorization: Bearer <pip_api_key>
x-tenant-id: your-tenant-id

Response shape is identical to the PBCP Story API + Intelligence layer.


Configuration

GET /v1/config

View Pulse configuration for the tenant.

GET https://pulse.pcampus.co/v1/config
Authorization: Bearer <pip_api_key>
x-tenant-id: your-tenant-id

Response:

{
  "tenantId": "pharmacy-demo",
  "domain": "pharmacy",
  "defaultView": "story",
  "enabledStoryTypes": ["customer", "order", "product"],
  "developerModeEnabled": true,
  "theme": { "primaryColor": "#2563eb" }
}

PATCH /v1/config

PATCH https://pulse.pcampus.co/v1/config
Authorization: Bearer <pip_api_key>
x-tenant-id: your-tenant-id
 
{
  "defaultView": "story",
  "developerModeEnabled": false,
  "enabledStoryTypes": ["customer", "order"]
}

PBCP Story API → · Intelligence API →