Posts tagged with node.js

I'm sending the PDF document to WhatsApp number, which is been successfully sent to the user but the title of the document is getting displayed as Untitled.

WhatsApp Business API version we are using is v2.21.6. I've referred to the documentation of WhatsApp Business API where it explains how one should send the document with ID or link. Documentation link https://developers.facebook.com/docs/whatsapp/api/messages/media

This is my file object to send the file to WhatsApp Number,

const fileDetails = {         mime_type: 'application/pdf',         id: uploadFile.media[0].id(media id),         filename: fileName[3]( file name which we have to show)       }; 

and below is helper function to send the message,

function getMessageByContentType(contentType,   link,   id = '',   filename = '',   caption = '') {   const contentTypeMessageMapper = {     audio: {       type: 'audio',       audio: {         id,       },     },     document: {       type: 'document',       document: {         id,         filename,         caption,       },     },     video: {       type: 'video',       video: {         link,       },     },     image: {       type: 'image',       image: {         id,         link,       },     },   };  //Method to send document to user WhatsApp mobile number  yield whatsAppMessage.sendWhatsappMediaMessageToUser(     bot,     userId, //Mobile number     fileDetails //File object.   );     //POST request     {   "method": "POST",   "json": true,   "headers": {     "content-type": "application/json",     "Authorization": "Auth Token"   },   "body": {     "type": "document",     "document": {       "id": "a0706671-4fe7-49b0-8d1b-bcfb2fc5f7e8",       "filename": "fileName.pdf",       "caption": ""     },     "recipient_type": "individual",     "to": "Mobile Number"   },   "uri": "https://WhatsApp-Business-API-URL/v1/messages",   "rejectUnauthorized": false } 

After uploading binary file to WhatsApp Business API, we are using the ID to send the file to the customer which is getting uploaded successfully without any error message but the filename is coming as "Untitled" and not taking filename from the file object.

I'm setting up a new connection between whatsapp and zendesk to support better Cust.service experience. The actual goal is to be able to sendout automated response through whatsapp that is triggered from salesforce, but I'm quite new to this and have limited knowledge about whatsapp API.

In our facebook business manager, I have created the Account API WhatsApp Business and also connected the phone number to the API whatsapp business, but the next step is confusing me, which I need to register the app using /v1/account node account. I dont understand this part.

further step is "Request a Registration Code" Send the telephone number and vname certificate string encoded in your base64 to request the registration code. You can request to receive your code via SMS or voice call.

Use endpoint / v1 / account to request your registration code.

POST /v1/account

{ "cc": "your-country-code", "phone_number": "your- phone-number-without-country-code", "method": "sms" | "voice", "cert": "your-verified-name-cert-in-base64", "pin": "your-existing-6-digit-pin" # required if two-factor verification is enabled }

I expect to have whatsapp template that can be used by our registered phone number and set up auto response, then later we can create trigger in salesforce using something (which I still dont know)