SocialHub.AI
แหล่งข้อมูล · ศูนย์นักพัฒนา

Web Push

เข้าถึงสมาชิกในเบราว์เซอร์บน Web Push Protocol แบบเปิด — ไม่มีแอป ไม่มีผู้ให้บริการบุคคลที่สามที่ชำระเงิน ไม่มีค่าธรรมเนียมต่อข้อความ Flash สร้างคีย์ VAPID ของพื้นที่ทำงานโดยอัตโนมัติเมื่อเปิดใช้งาน สมาชิกสมัครสมาชิกจากพอร์ทัล และทุกข้อความจะถูกเข้ารหัสไปยังคีย์ของการสมัครสมาชิกของตัวเอง

วิธีการทำงาน

มาตรฐานเปิด ไม่มีผู้ให้บริการ

Web push ทำงานบน Web Push Protocol ของเบราว์เซอร์ผ่านบริการพุชของเบราว์เซอร์แต่ละตัว ไม่มีผู้จำหน่ายพุชบุคคลที่สามที่ชำระเงินและไม่มีค่าธรรมเนียมต่อข้อความ

คีย์ VAPID สร้างขึ้นโดยอัตโนมัติ

เมื่อเปิดใช้งานครั้งแรก Flash จะสร้างคีย์เซิร์ฟเวอร์แอปพลิเคชัน VAPID ของพื้นที่ทำงานให้คุณ โดยไม่มีอะไรให้สร้าง วาง หรือหมุนด้วยมือ

สมัครสมาชิกโดยริเริ่มโดยสมาชิก

สมาชิกสมัครเป็นสมาชิกจากหน้าความเป็นส่วนตัวของพอร์ทัล ข้อความแจ้งการอนุญาตของเบราว์เซอร์จะเปิดประตู — ไม่มีการอนุญาต ไม่มีการสมัครสมาชิก

การเข้ารหัสต่อการสมัครสมาชิก

เพย์โหลดของพุชแต่ละรายการจะถูกเข้ารหัสด้วยคีย์ของสมาชิกแต่ละราย (การเข้ารหัสข้อความ RFC 8291) ดังนั้นเฉพาะเบราว์เซอร์ของสมาชิกรายนั้นเท่านั้นที่สามารถอ่านได้

เปิดใช้งาน (ผู้ดูแลระบบ)

ผู้ดูแลระบบเปิดใช้งานการแจ้งเตือนแบบพุชบนเว็บสำหรับพื้นที่ทำงาน ไม่จำเป็นต้องสร้างคีย์ใดๆ Flash จะสร้างคู่คีย์เซิร์ฟเวอร์แอปพลิเคชัน VAPID เมื่อเปิดใช้งานครั้งแรก

// Admin enables web push for the workspace in Settings → Web Push.
// On first enable, Flash GENERATES the VAPID application-server keypair automatically —
// you don't create or paste keys. You set a contact email and can fire a test send.
//
//   Settings → Web Push:
//     • Enable web push            (OFF by default, per workspace)
//     • Contact email              (identifies the sender to the browser push services)
//     • Send test notification     (verify the end-to-end path)
//
// The public VAPID application server key is what the member's browser uses when it
// creates a push subscription (below).

ขั้นตอนการสมัครสมาชิก

เบราว์เซอร์ของสมาชิกสร้างการสมัครสมาชิกด้วยคีย์ VAPID สาธารณะของพื้นที่ทำงาน พอร์ทัลโพสต์ไปที่ Flash ดูคำแนะนำ การฝังพอร์ทัลสมาชิก สำหรับเซสชันผู้บริโภคที่ลงชื่อเข้าใช้ซึ่งขึ้นอยู่กับ

// Members subscribe THEMSELVES from the member portal privacy page. The web-push card
// only renders when (a) the browser supports the Push API AND (b) the workspace enabled
// web push. Tapping it triggers the browser's native permission prompt.
//
//   1. Portal registers a service worker.
//   2. Browser creates a PushSubscription using the workspace's public VAPID key
//      (Notification.requestPermission() → pushManager.subscribe(...)).
//   3. The portal posts that subscription (endpoint + p256dh + auth keys) to Flash:
POST https://flash.socialhub.ai/api/member/web-push
Content-Type: application/json

{
  "endpoint": "<browser push service endpoint>",
  "keys": { "p256dh": "<client public key>", "auth": "<client auth secret>" }
}
// → 200  { data: { ok: true } }
//   GET  https://flash.socialhub.ai/api/member/web-push   → the workspace public key + whether web push is on
//   DELETE https://flash.socialhub.ai/api/member/web-push  { "endpoint": "..." }  → unsubscribe
//   The member identity comes from the signed-in member session — never the body.

การส่ง: ช่องทาง ไม่ใช่การโทร API

// You do NOT call a "send web push" endpoint directly. Web push is a CHANNEL in the
// same send/automation stack as email and app push. When a campaign or journey targets
// a subscribed member:
//
//   • Flash encrypts the payload to that member's subscription keys (RFC 8291) and
//     hands it to the member's own browser push service for delivery.
//   • Subscriptions that the push service reports as gone/expired are pruned
//     automatically, so you don't keep sending into dead endpoints.

ดีใจที่ได้รู้

ใช้งานได้กับเบราว์เซอร์สมัยใหม่ที่รองรับ Push API และพนักงานบริการ พอร์ทัลเสนอเฉพาะการ์ดการเลือกเข้าร่วมที่เบราว์เซอร์รองรับ ดังนั้นสมาชิกจะไม่แสดงช่องทางที่เบราว์เซอร์ของพวกเขาไม่สามารถใช้งานได้

ปิดใช้งานโดยค่าเริ่มต้นและต่อพื้นที่ทำงาน: จะไม่มีการส่งข้อมูลใดๆ จนกว่าผู้ดูแลระบบจะเปิดใช้งานและสมาชิกเลือกเข้าร่วมผ่านเบราว์เซอร์ของตน

คีย์การสมัครสมาชิกจัดทำโดยเบราว์เซอร์ของสมาชิก Flash จัดเก็บไว้เพื่อเข้ารหัสแต่ละข้อความและจะไม่แชร์ข้ามพื้นที่ทำงาน

ที่เกี่ยวข้อง: การพุชแอป · การฝังพอร์ทัลสมาชิก · การปฏิบัติตามข้อกำหนดและความยินยอม API

กำลังเดินสายการพุชเว็บ?

พูดคุยกับวิศวกรเกี่ยวกับขั้นตอนการสมัครสมาชิกของพนักงานบริการ + VAPID, สแตกช่องทางการส่ง หรือการเข้ารหัสข้อความต่อการสมัคร

คุยกับวิศวะ