botman / driver-facebook

BotMan Facebook Messenger Driver
MIT License
71 stars 73 forks source link

I can't attach PDF files to a reply #125

Open dimar7 opened 6 months ago

dimar7 commented 6 months ago

Description:

this is the code:

<?php
use BotMan\BotMan\BotMan;
use BotMan\BotMan\Messages\Outgoing\OutgoingMessage;
use BotMan\BotMan\Messages\Attachments\File;

$botman = resolve('botman');

$botman->hears('Send PDF', function ($bot) {

    $attachment = new File('/pdf/example1.pdf', [
        'custom_payload' => true,
    ]);
    $message = OutgoingMessage::create('This is your PDF')
    ->withAttachment($attachment);
    $bot->reply($message);

});

It shows the message "This is your PDF" but without attachment, I tried with the full url, but doesn't work either. The pdf folder is located in the public folder. I'm using Facebook Driver.