Closed Ahmad0811 closed 8 months ago
I have the same issue , and I followed the documentation with no luck
I made it work using
const { WhatsAppCustom } = require('@vonage/messages');
and then add this to message.send function
new WhatsAppCustom(
{
clientRef: 'TemplateName',
from: 'SenderPhoneNumber',
to: 'ReciverPhoneNumber',
custom: {
type: 'template',
template: {
namespace: 'TemplateNameSpace:',
name: 'TemplateName',
language: {
policy: 'deterministic',
code: 'en',
},
components: [
{
type: 'body',
parameters: [
{
type: 'text',
text: '12345',
},
],
},
{
type: 'button',
sub_type: 'url',
index: '0',
parameters: [
{
type: 'text',
text: '12345',
},
],
},
],
},
},
},
),
Hi @Ahmad0811 the second example you posted is correct. With the Messages API, the template
message type of the whatsapp
channel (which is the WhatsAppTemplate
object in the Node SDK) is only for sending static templates. For interactive templates (which includes Authentication templates) you need to use the custom
message type (which is the WhatsAppCustom
object in the Node SDK).
I agree that the documentation could be improved around this, and I'm currently working on doing that. I did recently add a Code Snippet example for sending an Authentication Template, but it's currently only in cURL (I still need to add the other language variants).
I'm going to close this issue since it is an issue with the documentation and not the SDK.
Im trying to send whatsapp auth message using WhatsAppTemplate which attaching one param and it returns missing params always in the webhook. also there is no clear documentation for how to send a message