Skip to content

Latest commit

 

History

History
106 lines (93 loc) · 2.5 KB

readme.md

File metadata and controls

106 lines (93 loc) · 2.5 KB

Checkwa

Latest Version GitHub Workflow Status Total Downloads

Laravel package to check valid whatsapp number using checkwa api

Requirements

PHP ^7

Installation

Checkwa can be installed by updating composer.json with

"require": {
  "myckhel/laravel-checkwa": "dev-master"
},
"repositories": [
      {
        "type": "vcs",
        "url": "https://github.com/myckhel/checkwa.git"
      }
    ]

Then run

composer update

Setup

Publish the config file

php artisan vendor:publish --provider="myckhel\Checkwa\CheckwaServiceProvider" --tag="config"

checkwa.php should be copied to the config directory containing

<?php
return [
  "apikey"          => env("CHECKWA_API_KEY"),
  "user"            => env("CHECKWA_USER"),
  "server"          => env("CHECKWA_SERVER", 462),
  "server_type"     => env("CHECKWA_SERVER_TYPE", "public"),
  "callback"        => env("CHECKWA_CALLBACK"),
];

Create environment variables in your app's .env file

CHECKWA_API_KEY=XXXXXX-XXXXXX-XXXXXX-XXXXXX-XXXXXX
CHECKWA_USER=user
CHECKWA_SERVER=40
CHECKWA_CALLBACK=https://api.callback.url/checkwa/callback

Usage

Check Valid Whatsapp Number Using Public Server

use Checkwa;
use Illuminate\Support\Str;
public function checkWa(Request $request){

  return Checkwa::check($request->phone, $request->phone_code, ['token' => Str::random(), 'hide_image' => '1']);
}

Example Valid Response

{
    "code": "001",
    "checks": 5,
    "limit": 5,
    "number": "2348123456789",
    "num": "8123456789",
    "cod": "234",
    "lastseen": "",
    "status": " 234 812 345 6789",
    "picture": "https://api.checkwa.com/img/n/8123456789.jpg"
}

Check Valid Whatsapp Number Using Private Server

use Checkwa;
use Illuminate\Support\Str;
public function checkWa(Request $request){

  return Check::check($request->phone, $request->phone_code, ['token' => Str::random(), 'hide_image' => '1']);
}

Example Valid Response Using Private Server

{
    "code": "1",
    "server": "54",
    "server_status": "1",
    "server_ping": "2020-06-29 16:40:19",
    "token": "nRBoSTOHNx1ueIwP",
    "callback": "https://api.callback.url/checkwa/callback"
}