Skip to main content

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.
  • Basic Usage
  • Parameters
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
    ->contact('[email protected]')
    ->text(
        message: 'This is a message from you'
    )
    ->send();
Text messages support markdown formatting for bold, italic, strikethrough, and code blocks.

Image Messages

Share images with optional captions.
  • Basic Usage
  • Parameters
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();
Supported image formats include JPG, PNG, and WebP. Maximum file size is 16MB.

Location Messages

Share geographic locations with your contacts.
  • Basic Usage
  • Parameters
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
    ->contact('[email protected]')
    ->location(
        latitude: '-6.142157673038987',
        longitude: '106.19428522218833',
        title: 'CrunchzApp HQ'
    )
    ->send();

Voice Messages

Send voice or audio recordings.
  • Basic Usage
  • Parameters
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
    ->contact('[email protected]')
    ->voice(
        audioUrl: 'https://github.com/CrunchzApp/asset-example/raw/main/examples/julie-voice.opus'
    )
    ->send();
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.
  • Basic Usage
  • Parameters
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();
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.
  • Basic Usage
  • Parameters
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
    ->contact('[email protected]')
    ->polling(
        title: 'Survey about iPhone 16',
        options: ['Expensive', 'Cheap', 'Can buy it'],
        isMultipleAnswer: false,
    )
    ->send();

Message Management

Control and interact with messages after they’ve been sent.

React to Messages

Add emoji reactions to messages.
  • Basic Usage
  • Parameters
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
    ->contact('[email protected]')
    ->react(
        messageId: '[email protected]_xxx',
        reaction: '😍'
    )
    ->send();
To remove a reaction, set the reaction parameter to an empty string.

Star Messages

Mark important messages with a star for easy reference.
  • Basic Usage
  • Parameters
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
    ->contact('[email protected]')
    ->star(
        messageId: '[email protected]_xxx',
        starred: true
    )
    ->send();

Delete Messages

Remove sent messages from the chat.
  • Basic Usage
  • Parameters
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
    ->contact('[email protected]')
    ->delete(
        messageId: '[email protected]_xxx'
    )
    ->send();
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.
  • Basic Usage
  • Parameters
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
    ->contact('[email protected]')
    ->seen(
        messageId: '[email protected]_xxx'
    )
    ->send();

Chat Status

Control typing indicators to provide a more natural conversation experience.

Start Typing Indicator

Show the typing indicator to the recipient.
  • Basic Usage
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.
  • Basic Usage
use CrunchzApp\CrunchzApp;

CrunchzApp::channel()
    ->contact('[email protected]')
    ->stopTyping()
    ->send();

Common Use Cases

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

  • Invalid Contact
  • Media Upload Failed
  • Message Not Found
{
  "success": false,
  "message": "Invalid contact ID or contact not found",
  "error_code": "INVALID_CONTACT"
}