mirror of
https://github.com/EvolutionAPI/evolution-api.git
synced 2025-07-25 01:48:39 -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: {
|
properties: {
|
||||||
name: { type: 'string' },
|
name: { type: 'string' },
|
||||||
language: { type: 'string' },
|
language: { type: 'string' },
|
||||||
|
components: { type: 'array' },
|
||||||
},
|
},
|
||||||
required: ['name', 'language'],
|
required: ['name', 'language'],
|
||||||
...isNotEmpty('name', 'language'),
|
...isNotEmpty('name', 'language'),
|
||||||
|
@ -146,6 +146,7 @@ export class ContactMessage {
|
|||||||
export class TemplateMessage {
|
export class TemplateMessage {
|
||||||
name: string;
|
name: string;
|
||||||
language: string;
|
language: string;
|
||||||
|
components: any;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SendTemplateDto extends Metadata {
|
export class SendTemplateDto extends Metadata {
|
||||||
|
@ -685,6 +685,7 @@ export class BusinessStartupService extends WAStartupService {
|
|||||||
language: {
|
language: {
|
||||||
code: message['template']['language'] || 'en_US',
|
code: message['template']['language'] || 'en_US',
|
||||||
},
|
},
|
||||||
|
components: message['template']['components'],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
quoted ? (content.context = { message_id: quoted.id }) : content;
|
quoted ? (content.context = { message_id: quoted.id }) : content;
|
||||||
@ -693,6 +694,8 @@ export class BusinessStartupService extends WAStartupService {
|
|||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
console.log(messageSent);
|
||||||
|
|
||||||
const messageRaw: MessageRaw = {
|
const messageRaw: MessageRaw = {
|
||||||
key: { fromMe: true, id: messageSent?.messages[0]?.id, remoteJid: this.createJid(number) },
|
key: { fromMe: true, id: messageSent?.messages[0]?.id, remoteJid: this.createJid(number) },
|
||||||
//pushName: messageSent.pushName,
|
//pushName: messageSent.pushName,
|
||||||
@ -722,6 +725,7 @@ export class BusinessStartupService extends WAStartupService {
|
|||||||
return messageRaw;
|
return messageRaw;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.logger.error(error);
|
this.logger.error(error);
|
||||||
|
console.log(error.data);
|
||||||
throw new BadRequestException(error.toString());
|
throw new BadRequestException(error.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -921,6 +925,7 @@ export class BusinessStartupService extends WAStartupService {
|
|||||||
template: {
|
template: {
|
||||||
name: data.templateMessage.name,
|
name: data.templateMessage.name,
|
||||||
language: data.templateMessage.language,
|
language: data.templateMessage.language,
|
||||||
|
components: data.templateMessage.components,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
data?.options,
|
data?.options,
|
||||||
|
Loading…
Reference in New Issue
Block a user