mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-12-19 03:42:23 -06:00
chore: Add ignoreJid feature to typebot and improve comparison
Adds a new feature to the typebot integration that allows ignoring specific remote JIDs. Also improves the comparison functionality. The main changes are in the typebot controller, DTO, route, and service. Additionally, the WhatsApp Business Service and event configuration files have been updated. The main files modified are: - typebot.controller.ts - typebot.dto.ts - typebot.router.ts - typebot.service.ts - typebot.schema.ts - whatsapp.business.service.ts - event.config.ts
This commit is contained in:
@@ -2,7 +2,7 @@ import axios from 'axios';
|
||||
import { arrayUnique, isURL } from 'class-validator';
|
||||
import EventEmitter2 from 'eventemitter2';
|
||||
import FormData from 'form-data';
|
||||
import fs from 'fs/promises';
|
||||
import { createReadStream } from 'fs';
|
||||
import { getMIMEType } from 'node-mime-types';
|
||||
|
||||
import { Chatwoot, ConfigService, Database, Typebot, WaBusiness } from '../../../config/env.config';
|
||||
@@ -885,12 +885,19 @@ export class BusinessStartupService extends ChannelStartupService {
|
||||
private async getIdMedia(mediaMessage: any) {
|
||||
const formData = new FormData();
|
||||
|
||||
const fileBuffer = await fs.readFile(mediaMessage.media);
|
||||
const fileStream = createReadStream(mediaMessage.media);
|
||||
|
||||
const fileBlob = new Blob([fileBuffer], { type: mediaMessage.mimetype });
|
||||
formData.append('file', fileBlob);
|
||||
formData.append('file', fileStream, { filename: 'media', contentType: mediaMessage.mimetype });
|
||||
formData.append('typeFile', mediaMessage.mimetype);
|
||||
formData.append('messaging_product', 'whatsapp');
|
||||
|
||||
// const fileBuffer = await fs.readFile(mediaMessage.media);
|
||||
|
||||
// const fileBlob = new Blob([fileBuffer], { type: mediaMessage.mimetype });
|
||||
// formData.append('file', fileBlob);
|
||||
// formData.append('typeFile', mediaMessage.mimetype);
|
||||
// formData.append('messaging_product', 'whatsapp');
|
||||
|
||||
const headers = { Authorization: `Bearer ${this.token}` };
|
||||
const res = await axios.post(
|
||||
process.env.API_URL + '/' + process.env.VERSION + '/' + this.number + '/media',
|
||||
|
||||
Reference in New Issue
Block a user