feat: implement Phase 1 LINE Message Integration (Order Created, Payment Confirmed, Shipped, Cancelled)
This commit is contained in:
1 parent
852d9c1925
commit
59363616c4
4 files changed
+630
-34
No files matched your search
@@ -37,7 +37,7 @@ const webhookHandler = async ({ request, body, set }: { request: Request, body:
|
||||
|
||||
try {
|
||||
const parsedBody = typeof body === 'string' ? JSON.parse(body) : body;
|
||||
const events: line.WebhookEvent[] = parsedBody.events || [];
|
||||
const events: line.webhook.Event[] = parsedBody.events || [];
|
||||
|
||||
for (const event of events) {
|
||||
if (event.type === 'message' && event.message.type === 'text') {
|
||||
@@ -48,7 +48,7 @@ const webhookHandler = async ({ request, body, set }: { request: Request, body:
|
||||
|
||||
// Simple echo bot for now
|
||||
await lineClient.replyMessage({
|
||||
replyToken: event.replyToken,
|
||||
replyToken: event.replyToken!,
|
||||
messages: [{
|
||||
type: 'text',
|
||||
text: `คุณส่งข้อความว่า: ${event.message.text}`
|
||||
|
||||
Reference in new issue
Block a user