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
- Daftar akun gratis di morvo.me/register
- Buka Dashboard → API Key → klik Generate.
- Salin API key, simpan di
.env(jangan commit ke git).
Endpoint Utama
POST /api/external/mailbox— buat mailbox baruGET /api/external/messages?mailboxId=...— ambil daftar pesan
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
- Testing E2E signup flow di CI/CD
- Bot Telegram penerima OTP otomatis
- Scraping account creation untuk QA
- Automation marketing test (jangan disalahgunakan untuk spam)
Rate Limit & Best Practice
- Free tier: 120 request/menit per IP. Premium tier: lebih besar.
- Jangan polling lebih cepat dari 3 detik per mailbox.
- Hapus mailbox setelah selesai untuk menjaga kebersihan.
- Selalu pakai HTTPS, jangan kirim API key di URL query.