# Check Phone Number Source: https://docs.crunchz.app/api-reference/channel/check-phone GET /channel/check-phone-number Verify if a phone number is registered on WhatsApp before sending messages to improve delivery success rates. # Channel Health Source: https://docs.crunchz.app/api-reference/channel/health GET /channel/health Check the health and connectivity status of your WhatsApp channel to ensure optimal message delivery performance. # All Chat Source: https://docs.crunchz.app/api-reference/chat/all GET /chat Retrieve a paginated list of all chat conversations in your WhatsApp channel with metadata and recent activity timestamps. # Archive Chat Source: https://docs.crunchz.app/api-reference/chat/archive POST /chat/archive Archive a chat conversation to organize your chat list while preserving the message history for future access. # Chat Detail Source: https://docs.crunchz.app/api-reference/chat/details GET /chat/detail Get detailed message history and information for a specific chat conversation using the contact ID. # Un-Archive Chat Source: https://docs.crunchz.app/api-reference/chat/un-archive POST /chat/un-archive Restore a previously archived chat conversation back to your active chat list for continued interaction. # All Contact Source: https://docs.crunchz.app/api-reference/contact/all GET /contact Retrieve a paginated list of all registered contacts in your WhatsApp account with basic contact information. # Contact Detail Source: https://docs.crunchz.app/api-reference/contact/detail GET /contact/info Get detailed information about a specific contact including name, status, phone number, and metadata. # Contact Picture Source: https://docs.crunchz.app/api-reference/contact/picture GET /contact/info Get detailed information about a specific contact including name, status, phone number, and metadata. # Add Participants Source: https://docs.crunchz.app/api-reference/group/add_participant POST /groups/participants/add Add new members to an existing WhatsApp group by providing the group ID and participant phone numbers. # All Group Source: https://docs.crunchz.app/api-reference/group/all GET /groups Retrieve a paginated list of all WhatsApp groups associated with your account, including group names, IDs, and metadata. # Create Group Source: https://docs.crunchz.app/api-reference/group/create POST /groups/create Create a new WhatsApp group programmatically by specifying the group name and initial participants. # Group Invitation Code Source: https://docs.crunchz.app/api-reference/group/invitation_code GET /groups/invitation-code Generate an invitation code for a specific WhatsApp group to share access with new members. # Group Invitation Code (Renew) Source: https://docs.crunchz.app/api-reference/group/invitation_code_renew GET /groups/invitation-code/renew Generate a new invitation code for a WhatsApp group while revoking the previous one for enhanced security. # Group Participants Source: https://docs.crunchz.app/api-reference/group/participant GET /groups/participants Retrieve a list of all participants in a specific WhatsApp group using the group ID. # Remove Participants Source: https://docs.crunchz.app/api-reference/group/remove_participant POST /groups/participants/remove Remove members from a WhatsApp group using the group ID and participant phone numbers. Requires superadmin privileges. # Introduction Source: https://docs.crunchz.app/api-reference/introduction Example section for showcasing API endpoints If you're not looking to build API reference documentation, you can delete this section by removing the api-reference folder. ## Welcome There are two ways to build API documentation: [OpenAPI](https://mintlify.com/docs/api-playground/openapi/setup) and [MDX components](https://mintlify.com/docs/api-playground/mdx/configuration). For the starter kit, we are using the following OpenAPI specification. View the OpenAPI specification file ## Authentication All API endpoints are authenticated using Bearer tokens and picked up from the specification file. ```json "security": [ { "bearerAuth": [] } ] ``` # Delete Message Source: https://docs.crunchz.app/api-reference/messages/delete DELETE /send-message/delete Remove a specific message from a WhatsApp conversation for content moderation, error correction, or conversation cleanup. # Send Image Source: https://docs.crunchz.app/api-reference/messages/image POST /send-message/image Send image files to WhatsApp users with support for various formats and high-quality media delivery. # Send Location Source: https://docs.crunchz.app/api-reference/messages/location POST /send-message/location Share geographic location coordinates with WhatsApp users for delivery tracking, navigation, and location-based services. # Send Polling Source: https://docs.crunchz.app/api-reference/messages/poll POST /send-message/poll Create and send polls to WhatsApp users to gather feedback, conduct surveys, and make group decisions. # Send Pool Source: https://docs.crunchz.app/api-reference/messages/pools POST /send-message/pool Send multiple messages in a single request using a Global token for efficient batch messaging operations. # React to Message Source: https://docs.crunchz.app/api-reference/messages/react-message PUT /send-message/reaction React to WhatsApp messages with emojis for quick, expressive responses without sending full text messages. # Seen Message Source: https://docs.crunchz.app/api-reference/messages/seen POST /send-message/seen Mark messages as seen or read to track message engagement and confirm recipient viewing status. # Star a Message Source: https://docs.crunchz.app/api-reference/messages/star PUT /send-message/star Star important messages to mark them for easy access and efficient conversation management. # Start Typing Source: https://docs.crunchz.app/api-reference/messages/start-type POST /send-message/typing # Stop Typing Source: https://docs.crunchz.app/api-reference/messages/stop-type POST /send-message/stop-typing # Send Text Message Source: https://docs.crunchz.app/api-reference/messages/text POST /send-message/text Send plain text messages to WhatsApp users for basic communication, notifications, and automated messaging. # Send Video Source: https://docs.crunchz.app/api-reference/messages/video POST /send-message/video Send video content to WhatsApp users with support for various formats and rich media sharing capabilities. # Send Voice Source: https://docs.crunchz.app/api-reference/messages/voice POST /send-message/voice Send voice messages and audio clips to WhatsApp users for personal and dynamic communication experiences. # Request Code Source: https://docs.crunchz.app/api-reference/otpCode/request POST /otp/code/request Generate and send One-Time Password (OTP) codes with customizable validation settings for secure user authentication. # Validate OTP Source: https://docs.crunchz.app/api-reference/otpCode/validate POST /otp/code/validate Verify One-Time Passwords (OTPs) with comprehensive validation checks for secure authentication workflows and two-factor authentication systems. # Request - Code Source: https://docs.crunchz.app/api-reference/otpGlobal/request-code POST /otp/code/global Generate and send One-Time Password (OTP) codes globally across multiple channels with intelligent channel randomization for optimal delivery success. ## Overview This endpoint allows you to request a one-time password (OTP) code for global use. GLOBAL means the system will randomize the channel to send or receive the message from or to the user. This endpoint generates a One-Time Password (OTP) with customizable validation settings. ## Request Parameters The contact ID to send the OTP code to. Format: `xxx@c.us` Length of the OTP code. Maximum value is 6. Whether to include letters in the OTP code. Whether to include numbers in the OTP code. Whether to use uppercase letters for the OTP code. Application name that will be displayed to the user. Expiration time in seconds. For example, 1800 seconds (30 minutes). ## Response Indicates whether the request was successful. A message describing the result of the operation. The ID of the message. The OTP code sent to the phone. The chat ID. The message. The time when the code expires. The timestamp when it was triggered. ## Error Codes Authorization Exception - Occurs when the request is not properly authorized. Validation Exception - Occurs when the request parameters fail validation. # Request - Link Source: https://docs.crunchz.app/api-reference/otpGlobal/request-link POST /otp/link/global Generate authentication links globally with randomized channel selection for initiating WhatsApp chats and callback verification using Global Token. ## Overview This endpoint allows you to request a one-time password (OTP) link for global use. The OTP link can be used for authentication or verification purposes. ## Request Parameters The contact ID to send the OTP link to. Format: `xxx@c.us` Expiration time in seconds. For example, 1800 seconds (30 minutes). Application name that will be displayed to the user. Prompt message to channel from user. Example: "Give me link to login at TARGET App" Success message to user. Example: "Here is your login link bit.ly/any" Failed message to user. Example: "Login failed, please try again later." Message to user when the OTP has expired. Example: "The link has been expired, please try another one." Callback URL for successful verification (GET Method). Example: "[https://domain.com/callback/success](https://domain.com/callback/success)" Callback URL for failed verification (GET Method). Example: "[https://domain.com/callback/failed](https://domain.com/callback/failed)" ## Response Indicates whether the request was successful. A message describing the result of the operation. The ID of the message. The OTP code sent to the phone. The contact ID. The message link. The app URL (open). The time when the code expires. The timestamp when it was triggered. ## Error Codes Authorization Exception - Occurs when the request is not properly authorized. Validation Exception - Occurs when the request parameters fail validation. # Validate OTP - Code Source: https://docs.crunchz.app/api-reference/otpGlobal/validate POST /otp/code/validate Verify One-Time Passwords (OTPs) with comprehensive validation checks for secure authentication workflows and two-factor authentication systems. ## Overview This endpoint verifies OTPs generated by the "Request and Send OTP Code" endpoint. It allows you to validate whether the OTP code provided by a user matches the one that was sent. ## Request Parameters The contact ID that received the OTP code. Format: `xxx@c.us` The OTP code to validate. Example: "123456" ## Response Indicates whether the request was successful. A message describing the result of the operation. The ID of the message. The OTP code that was validated. The contact ID. Indicates whether the OTP code was successfully validated. The timestamp when the validation was triggered. ## Error Codes Authorization Exception - Occurs when the request is not properly authorized. Validation Exception - Occurs when the request parameters fail validation. # Request Link Source: https://docs.crunchz.app/api-reference/otpLink/request POST /otp/link/request Generate authentication links for initiating WhatsApp chats with callback verification for user validation and secure access control. # Introduction Source: https://docs.crunchz.app/index Learn what CrunchzApp API is, what it can do, and how to get started quickly. CrunchzApp Hero Light CrunchzApp Hero Dark # 👋 Welcome to the CrunchzApp API CrunchzApp helps businesses automate and scale their WhatsApp communication using their own WhatsApp numbers — with no need for third-party providers. This API is designed for developers who want full control, smart automation, and personalized messaging at scale. Get up and running with CrunchzApp API in minutes Explore the complete API documentation ## ⚙️ How It Works CrunchzApp connects directly to your WhatsApp number via a **Channel**. This gives you full control over your messaging without relying on third-party numbers. Once connected, you'll receive a secure token to authenticate your API requests: * A **Channel Token** (for one specific number) * A **Global Token** (for managing multiple numbers) No need to specify which token type — our API auto-detects it. Use our RESTful API to send messages, manage contacts, and automate responses. Our API supports JSON for request and response formats. Track delivery rates, engagement metrics, and automation performance through our dashboard or API endpoints. Jump into the [Setup Guide](../setup) or the [API Reference](../reference/overview) to send your first message in minutes. ## 💬 Need Help? Contact our team at [support@crunchz.app](mailto:support@crunchz.app) Browse our frequently asked questions Stay updated with our latest features *** Ready to transform your WhatsApp communication? [Sign up](https://panel.crunchz.app) for a free account today and get started with 7 days free trial!. Let's build something powerful with CrunchzApp. # Channel Source: https://docs.crunchz.app/packages/laravel/channel Methods for managing and interacting with communication channels ## Overview The Channel module provides functionality to manage communication channels, check their health status, verify phone numbers, and send messages. This module is essential for ensuring reliable communication with your users. ## Available Methods ### Health Check Use the `health()` method to verify if the communication channel is operational and functioning correctly. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->health(); ``` It's recommended to perform health checks regularly to ensure your communication channels are working properly. ### Phone Number Verification The `checkPhoneNumber()` method allows you to validate if a phone number exists and is properly formatted. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->checkPhoneNumber('628xxxxx'); ``` This performs a standard verification of the provided phone number. | Parameter | Type | Required | Description | | ----------- | ------- | -------- | ------------------------------------------------ | | phoneNumber | string | Yes | The phone number to verify (with country code) | | parallel | boolean | No | Whether to run in parallel mode (default: false) | ### Parallel Processing For more complex operations, you can use parallel processing to check phone numbers while performing other actions simultaneously. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->checkPhoneNumber('628xxxxx', true) ->startTyping() ->text('Hi there') ->stopTyping() ->send(); ``` When using parallel mode, make sure to call the `send()` method at the end to execute all queued operations. ## Common Use Cases Use the `checkPhoneNumber()` method during user registration to ensure valid phone numbers. Implement regular health checks in your application's monitoring system. Use parallel processing to create more engaging user experiences with typing indicators. # Chat Management Source: https://docs.crunchz.app/packages/laravel/chat Methods for managing and interacting with chats through communication channels ## Overview The Chat Management module provides functionality to retrieve, view, archive, and manage chats within your communication channels. These methods allow you to efficiently organize conversations and access chat history. ## Available Methods ### All Chat Retrieve a list of all chats with pagination support. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->allChat( limit: 12, offset: 1, ); ``` | Parameter | Type | Required | Description | | --------- | ------- | -------- | ---------------------------------------------------- | | limit | integer | No | Maximum number of chats to retrieve (default: 10) | | offset | integer | No | Number of chats to skip (for pagination, default: 0) | The `allChat` method returns chats sorted by most recent activity by default. ### Chat Details Retrieve detailed information about a specific chat with a contact. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->chatDetail(); ``` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ---------------------------------------------------------- | | contact | string | Yes | The contact ID in the format '[xxx@c.us](mailto:xxx@c.us)' | ### Archive Chat Archive a chat to organize your chat list and hide less active conversations. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->archiveChat(); ``` Archiving a chat doesn't delete any messages. It simply moves the chat to the archived section. ### Unarchive Chat Restore a previously archived chat to your active chat list. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->unArchiveChat(); ``` ## Common Use Cases Use the archive and unarchive features to keep your active chat list clean and focused on current conversations. Use the chat details method to display complete conversation history with a specific contact. Combine these methods to create a full-featured chat interface with pagination, archiving, and detailed views. # Contact Management Source: https://docs.crunchz.app/packages/laravel/contact Methods for retrieving and managing WhatsApp contacts in your application ## Overview The Contact Management module provides functionality to retrieve, view, and manage WhatsApp contacts within your application. These methods allow you to access contact information, view profile pictures, and maintain an up-to-date contact list for your messaging needs. ## Available Methods ### Retrieve All Contacts Get a complete list of all WhatsApp contacts available in your channel. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->allContact(); ``` ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->allContact( limit: 20, offset: 40 ); ``` The `allContact` method supports pagination to efficiently handle large contact lists. If not specified, default values are used (limit: 100, offset: 0). ### Get Contact Details Retrieve detailed information about a specific contact. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact( contactId: 'xxx@c.us' ) ->detail(); ``` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------------------------------------------------------------- | | contactId | string | Yes | The WhatsApp contact ID in the format '[xxx@c.us](mailto:xxx@c.us)' | Contact details may vary depending on privacy settings and whether the contact is in your address book. ### Get Contact Profile Picture Retrieve the profile picture of a specific contact. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact( contactId: 'xxx@c.us' ) ->picture(); ``` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------------------------------------------------------------- | | contactId | string | Yes | The WhatsApp contact ID in the format '[xxx@c.us](mailto:xxx@c.us)' | If a contact doesn't have a profile picture set, a default placeholder image URL may be returned. ## Common Use Cases Use the `allContact` method to create a searchable directory of all your WhatsApp contacts, complete with profile pictures and contact details. Before sending messages, use the `detail` method to verify that a contact exists and is available on WhatsApp. Retrieve contact details to personalize your messages with the recipient's name or other information. Enhance your chat interface by displaying contact profile pictures alongside messages. ## Error Handling ```json { "success": false, "message": "Contact not found", "error_code": "CONTACT_NOT_FOUND" } ``` ```json { "success": false, "message": "Invalid contact ID format", "error_code": "INVALID_CONTACT_ID" } ``` ```json { "success": false, "message": "Contact has no profile picture", "error_code": "NO_PROFILE_PICTURE" } ``` # Groups Source: https://docs.crunchz.app/packages/laravel/group Testing environment for CrunchzApp WhatsApp API with limited functionality #### All Group ``` use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->allGroup(); ``` #### Group Participant ``` use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->participants( groupId: 'xxxx@g.us' ); ``` # Installation Source: https://docs.crunchz.app/packages/laravel/installation Step-by-step guide for installing and configuring the CrunchzApp PHP SDK in your Laravel application. # Getting Started with CrunchzApp SDK This guide will walk you through the process of installing and configuring the CrunchzApp PHP SDK for your Laravel application. ## Requirements Before you begin, ensure your environment meets the following requirements: These requirements are essential for the proper functioning of the CrunchzApp SDK. * **PHP 7.3 or higher** - The SDK requires PHP 7.3+ for optimal performance and security * **Composer** - For package management and dependency resolution * **CrunchzApp account** - You'll need either a Channel Token or Global Token (available in your account) Not sure which token to use? Global tokens provide access to all channels, while Channel tokens are specific to individual channels. Choose based on your application's needs. ## Installation Follow these steps to install the SDK in your Laravel project: ### Step 1: Install via Composer Run the following command in your project directory: ```bash composer require crunchzapp/crunchzapp-php-sdk ``` After installation, you should see the package listed in your `composer.json` file. ## Configuration Setting up the SDK requires two main steps: ### Step 1: Publish Configuration Files Before initializing the package, publish the configuration file by running: ```bash php artisan vendor:publish --tag=crunchzapp-config ``` This step is required to make the SDK work properly with your Laravel application. ### Step 2: Configure Environment Variables Add your CrunchzApp token to your `.env` file: ```bash CRUNCHZAPP_TOKEN=your_token_here ``` 1. Log in to your CrunchzApp dashboard 2. Navigate to User Settings 3. Find either your Channel token or Global token 4. Copy and paste it into your `.env` file For security reasons, never commit your token to version control. Always use environment variables. ## Next Steps After completing the installation and configuration, you're ready to start using the CrunchzApp SDK in your Laravel application. Check out our API documentation for available methods and features. # OTP Code Source: https://docs.crunchz.app/packages/laravel/otp-code Secure one-time password authentication via WhatsApp ## Overview The OTP Code feature allows you to implement secure one-time password authentication through WhatsApp. This provides a familiar and secure way for users to verify their identity during login, registration, or sensitive operations. ## How It Works 1. Your application requests an OTP code to be sent to a user's WhatsApp 2. CrunchzApp generates a random code and delivers it via WhatsApp 3. The user enters this code in your application 4. Your application validates the code through the CrunchzApp API ## Available Methods ### Request Code Send a one-time password to a WhatsApp contact. ```php use CrunchzApp\CrunchzApp; CrunchzApp::otp('code') ->contact('xxx@c.us') ->send(); ``` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------------------------------------------------------------- | | contact | string | Yes | The WhatsApp contact ID in the format '[xxx@c.us](mailto:xxx@c.us)' | By default, OTP codes expire after 5 minutes. The user will receive a message containing the generated code. ### Validate Code Verify an OTP code entered by the user. ```php use CrunchzApp\CrunchzApp; CrunchzApp::otp('code') ->contact('xxx@c.us') ->validate('M9TQ'); ``` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------------------------------------------------------------- | | contact | string | Yes | The WhatsApp contact ID in the format '[xxx@c.us](mailto:xxx@c.us)' | | code | string | Yes | The OTP code entered by the user | OTP codes can only be validated once. After successful validation or expiration, a new code must be requested. ## Common Use Cases Verify a user's WhatsApp number during the registration process to ensure they have access to the number they're registering with. Add an extra layer of security by requiring OTP verification during login, especially for high-value accounts or after suspicious activity. Confirm sensitive operations like payments, transfers, or account changes with an OTP code sent via WhatsApp. ## Error Handling ```json { "success": false, "message": "Invalid OTP code", "error_code": "OTP_INVALID" } ``` ```json { "success": false, "message": "OTP code has expired", "error_code": "OTP_EXPIRED" } ``` ```json { "success": false, "message": "Too many failed attempts", "error_code": "OTP_MAX_ATTEMPTS" } ``` # OTP Link Source: https://docs.crunchz.app/packages/laravel/otp-link Secure verification through WhatsApp with clickable links ## Overview The OTP Link feature provides a secure verification method by sending clickable links via WhatsApp. Unlike traditional OTP codes, this approach allows users to verify their identity with a single tap, creating a smoother user experience while maintaining security. ## How It Works 1. Your application requests an OTP link to be sent to a user's WhatsApp 2. CrunchzApp generates a unique verification link and delivers it via WhatsApp 3. The user clicks the link, which opens in their browser 4. Upon successful verification, the user is redirected to your application or a callback URL is triggered ## Available Methods ### Basic Link Request Send a standard verification link to a WhatsApp contact. ```php use CrunchzApp\CrunchzApp; CrunchzApp::otp('link') ->contact('xxx@c.us') ->send(); ``` | Parameter | Type | Required | Description | | --------- | ------ | -------- | ------------------------------------------------------------------- | | contact | string | Yes | The WhatsApp contact ID in the format '[xxx@c.us](mailto:xxx@c.us)' | By default, OTP links expire after 15 minutes and use a standard verification message. ### Custom Link Request Create a fully customized verification experience with custom prompts, messages, and callbacks. ```php use CrunchzApp\CrunchzApp; use Illuminate\Support\Str; $code = strtoupper(Str::random(6)); return CrunchzApp::otp('link') ->contact('xxx@c.us') ->prompt('Give me login code at MyRepublic') ->responseMessage( successResponse: 'This is your code, please make it safe and secure *##'.$code.'##*', failedResponse: 'Your phone number or your prompt are incorrect', expiredResponse: 'This link is expired, please try a new link', ) ->callback( successCallback: 'https://github.com/crunchzApp/success-callback', failedCallback: 'https://github.com/crunchzApp/failed-callback' ) ->send(); ``` | Parameter | Type | Required | Description | | --------------- | ------ | -------- | ------------------------------------------------------------------- | | contact | string | Yes | The WhatsApp contact ID in the format '[xxx@c.us](mailto:xxx@c.us)' | | prompt | string | No | Custom text prompt shown to the user | | successResponse | string | No | Custom message shown after successful verification | | failedResponse | string | No | Custom message shown after failed verification | | expiredResponse | string | No | Custom message shown when link has expired | | successCallback | string | No | URL to call when verification succeeds | | failedCallback | string | No | URL to call when verification fails | When using custom codes in your response messages, ensure they are properly formatted and highlighted (as shown with the *##code##* syntax in the example). ## Customization Options The `prompt()` method allows you to customize the text shown to users when they click the verification link. This can be used to provide context about why they're being asked to verify. The `responseMessage()` method lets you define custom messages for different verification outcomes: * `successResponse`: Shown after successful verification * `failedResponse`: Shown after failed verification * `expiredResponse`: Shown when the link has expired The `callback()` method allows you to specify webhook URLs that will be called when verification succeeds or fails: * `successCallback`: Called on successful verification * `failedCallback`: Called on failed verification ## Common Use Cases Send a verification link to users instead of requiring them to remember and enter passwords. Provide a secure way for users to regain access to their accounts without complex recovery processes. Verify user intent for sensitive operations like payments or account changes with a simple click. Add an extra layer of security by requiring link verification in addition to password login. ## Error Handling ```json { "success": false, "message": "Invalid verification link", "error_code": "LINK_INVALID" } ``` ```json { "success": false, "message": "Verification link has expired", "error_code": "LINK_EXPIRED" } ``` ```json { "success": false, "message": "Verification link already used", "error_code": "LINK_USED" } ``` # Parallel & Single Source: https://docs.crunchz.app/packages/laravel/paralel-single Methods for sending messages through the CrunchzApp WhatsApp API ## Overview The CrunchzApp SDK provides two distinct methods for sending WhatsApp messages, each designed for different use cases and requirements. Understanding the differences between these methods will help you implement the most efficient messaging strategy for your application. ## Message Sending Methods ### Parallel Method The Parallel method allows you to stack multiple operations and send them as a batch. This approach is ideal when you want to: * Create a natural messaging flow with typing indicators * Send multiple messages in sequence * Combine different types of actions in a single request ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->startTyping() ->text('This is a message from you') ->text('Another text message from me') ->stopTyping() ->sendPool(); ``` ```php namespace App\Http\Controllers; use CrunchzApp\CrunchzApp; class TestController extends Controller { /** * @throws \Exception */ public function index() { return CrunchzApp::channel() ->contact('6281357541790@c.us') ->startTyping() ->text('This is a message from you') ->text('Another text message from me') ->stopTyping() ->sendPool(); } } ``` | Feature | Description | | ------------ | -------------------------------------------- | | Method Chain | Stack multiple operations before sending | | Final Method | Use `->sendPool()` to execute all operations | | Execution | All operations are sent in a single batch | | Best For | Creating natural conversation flows | The Parallel method executes all operations in the order they are chained, making it perfect for simulating natural conversation patterns with typing indicators. ### Single Method The Single method executes each operation immediately when the `->send()` method is called. This approach is ideal when you want to: * Send individual messages with immediate execution * Handle responses for each message separately * Implement conditional logic between messages ```php use CrunchzApp\CrunchzApp; // Send a text message CrunchzApp::channel() ->contact('xxx@c.us') ->text('This is a message from you') ->send(); // Send another message CrunchzApp::channel() ->contact('xxx@c.us') ->text('Another text message') ->send(); ``` ```php use CrunchzApp\CrunchzApp; // Start typing CrunchzApp::channel() ->contact('xxx@c.us') ->startTyping() ->send(); // Wait for a moment to simulate typing sleep(2); // Send the message CrunchzApp::channel() ->contact('xxx@c.us') ->text('This is a message after typing') ->send(); // Stop typing CrunchzApp::channel() ->contact('xxx@c.us') ->stopTyping() ->send(); ``` | Feature | Description | | ------------ | --------------------------------------- | | Method Chain | Each operation is sent individually | | Final Method | Use `->send()` to execute the operation | | Execution | Each operation is sent immediately | | Best For | Independent messages with custom timing | When using the Single method, each operation requires a separate API call, which may impact performance if you're sending many messages in sequence. ## Choosing Between Methods * When simulating natural conversation with typing indicators * When sending a sequence of related messages * When you want to minimize the number of API calls * When the entire message sequence is predetermined * When you need to process responses between messages * When implementing conditional logic based on previous message status * When messages need to be sent with specific timing * When working with user interactions that trigger individual messages The Parallel method is generally more efficient for sending multiple messages as it requires only one API call. The Single method makes a separate API call for each message, which may be less efficient but offers more flexibility. # Send Message Source: https://docs.crunchz.app/packages/laravel/send-message Comprehensive guide to sending various types of messages and managing message interactions via WhatsApp ## 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. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->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 '[xxx@c.us](mailto:xxx@c.us)' | Text messages support markdown formatting for **bold**, *italic*, ~~strikethrough~~, and `code blocks`. ### Image Messages Share images with optional captions. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->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. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->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. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->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. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->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. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->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. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->react( messageId: 'false_xxxx@c.us_xxx', reaction: '😍' ) ->send(); ``` | 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. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->star( messageId: 'false_xxxx@c.us_xxx', starred: true ) ->send(); ``` | 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. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->delete( messageId: 'false_xxxx@c.us_xxx' ) ->send(); ``` | 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. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->seen( messageId: 'false_xxxx@c.us_xxx' ) ->send(); ``` | 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. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->startTyping() ->send(); ``` The typing indicator automatically disappears after 25 seconds if not manually stopped. ### Stop Typing Indicator Hide the typing indicator. ```php use CrunchzApp\CrunchzApp; CrunchzApp::channel() ->contact('xxx@c.us') ->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 ```json { "success": false, "message": "Invalid contact ID or contact not found", "error_code": "INVALID_CONTACT" } ``` ```json { "success": false, "message": "Failed to upload media file", "error_code": "MEDIA_UPLOAD_FAILED" } ``` ```json { "success": false, "message": "Message ID not found", "error_code": "MESSAGE_NOT_FOUND" } ``` # Requirements Source: https://docs.crunchz.app/requirement Essential prerequisites for using CrunchzApp WhatsApp API Before you can start using CrunchzApp to integrate WhatsApp into your applications via the API, make sure you meet the following requirements. Active personal or business account Sign up on our platform For authentication ## Essential Requirements You need a **personal** or **business WhatsApp account** to integrate with CrunchzApp. Ensure that: * The account is **active** and accessible on your mobile device. * You can log in and scan QR codes via WhatsApp Web. Ensure that both your **WhatsApp account** (on your mobile) and your device (where you're setting up CrunchzApp) are connected to the internet. WhatsApp Web functionality requires both devices to stay online for proper message delivery. You must have a **CrunchzApp account** to access the platform and API. If you haven't signed up yet: * **Visit the [CrunchzApp website](https://panel.crunchz.app)** and create an account. * Verify your email and log in to the dashboard. Familiarity with making API requests will be useful. You should know how to: * Make HTTP requests (using tools like `cURL`, Postman, or your preferred programming language). * Use RESTful APIs (to send data, handle responses, etc.). If you're not familiar with APIs, you can refer to CrunchzApp's **API Documentation** for beginner-friendly guides. You'll need a programming environment or tool to send API requests. This could be: * **Postman** (for testing and building API requests). * **cURL** (a command-line tool for API requests). * A development setup in languages like **Python**, **JavaScript**, or **PHP**, with HTTP request libraries installed. Once you have signed up and logged into CrunchzApp: * Navigate to the **API Key** section in the dashboard. * **Generate** and copy your **API key**, which you'll need for authenticating API requests. Ensure that you have access to **valid phone numbers** of recipients to send WhatsApp messages to via the CrunchzApp API. These should be: * Properly formatted in **international format** (e.g., +1234567890). * WhatsApp-compatible (i.e., the recipient has WhatsApp installed and active). Before using CrunchzApp to send WhatsApp messages, ensure that your use case complies with WhatsApp's terms and conditions, including: * Avoiding unsolicited messaging (i.e., **no spamming**). * Following the **WhatsApp Business and personal use policies**. CrunchzApp supports a variety of platforms where you can integrate your WhatsApp API: * **Web-based applications**. * **Mobile applications** (Android, iOS). * **Backend services**. Check CrunchzApp's compatibility with your platform for smooth integration. WhatsApp has strict policies against spam and unsolicited messages. Ensure your messaging practices comply with WhatsApp's Business Policy to avoid account restrictions or bans. No, you can use either a personal or business WhatsApp account with CrunchzApp. Our platform works with both types of accounts. If your internet connection drops, message delivery will be paused until the connection is restored. WhatsApp Web requires both your phone and the device running CrunchzApp to be online. While basic API knowledge is helpful, CrunchzApp provides comprehensive documentation and examples to help you get started, even with limited programming experience. With these requirements fulfilled, you're all set to start using CrunchzApp for your WhatsApp API integration. Make sure everything is prepared before diving into the [setup process](setup)! # Sandbox Mode Source: https://docs.crunchz.app/sandbox Testing environment for CrunchzApp WhatsApp API with limited functionality Sandbox Mode is a restricted testing environment for new channels. It allows users to test certain API functionalities before subscribing to a plan. Unlike Production Mode, Sandbox Mode limits the channel's interactions to a single designated contact. Test API with one contact Free testing period Subscribe to remove limits ## How Sandbox Works When creating a new channel, users can choose between Sandbox Mode and Production Mode via a switch button in the form. If Sandbox Mode is selected, the user must provide a phone number. The channel can only interact with this one predefined contact. The trial period for Sandbox Mode lasts 7 days. After 7 days, the channel and its data are automatically deleted if no subscription is purchased. Subscribing to a plan automatically removes the Sandbox restrictions and transitions the channel to Production Mode. Sandbox Mode only works with its own token and does not support the use of a Global Token. ## API Limitations in Sandbox Mode * Only specific API endpoints are allowed * Any request requiring contact\_id must match the preassigned phone number * Requests to unauthorized endpoints will be rejected * All endpoints that do not include contact\_id will be rejected * Endpoints that include contact\_id will be allowed only if the provided phone number matches the sandbox.phoneNumber ## Error Handling in Sandbox If an unauthorized API is called, the system will return a message **"This feature is not available in Sandbox Mode."** If the contact\_id does not match the assigned number the system will return a message **"Unauthorized contact for Sandbox Mode."** ## How to Transition to Production To remove Sandbox restrictions, the user must subscribe to a paid plan. Upon successful subscription, the channel transitions to Production Mode. The predefined contact limitation is lifted, allowing you to interact with any number of contacts. ## Best Practices Use Sandbox Mode for initial integration testing. Test only with the assigned contact to prevent issues. Before going live, ensure all necessary features work as expected. ## Frequently Asked Questions No, the trial period is fixed at 7 days. After expiration, the channel is deleted. If no subscription is active, the channel is deleted permanently. No, but you can select the mode when creating a new channel. No, Sandbox Mode allows interactions with only one predefined contact. Ready to test the CrunchzApp WhatsApp API? Create a Sandbox channel to start experimenting with our API features before committing to a subscription plan. # Setup Source: https://docs.crunchz.app/setup Start building awesome documentation in under 5 minutes CrunchzApp is a platform that allows you to integrate your personal or business WhatsApp account with a user-friendly API, avoiding the complexity and cost of the official WhatsApp Business API, which requires a business account and charges per message. Follow this guide to set up CrunchzApp and start sending messages through your WhatsApp account via the API. Create your CrunchzApp account Link your WhatsApp account Start integrating with our API ## Setup Process 1. **Visit the [CrunchzApp website](https://panel.crunchz.app)** and click on the **Sign Up** button. 2. Fill in the required details such as your **email**, **username**, and **password** to create your account. 3. Confirm your email by clicking the link sent to your inbox. 1. Log in to your **CrunchzApp** dashboard after signing up. 2. Click on **Create Channel** and fill the name of the Channel. 3. Follow the instructions to link your existing WhatsApp account to CrunchzApp: * Scan the QR code using your WhatsApp mobile app. * Authorize CrunchzApp to access your WhatsApp account. 4. After successful integration, you'll see your WhatsApp account listed in the Channel dashboard. 1. Navigate to the **API Key** section in the dashboard. 2. Click on **Generate Token** or **Regenerate Token** (if you have one before). 3. Copy the API key, as you will use it to authenticate your API requests. Keep your API key secure and never share it publicly. If you suspect your key has been compromised, regenerate it immediately from your dashboard. If you disconnect your WhatsApp account, your API integration will stop working. You'll need to reconnect by scanning the QR code again. Yes, you can create multiple channels in your CrunchzApp dashboard, each connected to a different WhatsApp account. API request limits depend on your subscription plan. Check the pricing page for details on each plan's limits. Ready to start sending WhatsApp messages through our API? Continue to the [Requirements](requirement) to learn what you need before making your first API request.