Platform
Notify
Overview

Notification

Base URL: https://notification-api.pcampus.co

Overview

Notification is a centralized notification hub for every service in the Pcampus ecosystem. Instead of each service sending its own notifications, everything flows through a single Notification service — making it easy to manage templates, delivery, and analytics from one place.

Supported channels: Email, Push notifications, SMS, LINE

Who uses this

PersonaWhat They Do
Developer (internal service)Call the API to send notifications from Cockpit / Content OS
Developer (customer)Send notifications to their own users via the API
AdminManage templates, view delivery analytics
End userReceive notifications, manage notification preferences

Key features

  • Multi-channel delivery — Email, Push, SMS, LINE from a single API
  • Template management — Create templates with variable substitution ({{user.name}}, {{booking.date}})
  • Notification preferences — Users can choose which channels they want to receive notifications on
  • Delivery tracking — Track sent / delivered / opened / failed per notification
  • Retry & fallback — If SMS fails, automatically falls back to Email
  • Rate limiting — Prevent sending too many notifications to a single user

User stories

Internal service:

"When a payment succeeds, we need to notify the org admin immediately via Email"

→ POST /notifications/send — specify channel: email, templateId: payment-success, userId → send immediately

Developer (customer):

"I want to send a push notification to users in my app when a new order arrives"

→ Register application → create template → call the API to send push with payload

End user:

"I'd like to receive notifications via LINE instead of SMS"

→ Console → Notification Settings → select LINE → connect LINE account

How it works

Data model

Integration

  • PIP — Fetches user preferences and contact info (email, phone, LINE ID)
  • Mail — Uses the Mail service for email delivery (does not send email directly)
  • Other services — Receive events and send notifications according to templates

API overview

MethodEndpointDescription
POST/notifications/sendSend notification to user
POST/notifications/broadcastSend to multiple users
GET/notificationsList notification history
GET/notifications/:idGet delivery status
GET/templatesList templates
POST/templatesCreate template
PATCH/templates/:idUpdate template
DELETE/templates/:idDelete template
GET/preferences/:userIdGet user notification preferences
PATCH/preferences/:userIdUpdate preferences

Send notification payload

{
  "userId": "usr_xxxx",
  "templateId": "tmpl_xxxx",
  "channel": "email",
  "data": {
    "user": { "name": "Somchai" },
    "booking": { "id": "BK-001", "date": "2026-08-01" }
  }
}

LINE Flex Message Templates

LINE Flex Message is LINE's rich message format with JSON-defined layouts — supports card, carousel, image hero, button, and separator elements freely.

Notification supports the flex_message template type in addition to plain text. Variable slots use the same {{variableName}} syntax — the system substitutes values into the JSON before sending to LINE.

Template types

TypeFormatUse case
textPlain textGeneral notifications, OTP
flex_messageJSON Flex layoutProduct card, order summary, appointment reminder
image_mapImage with tap zonesPromotional banners
carouselSwipeable FlexMultiple products, multiple branches

Flex Message Template Example — Order Card

{
  "type": "flex",
  "altText": "ยืนยันคำสั่งซื้อ {{orderId}}",
  "contents": {
    "type": "bubble",
    "hero": {
      "type": "image",
      "url": "{{productImageUrl}}",
      "size": "full",
      "aspectRatio": "20:13",
      "aspectMode": "cover"
    },
    "body": {
      "type": "box",
      "layout": "vertical",
      "contents": [
        {
          "type": "text",
          "text": "สวัสดีครับ {{customerName}}",
          "weight": "bold",
          "size": "xl"
        },
        {
          "type": "text",
          "text": "คำสั่งซื้อ #{{orderId}} ได้รับแล้ว",
          "color": "#aaaaaa",
          "size": "sm"
        },
        {
          "type": "separator",
          "margin": "md"
        },
        {
          "type": "box",
          "layout": "vertical",
          "margin": "md",
          "contents": [
            {
              "type": "box",
              "layout": "horizontal",
              "contents": [
                { "type": "text", "text": "{{productName}}", "size": "sm", "flex": 3 },
                { "type": "text", "text": "{{total}}", "size": "sm", "align": "end" }
              ]
            }
          ]
        }
      ]
    },
    "footer": {
      "type": "box",
      "layout": "vertical",
      "contents": [
        {
          "type": "button",
          "style": "primary",
          "action": {
            "type": "uri",
            "label": "ดูรายละเอียด",
            "uri": "{{orderDetailUrl}}"
          }
        }
      ]
    }
  }
}

Variable slots in this example: customerName, orderId, productImageUrl, productName, total, orderDetailUrl

Flex Message Builder (Console)

In Pcampus Console → Notification → Templates → New Template → select Flex Message:

Steps:

  1. Choose a starting layout — Bubble, Carousel, Image Hero, Receipt
  2. Edit blocks — click a block to change text, color, size, button URL
  3. Insert variables — type {{ to autocomplete variables suggested from the Customer Story
  4. Preview — view on the LINE emulator for both Android / iOS
  5. Save and Test send — send a test to a real LINE account before publishing

The builder in Console uses the same LINE Flex Message Simulator as LINE Official — the generated JSON can be copied directly into the Flex Message Simulator (opens in a new tab) for testing.

Carousel template

Carousel is a collection of swipeable bubbles, ideal for multi-product, multi-branch use cases:

{
  "type": "flex",
  "altText": "สินค้าแนะนำสำหรับคุณ {{customerName}}",
  "contents": {
    "type": "carousel",
    "contents": [
      "{{#each recommendations}}",
      {
        "type": "bubble",
        "body": {
          "type": "box",
          "layout": "vertical",
          "contents": [
            { "type": "text", "text": "{{this.name}}", "weight": "bold" },
            { "type": "text", "text": "{{this.price}}", "color": "#1DB446" }
          ]
        }
      },
      "{{/each}}"
    ]
  }
}

{{#each recommendations}} / {{/each}} is the loop syntax for array variables — supported in Flex Message templates only


Broadcast Scheduler

The Notification Scheduler manages scheduled broadcasts across all channels (LINE, Push, SMS) — viewable and creatable from a single calendar view.

Console → Notification → Scheduler

Calendar view

Shows all scheduled broadcasts from every channel in a single calendar, filterable by channel / segment / status:

┌─────────────────────────────────────────────────────────────┐
│  📅  Notification Scheduler — กรกฎาคม 2026                 │
│  [+ New Broadcast]   [All Channels ▼]   [List] [Calendar]  │
├──────────┬──────────┬──────────┬──────────┬────────────────┤
│  จ 14    │  อ 15    │  พ 16    │  พฤ 17   │  ศ 18           │
├──────────┼──────────┼──────────┼──────────┼────────────────┤
│          │ 09:00    │ 14:00    │ 10:00    │                │
│          │ 📱 LINE  │ 🔔 Push  │ 📱 LINE  │                │
│          │ Winback  │ Flash    │ Loyalty  │                │
│          │ 3,241 คน │ 8,002 คน │ 1,532 คน │                │
│          │          │ Sale     │ Tier Up  │                │
└──────────┴──────────┴──────────┴──────────┴────────────────┘

Create a Scheduled Broadcast

  1. + New Broadcast → select channel: LINE | Push | SMS
  2. Choose a template — text or Flex Message
  3. Define recipients — segment, subscriber list, or customer ID list
  4. Set schedule — date + time, or recurrence (daily / weekly / monthly)
  5. Set rate limit — messages per minute, to prevent burst traffic
  6. Confirm → appears on the calendar immediately; editable / cancellable up to 5 minutes before send

Recurrence patterns

PatternCronExample use
Every day 08:000 8 * * *Daily order reminder
Every Monday0 9 * * 1Weekly loyalty summary
1st of every month0 10 1 * *Monthly points digest
Every Friday afternoon0 14 * * 5Flash sale LINE

Delivery window

Set a delivery window to avoid disturbing customers outside business hours:

{
  "deliveryWindow": {
    "start": "08:00",
    "end": "21:00",
    "timezone": "Asia/Bangkok",
    "skipWeekends": false
  }
}

If a broadcast triggers outside the window, the system will hold it and send when the next window begins.

See Notification API → Scheduler for REST endpoints