0

I have created an account and add Twilio sandbox number for WhatsApp. After following instructions (To begin testing, connect to your sandbox by sending a WhatsApp message from your device to +1 415 523 **** with code join doubt-pupil. ) I have received a file in my WhatsApp number.

Code (PHP - Laravel):

 $sid = config('app.TWILIO_SID'); 
        $token      = config('app.TWILIO_AUTH_TOKEN');
        $twilio     = new Client($sid, $token); 
        $message    = $twilio->messages ->create("whatsapp:+9199740*****",
                   array(       
                       "body" => "AlQuran4Life_invoice_".$invoice->formonth."",
                       "mediaUrl" => ["PDFURL"],
                       "from" => "whatsapp:+1415523*****", 
                   ) 
        );

After that I have added balance on Twilio. Now I want to make it live to send invoice to WhatsApp number. What credentials I need to update? Or which phone number do I need to update?

Adriaan
  • 17,741
  • 7
  • 42
  • 75
Javed
  • 817
  • 4
  • 22
  • 44
  • I'd love to help here, but I'm not entirely sure what you're asking. Are you trying to send a message via the WhatsApp API or are you trying to receive incoming messages from WhatsApp? What happens when you run the code you shared? – philnash Jun 02 '21 at 05:52
  • @philnash I am trying to send pdf file on WhatsApp number through twilio number which is one way only. User cannot reply back. Using sandbox configuration its working fine. Now on production I want to send pdf file but twilio support team said that to receive a pdf file user need to start session which is only for 24hours. – Javed Jun 02 '21 at 09:41
  • 2
    Ah, yes, those are the current WhatsApp rules. You can’t currently send an attachment in a template message. See [the docs on sending media messages](https://www.twilio.com/docs/whatsapp/tutorial/send-and-receive-media-messages-twilio-api-whatsapp) and the docs on [sending notifications with templates](https://www.twilio.com/docs/whatsapp/tutorial/send-whatsapp-notification-messages-templates) for more information. – philnash Jun 02 '21 at 09:59
  • Any other platform where we can send documents directly ? – Javed Jun 02 '21 at 10:09
  • 1
    You can do it directly through WhatsApp, but I don’t personally know of another platform that allows media in template messages yet. (Disclaimer: I work for Twilio) – philnash Jun 02 '21 at 10:14

0 Answers0