Overview
InjectWhatsapp with Inject<Whatsapp> in a handler, listener, job or command. Every method sends one request to your instance and returns the HTTP client’s Response. Non-2xx answers come back as errors.
Chat IDs are the phone number with country code and no +, followed by @c.us, for example [email protected]. Group chat IDs end in @g.us. What is a chat ID?
Text
safe_send_text sends the same message, but Hypersender shows typing and waits a moment first, so the message looks typed by a person. Use it for messages to people who haven’t written to you recently. (learn more)
Images, files, video and voice
Each media type has a URL method and an upload method. Upload methods take a LaravelAttachment.
as_note: true sends the video as a round video note.
Send a PDF invoice with its own file name:
Attachment::from_data(bytes, "name.pdf"), or attach it inside the request handler. Laravel deletes temporary uploads once the request ends, so don’t pass an upload to a queued job.
Location
Poll
PollVote events. See WhatsApp webhooks.
Read the response
get_queued_request.
Next steps
Chats and contacts
Seen, typing, reactions, deletes, contact checks and any other endpoint.
WhatsApp webhooks
Receive messages and reply.