โก
Zexxo
Home
Docs
Info
๐
Help & Tutorials
Info & Panduan
Tutorial lengkap integrasi ke bot, error codes, dan referensi
โ
Status
โ
Total API
โ
Keys
โ
Uptime
Tutorial Integrasi Bot
๐ Semua
โ๏ธ Telegram
๐ฌ WhatsApp
๐ฎ Discord
โจ๏ธ cURL / HTTP
โ๏ธ
Telegram Bot (Node.js)
Integrasi dengan node-telegram-bot-api
โพ
1
Install dependencies
Jalankan di terminal project kamu:
bash
copy
npm install node-telegram-bot-api axios
2
Buat file bot.js
Ganti
BOT_TOKEN
dengan token dari @BotFather dan
ZEXXO_KEY
dengan API key kamu.
javascript
copy
const
TelegramBot =
require
(
'node-telegram-bot-api'
);
const
axios =
require
(
'axios'
);
const
fs =
require
(
'fs'
);
const
BOT_TOKEN =
'YOUR_BOT_TOKEN_HERE'
;
const
ZEXXO_KEY =
'zxxo_xxxxxxxxxxxxxxxx'
;
const
BASE_URL =
'http://68.183.17.236:3000/api'
;
const
bot =
new
TelegramBot
(BOT_TOKEN, { polling:
true
});
// Command: /ytmp4 https://youtu.be/xxx
bot.
onText
(
/\/ytmp4 (.+)/
,
async
(msg, match) => {
const
chatId = msg.chat.id;
const
url = match[
1
].trim(); bot.
sendMessage
(chatId,
'โณ Memproses video...'
);
try
{
const
res =
await
axios.
get
(
`${BASE_URL}/download/ytmp4`
, { params: { url, resolution:
'720'
}, headers: {
'X-Api-Key'
: ZEXXO_KEY }, responseType:
'stream'
});
const
path =
`./tmp_${Date.now()}.mp4`
; res.data.
pipe
(fs.
createWriteStream
(path)); res.data.
on
(
'end'
,
async
() => {
await
bot.
sendVideo
(chatId, path, { caption:
'โ Video siap!'
}); fs.
unlinkSync
(path); }); }
catch
(e) { bot.
sendMessage
(chatId,
`โ Error: ${e.message}`
); } });
// Command: /ytmp3 https://youtu.be/xxx
bot.
onText
(
/\/ytmp3 (.+)/
,
async
(msg, match) => {
const
chatId = msg.chat.id; bot.
sendMessage
(chatId,
'๐ต Mengunduh audio...'
);
try
{
const
res =
await
axios.
get
(
`${BASE_URL}/download/ytmp3`
, { params: { url: match[
1
].trim() }, headers: {
'X-Api-Key'
: ZEXXO_KEY }, responseType:
'stream'
});
const
path =
`./tmp_${Date.now()}.mp3`
; res.data.
pipe
(fs.
createWriteStream
(path)); res.data.
on
(
'end'
,
async
() => {
await
bot.
sendAudio
(chatId, path); fs.
unlinkSync
(path); }); }
catch
(e) { bot.
sendMessage
(chatId,
`โ Error: ${e.message}`
); } }); console.
log
(
'๐ค Bot running!'
);
๐ก
Jalankan dengan
node bot.js
. Gunakan
PM2
agar bot tetap online:
pm2 start bot.js
๐ฌ
WhatsApp Bot (Baileys)
Integrasi dengan @whiskeysockets/baileys
โพ
โ ๏ธ
Baileys adalah library tidak resmi. Gunakan dengan bijak dan hindari spam untuk menghindari banned.
bash
copy
npm install @whiskeysockets/baileys axios
javascript
copy
const
{ default: makeWASocket, useMultiFileAuthState } =
require
(
'@whiskeysockets/baileys'
);
const
axios =
require
(
'axios'
);
const
ZEXXO_KEY =
'zxxo_xxxxxxxxxxxxxxxx'
;
const
BASE_URL =
'http://68.183.17.236:3000/api'
;
async function
startBot
() {
const
{ state, saveCreds } =
await
useMultiFileAuthState
(
'auth'
);
const
sock =
makeWASocket
({ auth: state }); sock.ev.
on
(
'creds.update'
, saveCreds); sock.ev.
on
(
'messages.upsert'
,
async
({ messages }) => {
const
msg = messages[
0
];
if
(!msg.message || msg.key.fromMe)
return
;
const
jid = msg.key.remoteJid;
const
text = msg.message.conversation || msg.message.extendedTextMessage?.text ||
''
;
// Command: .ytmp4 [url]
if
(text.
startsWith
(
'.ytmp4 '
)) {
const
url = text.
slice
(
7
).trim();
await
sock.
sendMessage
(jid, { text:
'โณ Downloading video...'
});
try
{
const
res =
await
axios.
get
(
`${BASE_URL}/download/ytmp4`
, { params: { url, resolution:
'480'
}, headers: {
'X-Api-Key'
: ZEXXO_KEY }, responseType:
'arraybuffer'
});
await
sock.
sendMessage
(jid, { video: Buffer.
from
(res.data), caption:
'โ Video dari Zexxo API'
}); }
catch
(e) {
await
sock.
sendMessage
(jid, { text:
`โ ${e.message}`
}); } } }); }
startBot
();
๐ฎ
Discord Bot (discord.js)
Integrasi dengan discord.js v14 slash commands
โพ
bash
copy
npm install discord.js axios
javascript
copy
const
{ Client, GatewayIntentBits, SlashCommandBuilder } =
require
(
'discord.js'
);
const
axios =
require
(
'axios'
);
const
ZEXXO_KEY =
'zxxo_xxxxxxxxxxxxxxxx'
;
const
BASE_URL =
'http://68.183.17.236:3000/api'
;
const
BOT_TOKEN =
'YOUR_DISCORD_BOT_TOKEN'
;
const
client =
new
Client
({ intents: [GatewayIntentBits.Guilds] }); client.
on
(
'ready'
, () => { console.
log
(
`โ Logged in as ${client.user.tag}`
); }); client.
on
(
'interactionCreate'
,
async
(interaction) => {
if
(!interaction.
isChatInputCommand
())
return
;
if
(interaction.commandName ===
'ytmp4'
) {
const
url = interaction.options.
getString
(
'url'
);
await
interaction.
deferReply
();
try
{
const
res =
await
axios.
get
(
`${BASE_URL}/download/ytmp4`
, { params: { url, resolution:
'480'
}, headers: {
'X-Api-Key'
: ZEXXO_KEY }, responseType:
'arraybuffer'
});
await
interaction.
editReply
({ content:
'โ Download selesai!'
, files: [{ attachment: Buffer.
from
(res.data), name:
'video.mp4'
}] }); }
catch
(e) {
await
interaction.
editReply
(
`โ Error: ${e.message}`
); } } }); client.
login
(BOT_TOKEN);
โจ๏ธ
cURL / HTTP Langsung
Untuk testing, scripting, atau integrasi apapun
โพ
curl examples
copy
# Download MP4 video
curl
"http://68.183.17.236:3000/api/download/ytmp4\ ?url=https://youtu.be/xxx&resolution=720"
\ -H
"X-Api-Key: zxxo_xxx"
\ -o video.mp4
# Download MP3 audio
curl
"http://68.183.17.236:3000/api/download/ytmp3\ ?url=https://youtu.be/xxx"
\ -H
"X-Api-Key: zxxo_xxx"
\ -o audio.mp3
# Check status API key
curl
"http://68.183.17.236:3000/api/key-info"
\ -H
"X-Api-Key: zxxo_xxx"
# Generate / ambil key (1 device 1 key)
curl -X POST
"http://68.183.17.236:3000/api/generate-key"
\ -H
"Content-Type: application/json"
python
copy
import
requests ZEXXO_KEY =
"zxxo_xxxxxxxxxxxxxxxx"
BASE_URL =
"http://68.183.17.236:3000/api"
HEADERS = {
"X-Api-Key"
: ZEXXO_KEY}
# Download YouTube MP4
def
download_ytmp4
(url, resolution=
"720"
): res = requests.
get
(
f"{BASE_URL}/download/ytmp4"
, params={
"url"
: url,
"resolution"
: resolution}, headers=HEADERS, stream=
True
)
with
open
(
"video.mp4"
,
"wb"
)
as
f:
for
chunk
in
res.
iter_content
(
8192
): f.
write
(chunk)
print
(
"โ Saved video.mp4"
)
download_ytmp4
(
"https://youtu.be/xxx"
)
Error Codes
โ ๏ธ Semua Error Codes
โพ
400
INVALID_INPUT
Field wajib kosong atau format URL salah
401
MISSING_KEY
Header X-Api-Key tidak disertakan dalam request
403
INVALID_KEY
API key salah, tidak ditemukan, atau sudah di-revoke
403
DEVICE_MISMATCH
Key digunakan dari device berbeda โ otomatis di-revoke sebagai proteksi
404
NOT_FOUND
Endpoint yang diminta tidak ada
429
RATE_LIMITED
Melebihi batas 60 request per menit
500
INTERNAL_ERROR
Server error tidak terduga, coba lagi
502
UPSTREAM_ERROR
Layanan sumber tidak tersedia atau timeout
json ยท error format
copy
{
"status"
:
403
,
"error"
:
"DEVICE_MISMATCH"
,
"message"
:
"Key ini terikat ke device lain..."
}
๐ Key Management API
โพ
POST
/api/generate-key
Buat atau ambil key untuk device ini. 1 device 1 key aktif.
GET
/api/key-info
Cek info key: label, tanggal buat, total request. Header: X-Api-Key
DEL
/api/revoke-key
Revoke key secara permanen. Tidak bisa dibatalkan.
Spesifikasi
Runtime
Node.js
Framework
Express
Auth
Device Key
Rate Limit
60/min
DB
JSON File
Version
3.0.0