Posts tagged with whatsapp

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 

I'm trying to implement a button that shares the current page on WhatsApp, there's no issue with using the link on phone but on desktop I can't send it to WhatsApp web or open WhatsApp web if it's not opened yet.

I was searching for long on Stack Overflow and other webpages as well on documentation, which I can't find (I only face Android documentation but not web documentation for it).

I referred to https://api.whatsapp.com nut no info can be found here. No info about WhatsApp share API here: https://developers.facebook.com/ neither on resuts from search share WhatsApp or sharing WhatsApp.

My approach is this line as I said someone posting here: How to implements whatsapp share button in website

<a href="https://api.whatsapp.com/send?text=this%20was%20amazing%20https%3A%2F%2Fwww.google.es%2F" target="_blank">Share to whatsapp</a> 

I bet that this function was moved to WhatsApp for business, are it?

OK I found this browsing on latest Google's result pages:

<a href="https://web.whatsapp.com/send?text=this%20was%20amazing%20https%3A%2F%2Fwww.google.es%2F" target="_blank">share to whatsapp web</a> 

This does not answer the question at all as it's supposed to work as a single button with detect and fallback (api.whatsapp I mean), but it can be a nice approach to show and hide one of these two options if the client is on desktop or in mobile.

If someone knows a different approach it could be nice.

Another issue/bug with this approach is that on desktop, it opens always a new web.whatsapp.com tab even if you've it opened before.

I guess whatsapp business api client is only used pre-selected company which whatsapp grant. So, i want to know my guessing is right or not.

According to official guide, i need to register phone number to whatsapp. I guess here exist whatsapp menu. but i can't see menu. (Sorry, i dont know the way website display english language)

Official guide mentions this. "If you cant see WhatsApp account option, you cant use Business API yet"

So i search how can i access Business API, and i can see this in WhatsApp FAQ.

Finally, according to below link, WhatsApp has granted to 90 pre-selected companies. https://medium.com/callbell/what-changes-with-the-release-of-the-whatsapp-business-apis-46994316b763

As a result, if i want to use whatsapp business api, i need to use service which is provided official whatsapp partner company like twilio.

Someone tell me that My result is right?