发送消息, webhook

dev/supplier-email-drawer
Lei OT 9 months ago
parent 9b4b7d666d
commit ba95206a7e

@ -23,9 +23,12 @@ exports.sendText = async ctx => {
}
// return wsToSend;
try {
const sockMsg = wsToSend.sendTextMessage(to, content);
const sockMsg = await wsToSend.sendTextMessage(to, content);
const {
key: { id },
} = sockMsg;
console.log(JSON.stringify(sockMsg, undefined, 2));
await upsertOutboundMessage(null, { ...ctx.request.body, id: sockMsg.key || sockMsg.id });
await upsertOutboundMessage(null, { ...ctx.request.body, id });
return 'Message sent successfully'; // { wsToSend, ret: 'Message sent successfully' };
} catch (error) {
console.error('Error sending message:', error);

Loading…
Cancel
Save