whatsapp-api-nodejs
whatsapp-api-nodejs copied to clipboard
SendContact via php-cURL ERRO
- $curl = curl_init();
- curl_setopt_array($curl, array(
- CURLOPT_URL => 'localhost:3333/message/contact?key=123',
- CURLOPT_RETURNTRANSFER => true,
- CURLOPT_ENCODING => '',
- CURLOPT_MAXREDIRS => 10,
- CURLOPT_TIMEOUT => 0,
- CURLOPT_FOLLOWLOCATION => true,
- CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
- CURLOPT_CUSTOMREQUEST => 'POST',
- CURLOPT_POSTFIELDS =>'{
-
"id": "919999999999", /* number example */
-
"vcard": {
-
"fullName": "john doe",
-
"displayName": "johndoe",
-
"organization": "Men In Black",
-
"phoneNumber": "919999999999" /* number example */
-
}
- }',
- ));
- $response = curl_exec($curl);
- curl_close($curl);
- echo $response;
- ?>
- The error that is appearing to me, I believe it is something wrong in the vcard structure
- {"error":true,"code":500,"message":"TypeError: Cannot read properties of undefined (reading 'includes')"}
use x-www-form-urlencoded
CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ),
use this