Home · Blog · Cara Menggunakan API TempMail untuk Automation
Developer

Cara Menggunakan API TempMail untuk Automation (Node.js & Python)

Butuh email sementara dalam skrip otomatis — testing signup, bot Telegram, scraping account creation? Pakai REST API MORVO. 5 menit set up.

Persiapan

  1. Daftar akun gratis di morvo.me/register
  2. Buka Dashboard → API Key → klik Generate.
  3. Salin API key, simpan di .env (jangan commit ke git).

Endpoint Utama

Dokumentasi lengkap: /api-docs.html

Contoh Node.js

const API_KEY = process.env.MORVO_API_KEY;

async function createMailbox() {
  const r = await fetch('https://adzstore.my.id/api/external/mailbox', {
    method: 'POST',
    headers: {
      'X-API-Key': API_KEY,
      'Content-Type': 'application/json'
    }
  });
  return r.json();
}

async function pollMessages(mailboxId) {
  const r = await fetch(
    `https://adzstore.my.id/api/external/messages?mailboxId=${mailboxId}`,
    { headers: { 'X-API-Key': API_KEY } }
  );
  return r.json();
}

(async () => {
  const mb = await createMailbox();
  console.log('Mailbox:', mb.address);

  // Polling tiap 5 detik
  setInterval(async () => {
    const msgs = await pollMessages(mb.id);
    if (msgs.length) console.log('OTP:', msgs[0].body);
  }, 5000);
})();

Contoh Python

import os, time, requests

API_KEY = os.environ['MORVO_API_KEY']
HEAD = {'X-API-Key': API_KEY}

mb = requests.post('https://adzstore.my.id/api/external/mailbox', headers=HEAD).json()
print('Mailbox:', mb['address'])

while True:
    msgs = requests.get(
        f"https://adzstore.my.id/api/external/messages?mailboxId={mb['id']}",
        headers=HEAD
    ).json()
    if msgs:
        print('OTP:', msgs[0]['body'])
        break
    time.sleep(5)

Use Case Automation

Rate Limit & Best Practice

Coba MORVO TempMail Sekarang

Email sementara gratis, tanpa daftar, OTP cepat.

Generate Email →