I'm having trouble in creating a WhatsApp Message template, using the WhatsApp Business API.

I already can send messages, delete template, etc.

Creating the message template is the only API implementation where I'm having some dificulties. This is the code that I'm using to create a template:


public static function CreateTemplate($templateName, $templateCat, $language, $components){     $businessaccountid = .....;     $token = ....;     $ch = curl_init();     $url = 'https://graph.facebook.com/v16.0/' . $businessaccountid . '/message_templates?allow_category_change=true&name=' . $templateName . '&category=' . $templateCat . '&language=' . $language . '&components=' . $components;     //echo($url);     //curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);     //curl_setopt($ch, CURLOPT_VERBOSE , TRUE);     curl_setopt($ch, CURLOPT_URL, $url);     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);     curl_setopt($ch, CURLOPT_POST, 1);     $headers = array();          $headers[] = 'Authorization: Bearer ' . $token ;     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);               $result = curl_exec($ch);          if ($result === false) {         $result = curl_error($ch) . " - ".curl_errno($ch);              }else{         $resultDecode = json_decode($result);         if($resultDecode!=null){             $result = $resultDecode;         }         return($result);     }     curl_close($ch);      } 


And this is the content of the $url variable that is being used:

"https://graph.facebook.com/v16.0/....../message_templates?allow_category_change=true&name=compra_terminada&category=MARKETING&language=pt_PT&components=[{"type":"BODY","text":"Obrigado por comprar na nossa loja. Assim que o objecto for expedido, irá receber no seu email o numero de rastreamento da encomenda."},{"type":"FOOTER","text":"A minha empresa"}]" 

And this is error that it's returning from curl_error and curl_errno:

HTTP/2 stream 0 was not closed cleanly: Unknown error code (err 5) - 92 

I've already tried to use CURL_HTTP_VERSION_1_1 but with no success. The curl_exec($ch) returns a generic html page from Facebook saying:

Sorry, something went wrong. We're working on it and we'll get it fixed as soon as we can. 

What do I need to change in my code to create a WhatsApp Template Message?

I have Google Ads Campaigns with the following tracking template: {lpurl}/{loc_physical_ms}.

I have clicked on one of my live ads, but the /{loc_physical_ms} did not appear in the URL.

Is there a configuration I may be missing - or do I not understand the point of this ValueTrack parameter? My landing pages are already programmed to consume the ID from {loc_physical_ms} and generate localized content, but the parameter doesn't seem to do anything.

I have a working WhatsApp Business API Project however I am facing a weird problem the Webhook URL that I provided in the Facebook Developers app is getting triggered automatically even without a message being sent.

Here is how is the flow of my Application:

1- The user sends the Message on WhatsApp Number 2- A Firebase Function is triggered which generates the reply 3- The user gets the reply back

This is working fine, however, if the user sends the message, it sends back the reply.

However, I see that the user is still able to get the reply back even without sending the message on the WhatsApp Business API Number.

During the development, I made a mistake when I deployed the code which had an error and maybe that is why it is in a loop to send back the same message.

Right now I am solving this problem by deleting the Facebook Developers App and recreating it again and changing the App Id, and Token again since I don't see any option to stop this.

I am sending the audio file from a WhatsApp voice message (WhatsApp business cloud API) to google speech to text recognition. The very weird thing is that it works for voice messages sent from a windows whatsapp client. So having the official WhatsApp windows WhatsApp program send a voice message does work. But it does not work when sending the voice message from an android whatsapp app. So there seems to be different encoding for the voice audio file. Both have Opus Audio codec and both have sample rate of 48000 Hz. Both files can be played with VLC, but the android file is much smaller Any help or ideas on that?

Not sure if that info helps: The working audio file from windows whatsapp desktop has bits per sample 32. The not working one from android has no information about bits per sample. Also the not working file is much smaller.