Tambahkan Pin Pada Obrolan Whatsapp

Endpoint API

URL: https://api.wavave.com/v1/messages/pin

Method: POST

Contoh Kode

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

// API Key
$ApiKey = "API_KEY_ANDA_DISINI";

$data = json_encode([
    'target' => '628123456789',
    'device' => '628111111111' 
]);

// Endpoint API
$endpoint = 'https://api.wavave.com/v1/messages/pin';

$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/messages/pin";

const data = {
    target: "62812345678",
    device: "62811111111"
};

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/messages/pin"

data = {
    "target": "62812345678",
    "device": "62811111111"
}

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/messages/pin" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer API_KEY_ANDA_DISINI" \
     -d '{
           "target": "62812345678",
           "device": "62811111111"
         }'


                        

Parameter

Parameter Tipe Deskripsi
target Number Nomor whatsapp yang akan diberikan pin pada chat whatsapp
device Number Nomor whatsapp yang terhubung dengan aplikasi

Response Success


{
  "success": true,
  "status": "success",
  "data": {
    "target": "62812345678",
    "pin": true
  }
}

Penjelasan Response Success

Properti Nilai Deskripsi
success Boolean (true) Menunjukkan bahwa permintaan API berhasil dan (false) permintaan tidak berhasil
data Object Merupakan sebuah objek yang berisi properti "target" dan "device"
data.target String Nomor whatsapp yang berhasil di berikan pin
data.pin Boolean Bernilai true jika permintaan berhasil