Overview
The Send Message module provides a complete set of methods for sending different types of content, managing message interactions, and controlling chat status indicators through WhatsApp. These methods allow you to create rich, interactive messaging experiences for your users.
Content Types
Send various types of content to engage your audience with multimedia and interactive elements.
Text Messages
Send simple text messages to your contacts.
use CrunchzApp\ CrunchzApp ;
CrunchzApp :: channel ()
-> contact ( '[email protected] ' )
-> text (
message : 'This is a message from you'
)
-> send ();
Parameter Type Required Description message string Yes The text content of the message contact string Yes The WhatsApp contact ID in the format ‘[email protected] ’
Text messages support markdown formatting for bold , italic , strikethrough, and code blocks.
Image Messages
Share images with optional captions.
use CrunchzApp\ CrunchzApp ;
CrunchzApp :: channel ()
-> contact ( '[email protected] ' )
-> image (
caption : 'Check out this image!' ,
mimeType : 'image/png' ,
filename : 'image.png' ,
url : 'https://raw.githubusercontent.com/CrunchzApp/asset-example/main/examples/logo.png'
)
-> send ();
Parameter Type Required Description url string Yes The URL of the image to send caption string No Optional text caption for the image mimeType string No The MIME type of the image (default: auto-detected) filename string No Custom filename for the image
Supported image formats include JPG, PNG, and WebP. Maximum file size is 16MB.
Location Messages
Share geographic locations with your contacts.
use CrunchzApp\ CrunchzApp ;
CrunchzApp :: channel ()
-> contact ( '[email protected] ' )
-> location (
latitude : '-6.142157673038987' ,
longitude : '106.19428522218833' ,
title : 'CrunchzApp HQ'
)
-> send ();
Parameter Type Required Description latitude string Yes Latitude coordinate longitude string Yes Longitude coordinate title string No Name or description of the location
Voice Messages
Send voice or audio recordings.
use CrunchzApp\ CrunchzApp ;
CrunchzApp :: channel ()
-> contact ( '[email protected] ' )
-> voice (
audioUrl : 'https://github.com/CrunchzApp/asset-example/raw/main/examples/julie-voice.opus'
)
-> send ();
Parameter Type Required Description audioUrl string Yes URL of the audio file
Supported audio formats include MP3, OGG, and OPUS. For voice messages, OPUS format is recommended for best quality and compression.
Video Messages
Share videos with optional captions.
use CrunchzApp\ CrunchzApp ;
CrunchzApp :: channel ()
-> contact ( '[email protected] ' )
-> video (
videoUrl : 'https://github.com/CrunchzApp/asset-example/raw/main/examples/video.mp4' ,
caption : 'Check out this video'
)
-> send ();
Parameter Type Required Description videoUrl string Yes URL of the video file caption string No Optional text caption for the video
Supported video formats include MP4 and 3GP. Maximum file size is 16MB with a maximum duration of 3 minutes.
Polls
Create interactive polls to gather feedback from your contacts.
use CrunchzApp\ CrunchzApp ;
CrunchzApp :: channel ()
-> contact ( '[email protected] ' )
-> polling (
title : 'Survey about iPhone 16' ,
options : [ 'Expensive' , 'Cheap' , 'Can buy it' ],
isMultipleAnswer : false ,
)
-> send ();
Parameter Type Required Description title string Yes The question or title of the poll options array Yes Array of answer options (2-12 options) isMultipleAnswer boolean No Whether multiple options can be selected (default: false)
Message Management
Control and interact with messages after they’ve been sent.
React to Messages
Add emoji reactions to messages.
Parameter Type Required Description messageId string Yes ID of the message to react to reaction string Yes Emoji to use as reaction
To remove a reaction, set the reaction parameter to an empty string.
Star Messages
Mark important messages with a star for easy reference.
Parameter Type Required Description messageId string Yes ID of the message to star/unstar starred boolean Yes true to star, false to unstar
Delete Messages
Remove sent messages from the chat.
Parameter Type Required Description messageId string Yes ID of the message to delete
Messages can only be deleted within a limited time window after sending (typically 1 hour for everyone, or anytime for “delete for me”).
Mark Messages as Seen
Indicate that a message has been read.
Parameter Type Required Description messageId string Yes ID of the message to mark as seen
Chat Status
Control typing indicators to provide a more natural conversation experience.
Start Typing Indicator
Show the typing indicator to the recipient.
use CrunchzApp\ CrunchzApp ;
CrunchzApp :: channel ()
-> contact ( '[email protected] ' )
-> startTyping ()
-> send ();
The typing indicator automatically disappears after 25 seconds if not manually stopped.
Stop Typing Indicator
Hide the typing indicator.
use CrunchzApp\ CrunchzApp ;
CrunchzApp :: channel ()
-> contact ( '[email protected] ' )
-> stopTyping ()
-> send ();
Common Use Cases
Automated Customer Support
Use text messages for initial responses, rich media for tutorials, and polls for feedback collection.
Send text notifications with order status, location messages for delivery tracking, and image messages for product photos.
Create engaging campaigns with videos, polls for customer preferences, and typing indicators for a more human-like interaction.
Deliver lessons through a combination of text, images, videos, and voice messages, with polls to test understanding.
Error Handling