Posts tagged with whatsapp

I've created a Meta app and got a Whatsapp test number. I can write to it and it is send to the webhook fine. But I'd like to add that number to a group so others can send messages to it as well, without necessarily needing to add that weird number.

When trying to do so it says that Business number can't be added to a group.

Is there something I can do? Am I forced to add my own number to the app and convert it to a Business number?

I'd rather not, I'd like to keep mine personal

I am trying to send a WhatsApp template message using Postman. I am receiving a successful response with a WhatsApp ID, but the message is not being received by the recipient (which is myself for testing purposes).

Here are the details of my request:

  • Method: POST
  • URL: [Your WhatsApp API endpoint]
  • Headers:
    • Authorization: [Your authorization token]
    • Content-Type: application/json
  • Body:
  {     "to": "recipient_number",     "template": {       "name": "your_template_name",       "language": {         "code": "en",         "policy": "deterministic"       },       "components": [         {           "type": "BODY",           "text": "Hello, this is a test message."         }       ]     }   } 

I have checked the following:

  1. The recipient number is correct and includes the country code.
  2. The template message format complies with WhatsApp's guidelines.
  3. I am using a WhatsApp Business Account and have the necessary permissions.
  4. The template has been approved by WhatsApp.
  5. The API endpoint and request format are correct.

Despite these checks, the message is not being delivered. I would appreciate any insights.

I'm implementing a whatsapp like chat using whatsapp business api.

There is the 24 hours rule where, in order to send a message to a whatsapp number, you need to send an approved template first. Afterwards, as soon as the user reply, the business account can send free form messages for the next 24 hours.

When a free form message is sent, the api returns this type of json:

{   "messaging_product": "whatsapp",   "contacts": [     {       "input": "<WHATSAPP_USER_PHONE_NUMBER>",       "wa_id": "<WHATSAPP_USER_ID>"     }   ],   "messages": [     {       "id": "<WHATSAPP_MESSAGE_ID>"     }   ] } 

However, this json does not guarantee that the message was delivered if sent outside of 24 hours. This json is always returned whether the conversation is open or not, and this doesn't help much.

So do you know if there is an api call that can tell me if the conversation is still open with the user?

When sending messages through the cloud Whatsapp Business API, is there a way to send custom fields that will be returned in the webhook notification?

Apart from saving the ID received in the response when sending the message, I could not find a way to connect between the sent message and the returned webhook.

I'm having issues trying to download media files from the WhatsApp Business API. Following along with their documentation (https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#download-media) they provide a cURL command that is successful in downloading a media file when used - however, the same request (I think) when done using NodeJS' fetch returns text/html responses with vague error wording and a 200 status code.

# Successful cURL: curl "https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=281274211304477&ext=1705672414&hash=ATtH6AOGFu0RqEpENicHUg8HCUkVfwGzfrHVCdiE7J8AUA" --header "Authorization: Bearer ..." 
// Successful cURL from child_process.exec: exec(   `curl --location "${mediaURL}" --header "Authorization: Bearer ..."` ); 
// Unsuccessful fetch: fetch(   "https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=281274211304477&ext=1705672414&hash=ATtH6AOGFu0RqEpENicHUg8HCUkVfwGzfrHVCdiE7J8AUA",   { headers: { Authorization: "Bearer ..." } } ); 

Suggestion from WhatsApp Cloud API Receiving Images from Users Error is also unsuccessful, unfortunately:

// Also unsuccessful fetch: fetch("https://lookaside.fbsbx.com/whatsapp_business/attachments/?mid=281274211304477&ext=1705672414&hash=ATtH6AOGFu0RqEpENicHUg8HCUkVfwGzfrHVCdiE7J8AUA", {   headers: {     Authorization: "Bearer ...",     "User-Agent": "curl/7.64.1",   }, }) 

Note: The lookaside.fbsbx.com URLs are all retrieved successfully from the WhatsApp Business APIs.

Per the documentation, a 404 error should occur if the link has expired, however, this isn't the case - and the access token hasn't expired either. Looking through the Community Forums, specifically https://developers.facebook.com/community/threads/1367000994138329/?join_id=f25971b6b4f9cc4, many conversations suggest that the User-Agent header should be spoofed - yet this doesn't seem to work either, although tweaking the User-Agent header within Postman yields varying results.

Successful in Postman:

Unsuccessful when User-Agent is adjusted in Postman:

Unsuccessful when User-Agent is removed in Postman:

Any suggestions would be greatly appreciated. I was unable to use the Meta for Developers' "Report a bug" forms as support appears to be unavailable for WhatsApp Business APIs.

Also seen posts: 1, 2 on StackOverflow; 1, 2, 3, 4, 5, 6 on Meta Support Forums.