Gelen Mesaj Kutusu
İletişim formu gelen kutusunu okuyan, taşıyan ve yanıtlayan dokuz uç.
Genel Bakış
İletişim formundan gelen mesajlar bir gelen kutusu gibi çalışır: okunmamışlar, okunanlar, yanıtlananlar, istenmeyenler ve çöp. Dokuz uç bu kutuyu okur, mesajları klasörler arasında taşır ve iki gerçek işlem yapar.
Klasör saklanan bir alan değildir; kaydın durumu ile okunma işaretinden hesaplanır. Bu yüzden bir mesajı okunanlara taşımak durumunu değiştirmez, yalnız işareti çevirir.
İki uç kurulumun dışına çıkar: yanıtlamak ziyaretçiye gerçek bir e-posta gönderir, dönüştürmek ise gerçek bir destek talebi açar. İkisi de geri alınamaz.
Referans
Mesajları Listeleme
İletişim formundan gelen mesajları klasöre göre döndürür.
unread, read, replied, spam, trash. Öntanımlı olarak okunmamışlar.unread, read, replied, spam, trash. Durum ile okunma işaretinden türer.curl 'https://panel.ornek.com/api/v1/admin/website/messages?folder=unread' \
-H "Authorization: Bearer $API_KEY"const url = new URL('https://panel.ornek.com/api/v1/admin/website/messages');
url.searchParams.set('folder', 'unread');
const res = await fetch(url, {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/website/messages?' . http_build_query(['folder' => 'unread']));
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Okunma isareti TERSTIR: sifir okunmamis demektir, bir okunmus.
$msgs = Api::Website()->GetMessages([], ['folder' => 'unread'])['data'];
$isRead = $msgs[0]['unread'] === 1;Mesaj Detayı
Tek bir mesajı döndürür.
unread, read, replied, spam, trash. Durum ile okunma işaretinden türer.curl 'https://panel.ornek.com/api/v1/admin/website/messages/20' \
-H "Authorization: Bearer $API_KEY"const res = await fetch(`https://panel.ornek.com/api/v1/admin/website/messages/${id}`, {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/website/messages/' . $id);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Okumak mesaji OKUNDU YAPMAZ; isaret ayri bir cagriyla konur.
$msg = Api::Website()->GetMessage(['id' => $id])['data'];Mesajları Toplu Taşıma
Birden çok mesajı tek çağrıda başka bir klasöre taşır.
unread, read, replied, spam, trash.curl -X POST 'https://panel.ornek.com/api/v1/admin/website/messages/bulk-move' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"ids":[20,21],"folder":"trash"}'const res = await fetch('https://panel.ornek.com/api/v1/admin/website/messages/bulk-move', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ ids: [20, 21], folder: 'trash' }),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/website/messages/bulk-move');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['ids' => [20, 21], 'folder' => 'trash']),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Iki secenek MESAJIN OTESINE gecer: gonderen yasaklanir ve adresi engellenir.
Api::Website()->BulkMoveMessages([
'ids' => $ids,
'folder' => 'spam',
'block_emails' => true,
'report_spam' => true,
]);Klasörü Boşaltma
İstenmeyen ya da çöp klasörünü tümüyle boşaltır.
curl -X POST 'https://panel.ornek.com/api/v1/admin/website/messages/empty-folder' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"folder":"trash"}'const res = await fetch('https://panel.ornek.com/api/v1/admin/website/messages/empty-folder', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ folder: 'trash' }),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/website/messages/empty-folder');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['folder' => 'trash']),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Kac kayit gittigini SOYLEMEZ ve geri alinamaz; once klasoru listeleyip sayin.
$before = Api::Website()->GetMessages([], ['folder' => 'trash'])['meta']['total'];
Api::Website()->EmptyMessageFolder(['folder' => 'trash']);Tek Mesajı Taşıma
Tek bir mesajı başka bir klasöre taşır.
unread, read, replied, spam, trash.curl -X PUT 'https://panel.ornek.com/api/v1/admin/website/messages/20/folder' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"folder":"read"}'const res = await fetch(`https://panel.ornek.com/api/v1/admin/website/messages/${id}/folder`, {
method: 'PUT',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ folder: 'read' }),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/website/messages/' . $id . '/folder');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['folder' => 'read']),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Okundu/okunmadi klasoru DURUMU degistirmez, yalniz okunma isaretini cevirir.
Api::Website()->SetMessageFolder(['id' => $id, 'folder' => 'read']);Okundu İşaretleme
Mesajı okundu yapar ve okuyanı kaydeder.
curl -X POST 'https://panel.ornek.com/api/v1/admin/website/messages/20/read' \
-H "Authorization: Bearer $API_KEY"const res = await fetch(`https://panel.ornek.com/api/v1/admin/website/messages/${id}/read`, {
method: 'POST',
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/website/messages/' . $id . '/read');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Okuyanlar haritasi HER yoneticiyi ayri tutar; isaret ise tum panel icin tektir.
Api::Website()->ReadMessage(['id' => $id]);Mesajı Yanıtlama
Ziyaretçiye e-posta yanıtı gönderir ve mesajı yanıtlandı yapar.
curl -X POST 'https://panel.ornek.com/api/v1/admin/website/messages/20/reply' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"message":"Ilginiz icin tesekkurler, en kisa surede donecegiz."}'const res = await fetch(`https://panel.ornek.com/api/v1/admin/website/messages/${id}/reply`, {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
message: "Thanks for reaching out - we'll get back to you shortly.",
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/website/messages/' . $id . '/reply');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'message' => 'Thanks for reaching out.',
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Bu cagri ZIYARETCIYE POSTA GONDERIR ve geri alinamaz; metni once dogrulayin.
Api::Website()->ReplyMessage([
'id' => $id,
'message' => $text,
]);Destek Talebine Dönüştürme
Mesajdan bir destek talebi açar ve ikisini birbirine bağlar.
curl -X POST 'https://panel.ornek.com/api/v1/admin/website/messages/20/convert-to-ticket' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"department":1,"priority":2}'const res = await fetch(`https://panel.ornek.com/api/v1/admin/website/messages/${id}/convert-to-ticket`, {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ department: 1, priority: 2 }),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/website/messages/' . $id . '/convert-to-ticket');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode(['department' => 1, 'priority' => 2]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Mesaj hangi talebe dondugunu TASIR; ikinci kez donusturmeden once ona bakin.
$msg = Api::Website()->GetMessage(['id' => $id])['data'];
if ($msg['converted_to_ticket_id'] === 0)
Api::Website()->ConvertMessageToTicket(['id' => $id, 'department' => 1]);Mesajı Silme
Tek bir mesajı kalıcı olarak kaldırır.
curl -X DELETE 'https://panel.ornek.com/api/v1/admin/website/messages/20' \
-H "Authorization: Bearer $API_KEY"const res = await fetch(`https://panel.ornek.com/api/v1/admin/website/messages/${id}`, {
method: 'DELETE',
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/website/messages/' . $id);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Silmek yerine COPE tasiyin: kayit durur, kutu temiz kalir, gerekirse geri alinir.
Api::Website()->SetMessageFolder(['id' => $id, 'folder' => 'trash']);Tuzaklar
Okunma alanında sıfır okunmamış, bir okunmuş demektir. Adı okunmamışı çağrıştırdığı için buradaki mantık çoğu kez ters okunur ve gelen kutusu sayacı yanlış çıkar. Bir mesajın okunup okunmadığını sınarken bire karşı sınayın, doğruluk değerine güvenmeyin.
Kayıtta duran şey durum ve okunma işaretidir; klasör bu ikisinden türetilir. Bir mesajı okunanlara taşımak durumu değiştirmez, işareti çevirir; istenmeyene ya da çöpe taşımak ise durumu değiştirir. Kendi tarafınızda klasöre göre süzme yaparken hesaplanan alanı kullanın, ham durumu değil.
Taşıma çağrılarının iki seçeneği mesajın çok ötesine geçer: biri gönderenin e-postasını ve telefonunu yasaklılar listesine ekler, diğeri adresini engeller. İkisi de kurulum genelinde etkilidir ve o kişinin bir daha form doldurmasını engeller. Toplu temizlik yaparken bu seçenekleri kapalı bırakın.
Yanıt ucu bir taslak kaydetmez; ziyaretçiye gerçek bir e-posta gönderir ve gönderilen posta geri alınamaz. Aynı şekilde dönüştürme ucu gerçek bir destek talebi açar. Bir betikte bu iki çağrıyı denerken kendi adresinize giden bir test kaydı kullanın.
Boşaltma çağrısı yalnız istenmeyen ve çöp klasörlerinde çalışır, ama orada her şeyi kalıcı olarak siler ve kaç kaydın gittiğini söylemez. Yanıt yalnız hangi klasörün boşaltıldığını verir. Kayıt tutmanız gerekiyorsa boşaltmadan önce klasörü listeleyin.
İlgili Makaleler
Geri bildiriminiz için teşekkürler!
Yukarıda bulamadığınız her şey için destek ekibimiz her zaman yanınızda.