Tambah perangkat baru

Endpoint API

URL: https://api.wavave.com/v1/device/addnew

Method: POST

Contoh Kode

<?php
header('Content-Type: application/json; charset=utf-8');

// API Key
$ApiKey = "API_KEY_ANDA_DISINI";

$data = json_encode([
    'device' => '628123456789',
    'webhook' => 'https://www.website.com/webhook.php', 
]);

// Endpoint API
$endpoint = 'https://api.wavave.com/v1/device/addnew';

$ch = curl_init($endpoint);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Content-Type: application/json',
    "Authorization: Bearer $ApiKey"
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$error = curl_error($ch);
curl_close($ch);

if ($response === false) {
    echo json_encode([
        'success' => false,
        'message' => 'cURL error: ' . $error,
        'status_code' => 500
    ]);
    exit;
}

http_response_code($httpCode);
echo $response;

                        

const axios = require('axios');

const ApiKey = "API_KEY_ANDA_DISINI";
const endpoint = "https://api.wavave.com/v1/device/addnew";

const data = {
    device: "628123456789",
    webhook: "https://www.website.com/webhook.php"
};

axios.post(endpoint, data, {
    headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${ApiKey}`
    }
}).then(response => {
    console.log(response.data);
}).catch(error => {
    console.error({
        success: false,
        message: error.response ? error.response.data : error.message,
        status_code: error.response ? error.response.status : 500
    });
});

                        

import requests

ApiKey = "API_KEY_ANDA_DISINI"
endpoint = "https://api.wavave.com/v1/device/addnew"

data = {
    "device": "628123456789",
    "webhook": "https://www.website.com/webhook.php"
}

headers = {
    "Content-Type": "application/json",
    "Authorization": f"Bearer {ApiKey}"
}

try:
    response = requests.post(endpoint, json=data, headers=headers)
    response.raise_for_status()
    print(response.json())
except requests.exceptions.RequestException as e:
    print({
        "success": False,
        "message": str(e),
        "status_code": response.status_code if 'response' in locals() else 500
    })

                        

curl -X POST "https://api.wavave.com/v1/device/addnew" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer API_KEY_ANDA_DISINI" \
     -d '{
           "device": "628123456789",
           "webhook": "https://www.website.com/webhook.php"
         }'

                        

Parameter

Parameter Tipe Deskripsi
device Number Nomor whatsapp yang ingin di tambahkan kedalam akun anda
webhook String Url webhook harus menggunakan https (Jika tidak dibutuhkan biarkan nilainya kosong)
Catatan Tambahan

Untuk akun Free ataupun akun uji coba tidak dapat menambahkan perangkat baru melalui API

Response Success


{
    "success": true,
    "message": "Sukses",
    "data": {
        "status": "success",
        "code": 200
    }
}