Migrate changes from other Metamigo repo

This commit is contained in:
Darren Clarke 2023-03-13 15:53:21 +00:00
parent 8669b09224
commit 27810142b3
11 changed files with 615 additions and 235 deletions

View file

@ -19,10 +19,13 @@ interface SignaldMessageTaskOptions {
message: IncomingMessagev1;
botId: string;
botPhoneNumber: string;
attachment: string;
filename: string;
mimetype: string;
}
const formatPayload = (opts: SignaldMessageTaskOptions): WebhookPayload => {
const { botId, botPhoneNumber, message } = opts;
const { botId, botPhoneNumber, message, attachment, filename, mimetype } = opts;
const { source, timestamp, data_message: dataMessage } = message;
const { number }: any = source;
@ -35,9 +38,9 @@ const formatPayload = (opts: SignaldMessageTaskOptions): WebhookPayload => {
message_id: `${botId}-${timestamp}`,
sent_at: `${timestamp}`,
message: body,
attachment: null,
filename: null,
mime_type: null,
attachment,
filename,
mime_type: mimetype,
};
};