More Whatsapp Docker updates

This commit is contained in:
Darren Clarke 2024-05-17 09:20:00 +02:00
parent 3da103c010
commit e26e5832ff
8 changed files with 63 additions and 21 deletions

View file

@ -95,12 +95,12 @@ export class Service {
{ params: { service, token } }: ServiceParams,
): Promise<NextResponse> {
console.log("INTO receiveMessage");
const message = await req.json();
console.log({ message });
const json = await req.json();
console.log({ json });
const worker = await getWorkerUtils();
await worker.addJob(`${service}/receive-${service}-message`, {
token,
message,
...json,
});
return NextResponse.json({ response: "ok" });

View file

@ -22,14 +22,14 @@ export class Whatsapp extends Service {
.where("id", "=", id)
.execute();
revalidatePath(`/whatsapp/${id}`);
if (!json.verified) {
const url = `${process.env.BRIDGE_WHATSAPP_URL}/api/bots/${id}/register`;
const result = await fetch(url, { method: "POST", cache: "no-store" });
const result = await fetch(url, { method: "POST" });
console.log({ result2: result });
}
revalidatePath(`/whatsapp/${id}`);
return NextResponse.json(json);
}
}