Closed JaimeCasillasBluu closed 3 days ago
@JaimeCasillasBluu, Currently, this cannot be done in AI Studio. I have raised this with the team there, and they are working on a solution. For now, you will have to create a new application and assign a different phone number.
How do I
I want to send this template from a bot that is in AI Studio, to send the vonage object I need the private key, but when I get the private key from the AI Studio bot application this is deactivated, how can I send a template and the message comes out of the same number and using the same AI STUDIO bot application?
API/Product
Accounts
Code Sample
require('dotenv').config({ path: '/Users/jaime/Documents/Bluu/templateFoto/.env' });
const VONAGE_API_KEY = process.env.VONAGE_API_KEY; const VONAGE_API_SECRET = process.env.VONAGE_API_SECRET; const VONAGE_APPLICATION_ID = process.env.VONAGE_APPLICATION_ID; const VONAGE_PRIVATE_KEY = process.env.VONAGE_PRIVATE_KEY;
const TO_NUMBER = process.env.TO_NUMBER; const WHATSAPP_NUMBER = process.env.WHATSAPP_NUMBER; const WHATSAPP_TEMPLATE_NAME = process.env.WHATSAPP_TEMPLATE_NAME; const IMAGE_URL = process.env.IMAGE_URL;
const { Vonage } = require('@vonage/server-sdk'); const { WhatsAppCustom } = require('@vonage/messages');
const vonage = new Vonage({ apiKey: VONAGE_API_KEY, apiSecret: VONAGE_API_SECRET, applicationId: VONAGE_APPLICATION_ID, privateKey: VONAGE_PRIVATE_KEY, });
vonage.messages.send( new WhatsAppCustom({ custom: { type: 'template', template: { name:
${WHATSAPP_TEMPLATE_NAME}
, language: { policy: 'deterministic', code: 'es_MX' }, components: [ { type: 'header', parameters: [ { type: 'image', image: { link:${IMAGE_URL}
} } ] } ] } }, to: TO_NUMBER, from: WHATSAPP_NUMBER, }), ) .then(resp => console.log(resp.message_uuid)) .catch(err => console.error(err));