Posts under category Facebook WhatsApp Business API

I am building a Node.js application that receives messages from WhatsApp via Twilio. Sending text messages is not a problem, but when I try to send the current location from the users WhatsApp account I cannot find the coordinates in the request object sent to the server.

This is what I am doing to see what is being sent to the app from Twilio.

app.post('/incoming', (req, res) => { var incomingMessage = req.body.Body; console.log(incomingMessage); }); 

When I share my current location with the app, the request body is empty.

Can anyone shed any light on this or explain how WhatsApp shares a users location within the app?

Thanks.

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 am trying to use whatsapp business api. But the problem is when I run docker-compose up I get the error Mysql not yet started. Though the wadebug tool shows everything correct. I am not able to hit any api eg GET https://localhost:9090/v1/settings/application I am getting connection refused in this request.enter image description here

I have also one more doubt.Am I hitting the right api or is there any different. In their documentation it is written your app hostname. Docker-compose ps shows 0.0.0.0:9000->443. So is it right?

Here is my docker-compose file:

   version: '3' volumes:   whatsappMedia:     driver: local   mysqlData:     driver: local services:   db:     image: mysql:5.7.22     restart: always     environment:       MYSQL_ROOT_PASSWORD: hello123       MYSQL_USER: root       MYSQL_PASSWORD: hello123     expose:         - "33060"     ports:         - "33060:3306"     volumes:      - mysqlData:/var/lib/mysql     network_mode: bridge   wacore:     image: docker.whatsapp.biz/coreapp:v${WA_API_VERSION:?Run docker-compose with env var WA_API_VERSION (ex. WA_API_VERSION=2.25.1 docker-compose <command> <options>)}     command: ["/opt/whatsapp/bin/wait_on_mysql.sh", "/opt/whatsapp/bin/launch_within_docker.sh"]     volumes:      - whatsappMedia:/usr/local/wamedia     env_file:       - db.env     environment:       # This is the version of the docker templates being used to run WhatsApp Business API       WA_RUNNING_ENV_VERSION: v2.2.3       ORCHESTRATION: DOCKER-COMPOSE     depends_on:       - "db"     network_mode: bridge     links:       - db   waweb:     image: docker.whatsapp.biz/web:v${WA_API_VERSION:?Run docker-compose with env var WA_API_VERSION (ex. WA_API_VERSION=2.25.1 docker-compose <command> <options>)}     command: ["/opt/whatsapp/bin/wait_on_mysql.sh", "/opt/whatsapp/bin/launch_within_docker.sh"]     ports:      - "9090:443"     volumes:      - whatsappMedia:/usr/local/wamedia     env_file:       - db.env     environment:       WACORE_HOSTNAME: wacore       # This is the version of the docker templates being used to run WhatsApp Business API       WA_RUNNING_ENV_VERSION: v2.2.3       ORCHESTRATION: DOCKER-COMPOSE     depends_on:       - "db"       - "wacore"     links:       - db       - wacore     network_mode: bridge