maukirim/open-api

Official Package Whatsapp API provided by maukirim.com

v0.0.5 2023-05-18 06:06 UTC

This package is auto-updated.

Last update: 2024-05-18 08:08:17 UTC


README

Latest Version on Packagist Total Downloads

This package is a wrapper for MauKirim OpenAPI to send message to whatsapp, you can send plain message, message with button, message with image, and message with document.

Installation

You can install the package via composer:

composer require maukirim/open-api

publish configuration file

php artisan vendor:publish --provider="MauKirim\OpenApi\OpenApiServiceProvider"

add to your .env

MAUKIRIM_TOKEN=your_token

to get your token, you can register at maukirim.com or contact us at whatsapp

we can provide free trial for 30 days

Usage

Send a plain message to whatsapp

use MauKirim\OpenApi;

$openApi = OpenApi::init(10); // 10 is the number timeout
$openApi->send(
    '628xxxxxx',
    'Hello World *hii*',
)

send a plain message with button

use MauKirim\OpenApi;
$openApi->send(
    '628xxxxxx',
    'Hello World *hii*',
    [
        [
            'id' => '1',
            'text' => 'Button 1',
            'url' => 'your_url',
        ]
    ]
)

send a message with image

use MauKirim\OpenApi;
$file = $request->file('image');
$openApi->sendImage(
    '628xxxxxx',
    'Hello World *hii*',
    $file
)

send a message with document

use MauKirim\OpenApi;
$file = $request->file('document');
$openApi->sendDocument(
    '628xxxxxx',
    'Hello World *hii*',
    $file
)

send otp to whatsapp

use MauKirim\OpenApi;
$openApi->sendOTP(
    '628xxxxxx'
)

validate otp

use MauKirim\OpenApi;
$openApi->validateOTP(
    '628xxxxxx',
    '123456'
)

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email info@maukirim.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.