fix whatsapp api
This commit is contained in:
@@ -31,7 +31,6 @@ export class WhatsAppController extends Controller {
|
|||||||
|
|
||||||
async webhook(req: Request, res: Response) {
|
async webhook(req: Request, res: Response) {
|
||||||
const body = req.body as WhatsAppWebhookPayload;
|
const body = req.body as WhatsAppWebhookPayload;
|
||||||
console.log(JSON.stringify(body, null, 2));
|
|
||||||
const messageText = body.entry[0].changes[0].value.messages[0].text.body;
|
const messageText = body.entry[0].changes[0].value.messages[0].text.body;
|
||||||
|
|
||||||
const sessionCode = messageText
|
const sessionCode = messageText
|
||||||
@@ -62,15 +61,13 @@ export class WhatsAppController extends Controller {
|
|||||||
salutation = "malam";
|
salutation = "malam";
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(this.whatsAppService);
|
|
||||||
|
|
||||||
await this.whatsAppService.sendMessage(
|
await this.whatsAppService.sendMessage(
|
||||||
body.entry[0].changes[0].value.messages[0].from,
|
body.entry[0].changes[0].value.messages[0].from,
|
||||||
`Selamat ${salutation},
|
`Selamat ${salutation},
|
||||||
Anda akan terhubung dengan mitra kami untuk konsultasi.
|
Anda akan terhubung dengan mitra kami untuk konsultasi.
|
||||||
|
|
||||||
Saudara ${"Adam Akmal Madani"}
|
Saudara ${partner.name}
|
||||||
Nomor: ${"085218606125"}
|
Nomor: ${partner.whatsapp}
|
||||||
|
|
||||||
Terima kasih.`,
|
Terima kasih.`,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user