Interactive Messages
For complete interactive messages documentation, check the Complete Messages Documentation.
Send Interactive Messages.
-
Interactive Button Messages
Send messages with interactive buttons:use ScriptDevelop\WhatsappManager\Facades\Whatsapp; use ScriptDevelop\WhatsappManager\Models\WhatsappBusinessAccount; use ScriptDevelop\WhatsappManager\Models\WhatsappPhoneNumber; $account = WhatsappBusinessAccount::first(); $phone = $account->phoneNumbers->first(); //EXAMPLE 1 $buttonResponse = Whatsapp::sendButtonMessage($phone->phone_number_id) ->to('57', '31371235638') ->withBody('Do you confirm your appointment for tomorrow at 3 PM?') ->addButton('confirm', 'β Confirm') ->addButton('reschedule', 'π Reschedule') ->withFooter('Please select an option') ->send(); //EXAMPLE 2 $buttonResponse = Whatsapp::sendButtonMessage($phone->phone_number_id) ->to('57', '31371235638') ->withBody('How would you rate our service?') ->addButton('excellent', 'βοΈβοΈβοΈβοΈβοΈ Excellent') ->addButton('good', 'βοΈβοΈβοΈβοΈ Good') ->addButton('regular', 'βοΈβοΈβοΈ Regular') ->withFooter('Your feedback helps us improve') ->send(); //EXAMPLE 3 // Get ID from a previous message (you must have a real one) $contextMessage = \ScriptDevelop\WhatsappManager\Models\Message::first(); $contextId = $contextMessage->wa_id; $buttonResponse = Whatsapp::sendButtonMessage($phone->phone_number_id) ->to('57', '31371235638') ->withBody('Select the type of support you need:') ->addButton('technical-support', 'π οΈ Technical Support') ->addButton('billing', 'π§Ύ Billing') ->addButton('complaints', 'π£ Complaints') ->withFooter('Office hours: M-F 8am-6pm') ->inReplyTo($contextId) // Here you specify the message you're replying to ->send(); // EXAMPLES WITH text HEADER $buttonResponse = Whatsapp::sendButtonMessage($phone->phone_number_id) ->to('57', '313714R3534') ->withHeader('Digital Catalog') ->withBody('Do you confirm your appointment for tomorrow at 3 PM?') ->addButton('confirm', 'β Confirm') ->addButton('reschedule', 'π Reschedule') ->withFooter('Please select an option') ->send(); // EXAMPLES WITH image HEADER $file = new \SplFileInfo(storage_path('app/public/laravel-whatsapp-manager.png')); $buttonResponse = Whatsapp::sendButtonMessage($phone->phone_number_id) ->to('57', '313714R3534') ->withHeader($file) ->withBody('Do you confirm your appointment for tomorrow at 3 PM?') ->addButton('confirm', 'β Confirm') ->addButton('reschedule', 'π Reschedule') ->withFooter('Please select an option') ->send(); -
Interactive Dropdown Lists
Send messages with interactive dropdown lists:use ScriptDevelop\WhatsappManager\Facades\Whatsapp; use ScriptDevelop\WhatsappManager\Models\WhatsappBusinessAccount; use ScriptDevelop\WhatsappManager\Models\WhatsappPhoneNumber; $account = WhatsappBusinessAccount::first(); $phone = $account->phoneNumbers->first(); // EXAMPLE 1 - WITHOUT CHAINING $listBuilder = Whatsapp::sendListMessage($phone->phone_number_id) ->to('57', '31371235638') ->withButtonText('View Products') ->withBody('Our featured products:') ->withHeader('Digital Catalog') ->withFooter('Swipe to see more options'); $listBuilder->startSection('Laptops') ->addRow('laptop-pro', 'MacBook Pro', '16" - 32GB RAM - 1TB SSD') ->addRow('laptop-air', 'MacBook Air', '13" - M2 Chip - 8GB RAM') ->endSection(); $listBuilder->startSection('Smartphones') ->addRow('iphone-15', 'iPhone 15 Pro', '48MP Camera - 5G') ->addRow('samsung-s23', 'Samsung S23', 'AMOLED Screen 120Hz') ->endSection(); $response = $listBuilder->send(); // EXAMPLE 2 - CHAINED $listBuilder = Whatsapp::sendListMessage($phone->phone_number_id) ->to('57', '31371235638') ->withButtonText('View Services') ->withBody('Select the service you want to schedule:') ->withFooter('Swipe to see all options') ->startSection('Haircuts') ->addRow('women-cut', 'Women Haircut', 'Professional style') ->addRow('men-cut', 'Men Haircut', 'Modern techniques') ->addRow('kids-cut', 'Kids Haircut', 'Children designs') ->endSection() ->startSection('Treatments') ->addRow('keratin', 'Keratin', 'Repairing treatment') ->addRow('coloring', 'Coloring', 'Professional dyes') ->addRow('mask', 'Mask', 'Deep hydration') ->endSection(); $response = $listBuilder->send(); // EXAMPLE 3 - reply to messages // Get ID from a previous message (you must have a real one) $contextMessage = \ScriptDevelop\WhatsappManager\Models\Message::first(); $contextId = $contextMessage->wa_id; $listBuilder = Whatsapp::sendListMessage($phone->phone_number_id) ->to('57', '31371235638') ->withButtonText('Select Service') ->withBody('For the type of appointment you mentioned, we have these options:') ->inReplyTo($contextId); // Here you specify the message you're replying to $listBuilder->startSection('Consultations') ->addRow('general-consultation', 'General Consultation', '30 min - $50.000') ->addRow('special-consultation', 'Specialized Consultation', '60 min - $90.000') ->endSection(); $listBuilder->startSection('Treatments') ->addRow('basic-treatment', 'Basic Treatment', 'Individual session') ->addRow('premium-treatment', 'Premium Treatment', 'Includes follow-up') ->endSection(); $response = $listBuilder->send(); // EXAMPLE WITH text HEADER $listBuilder = Whatsapp::sendListMessage($phone->phone_number_id) ->to('57', '313714R3534') ->withButtonText('View Products') ->withHeader('Digital Catalog') // TEXT HEADER ->withBody('Our featured products:') ->withFooter('Swipe to see more options') ->startSection('Laptops') ->addRow('laptop-pro', 'MacBook Pro', '16" - 32GB RAM - 1TB SSD') ->addRow('laptop-air', 'MacBook Air', '13" - M2 Chip - 8GB RAM') ->endSection() ->startSection('Smartphones') ->addRow('iphone-15', 'iPhone 15 Pro', '48MP Camera - 5G') ->addRow('samsung-s23', 'Samsung S23', 'AMOLED Screen 120Hz') ->endSection() ->send(); -
Interactive Call-to-Action URL Button Messages
Send interactive call-to-action URL button messages:use ScriptDevelop\WhatsappManager\Facades\Whatsapp; use ScriptDevelop\WhatsappManager\Models\WhatsappPhoneNumber; $phone = WhatsappPhoneNumber::first(); // Basic example Whatsapp::sendCtaUrlMessage($phone->phone_number_id) ->to('57', '31371235638') ->withBody('Visit our new online store!') ->withButton('View Store', 'https://store.example.com') ->send(); // Example with header and footer Whatsapp::sendCtaUrlMessage($phone->phone_number_id) ->to('57', '31371235638') ->withHeader('Special Offer') ->withBody('20% discount on all products') ->withButton('View Offer', 'https://store.example.com/offers') ->withFooter('Valid until end of month') ->send(); // Example with multimedia header "You must use a public image link for Image, Video, Document" $imageUrl = 'https://play-lh.googleusercontent.com/1-hPxafOxdYpYZEOKzNIkSP43HXCNftVJVttoo4ucl7rsMASXW3Xr6GlXURCubE1tA=w3840-h2160-rw'; Whatsapp::sendCtaUrlMessage($phone->phone_number_id) ->to('57', '31371235638') ->withHeader($imageUrl) ->withBody('New collection available!') ->withButton('View Collection', 'https://store.example.com/new-collection') ->send(); // Example as reply to another message $contextMessage = \ScriptDevelop\WhatsappManager\Models\Message::first(); $contextId = $contextMessage->wa_id; Whatsapp::sendCtaUrlMessage($phone->phone_number_id) ->to('57', '31371235638') ->withBody('Here is the link you requested:') ->withButton('Download Document', 'https://example.com/document.pdf') ->inReplyTo($contextId) ->send(); -
Interactive Location Request Button Messages
Send messages with location request button:Whatsapp::sendLocationRequestMessage($phone->phone_number_id) ->to('57', '31371235638') ->withBody('Please share your location to help you better') ->send();
Send Product Messages.
-
Single Product Message
Send simple product message.use ScriptDevelop\WhatsappManager\Facades\Whatsapp; use ScriptDevelop\WhatsappManager\Models\WhatsappBusinessAccount; use ScriptDevelop\WhatsappManager\Models\WhatsappPhoneNumber; $account = WhatsappBusinessAccount::first(); $phone = $account->phoneNumbers->first(); $productId = 'PROD-12345'; // Product ID in your catalog // Send a single product with descriptive text WhatsappManager::message()->sendSingleProductMessage( $phone->phone_number_id, '52', // Country code (Mexico) '5512345678', // Destination number $productId, 'Check out this amazing product we have for you!' ); -
Multiple Products Message
Send multiple products message.use ScriptDevelop\WhatsappManager\Facades\Whatsapp; use ScriptDevelop\WhatsappManager\Models\WhatsappBusinessAccount; use ScriptDevelop\WhatsappManager\Models\WhatsappPhoneNumber; use ScriptDevelop\WhatsappManager\Services\CatalogProductBuilder; $account = WhatsappBusinessAccount::first(); $phone = $account->phoneNumbers->first(); $builder = new CatalogProductBuilder( WhatsappManager::getDispatcher(), $phone->phone_number_id, ); $builder->to('52', '5512345678') ->withBody('Recommended products for you:') ->withHeader('Special Offers') ->withFooter('Valid until June 30th') // Section 1 ->startSection('Featured Products') ->addProduct('PROD-12345') ->addProduct('PROD-67890') ->endSection() // Section 2 ->startSection('New Releases') ->addProduct('PROD-54321') ->addProduct('PROD-09876') ->endSection() ->send(); -
Full Catalog Message
Send full catalog message.use ScriptDevelop\WhatsappManager\Facades\Whatsapp; use ScriptDevelop\WhatsappManager\Models\WhatsappBusinessAccount; use ScriptDevelop\WhatsappManager\Models\WhatsappPhoneNumber; use ScriptDevelop\WhatsappManager\Services\CatalogProductBuilder; $account = WhatsappBusinessAccount::first(); $phone = $account->phoneNumbers->first(); WhatsappManager::message()->sendFullCatalogMessage( $phone->phone_number_id, '52', '5512345678', 'View Catalog', // Button text 'Explore our complete product catalog', 'Send us a message for more information!' // Footer ); -
Product Message as Reply
Send simple product message with reply or context.use ScriptDevelop\WhatsappManager\Facades\Whatsapp; use ScriptDevelop\WhatsappManager\Models\WhatsappBusinessAccount; use ScriptDevelop\WhatsappManager\Models\WhatsappPhoneNumber; use ScriptDevelop\WhatsappManager\Services\CatalogProductBuilder; $account = WhatsappBusinessAccount::first(); $phone = $account->phoneNumbers->first(); // Reply to a specific message with a product $contextMessageId = 'wamid.XXXXXX'; // Original message ID WhatsappManager::message()->sendSingleProductMessage( $phone->phone_number_id, '52', '5512345678', 'PROD-12345', 'This is the product you mentioned:', $contextMessageId ); -
Interactive Message with Products (Advanced)
Send advanced interactive product messages with reply or context.use ScriptDevelop\WhatsappManager\Facades\Whatsapp; use ScriptDevelop\WhatsappManager\Models\WhatsappBusinessAccount; use ScriptDevelop\WhatsappManager\Models\WhatsappPhoneNumber; use ScriptDevelop\WhatsappManager\Services\CatalogProductBuilder; $account = WhatsappBusinessAccount::first(); $phone = $account->phoneNumbers->first(); WhatsappManager::message()->sendMultiProductMessage( $phone->phone_number_id, '52', '5512345678', [ [ 'title' => 'Offers', 'product_items' => [ ['product_retailer_id' => 'PROD-123'], ['product_retailer_id' => 'PROD-456'] ] ], [ 'title' => 'New', 'product_items' => [ ['product_retailer_id' => 'PROD-789'] ] ] ], 'These products might interest you!', 'Special Discounts', // Header null, // Footer $contextMessageId // Reply to message );