mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-22 20:12:02 -06:00
feat: whatsapp cloud api components in template
This commit is contained in:
parent
9ef14d11f8
commit
ab89ef8db3
@ -288,6 +288,7 @@ export const templateMessageSchema: JSONSchema7 = {
|
||||
properties: {
|
||||
name: { type: 'string' },
|
||||
language: { type: 'string' },
|
||||
components: { type: 'array' },
|
||||
},
|
||||
required: ['name', 'language'],
|
||||
...isNotEmpty('name', 'language'),
|
||||
|
@ -146,6 +146,7 @@ export class ContactMessage {
|
||||
export class TemplateMessage {
|
||||
name: string;
|
||||
language: string;
|
||||
components: any;
|
||||
}
|
||||
|
||||
export class SendTemplateDto extends Metadata {
|
||||
|
@ -685,6 +685,7 @@ export class BusinessStartupService extends WAStartupService {
|
||||
language: {
|
||||
code: message['template']['language'] || 'en_US',
|
||||
},
|
||||
components: message['template']['components'],
|
||||
},
|
||||
};
|
||||
quoted ? (content.context = { message_id: quoted.id }) : content;
|
||||
@ -693,6 +694,8 @@ export class BusinessStartupService extends WAStartupService {
|
||||
}
|
||||
})();
|
||||
|
||||
console.log(messageSent);
|
||||
|
||||
const messageRaw: MessageRaw = {
|
||||
key: { fromMe: true, id: messageSent?.messages[0]?.id, remoteJid: this.createJid(number) },
|
||||
//pushName: messageSent.pushName,
|
||||
@ -722,6 +725,7 @@ export class BusinessStartupService extends WAStartupService {
|
||||
return messageRaw;
|
||||
} catch (error) {
|
||||
this.logger.error(error);
|
||||
console.log(error.data);
|
||||
throw new BadRequestException(error.toString());
|
||||
}
|
||||
}
|
||||
@ -921,6 +925,7 @@ export class BusinessStartupService extends WAStartupService {
|
||||
template: {
|
||||
name: data.templateMessage.name,
|
||||
language: data.templateMessage.language,
|
||||
components: data.templateMessage.components,
|
||||
},
|
||||
},
|
||||
data?.options,
|
||||
|
Loading…
Reference in New Issue
Block a user