whatsapp-api-nodejs icon indicating copy to clipboard operation
whatsapp-api-nodejs copied to clipboard

SendContact via php-cURL ERRO

Open higormachado3 opened this issue 2 years ago • 2 comments

  • $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')"}

higormachado3 avatar Oct 02 '22 04:10 higormachado3

use x-www-form-urlencoded

salman0ansari avatar Oct 06 '22 07:10 salman0ansari

CURLOPT_HTTPHEADER => array( 'Content-Type: application/json' ),

use this

sairmali avatar Oct 09 '22 12:10 sairmali