tambahan
This commit is contained in:
@@ -29,6 +29,8 @@ async function sendReplyMessage(to: string, message: string, phoneNumberId: stri
|
||||
}
|
||||
|
||||
|
||||
const allowedTypeMessage = ["text"]
|
||||
|
||||
const WaHookRoute = new Elysia({
|
||||
prefix: "/wa-hook",
|
||||
tags: ["WhatsApp Hook"],
|
||||
@@ -165,15 +167,16 @@ const WaHookRoute = new Elysia({
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
const count = await prisma.waHook.count()
|
||||
const result = list.map((item) => ({
|
||||
id: item.id,
|
||||
data: item.data as WAHookMessage,
|
||||
createdAt: item.createdAt,
|
||||
}))
|
||||
|
||||
const filterData = result.filter((item) => allowedTypeMessage.includes(item.data?.entry?.[0]?.changes?.[0]?.value?.messages?.[0]?.type || ""))
|
||||
return {
|
||||
list: result,
|
||||
list: filterData,
|
||||
count: Math.ceil(count / (query.limit || 10)),
|
||||
};
|
||||
}, {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
type TYPE = "image" | "video" | "audio" | "file" | "text" | "sticker" | "document"
|
||||
type TYPE_MESSAGE = "image" | "video" | "audio" | "file" | "text" | "sticker" | "document"
|
||||
const message = {
|
||||
"object": "whatsapp_business_account",
|
||||
"entry": [
|
||||
@@ -28,7 +28,7 @@ const message = {
|
||||
"text": {
|
||||
"body": "halo"
|
||||
},
|
||||
"type": "text" as TYPE
|
||||
"type": "text" as TYPE_MESSAGE
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user