Toplu Bildirim
Bir mesajı çok kişiye gönderen altı uç: hedef seçimi, sayım, deneme ve gönderim.
Genel Bakış
Bu altı uç bir mesajı çok kişiye göndermenin bütün adımlarını yürütür: kimin hedefleneceğini seçmek, kaç kişi olduğunu görmek, kendinize deneme yapmak ve göndermek.
Hedef kitle iki yoldan gelir. Süzgeçler müşterileri gruba, ülkeye, sahip olunan ürüne göre seçer. Bülten listesi ise elle tutulan bir adres listesidir ve üyelerinin müşteri olması gerekmez. Bülten anahtarı verdiğinizde süzgeçler yok sayılır.
Gönderim anında olmaz: mesajlar bildirim kuyruğuna alınır ve arka planda işlenir. Yanıttaki gönderim kimliği, o partinin kuyruktaki satırlarını bulmanızı sağlar.
Referans
Süzgeç Seçeneklerini Getirme
Alıcı süzgeçlerinde kullanabileceğiniz değerleri döndürür.
curl 'https://panel.ornek.com/api/v1/admin/tools/bulk/lookups' \
-H "Authorization: Bearer $API_KEY"const res = await fetch('https://panel.ornek.com/api/v1/admin/tools/bulk/lookups', {
headers: { Authorization: `Bearer ${apiKey}` },
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/tools/bulk/lookups');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Suzgec degerlerini BURADAN alin: kimlikleri tahmin etmek sessizce bos hedef kitle uretir.
$lookups = Api::Tools()->GetBulkLookups()['data'];
$groupIds = array_column($lookups['user_groups'], 'id');Alıcıları Sayma
Süzgeçlerinizin kaç kişiye ulaşacağını gönderim yapmadan söyler.
client ya da staff. Varsayılan müşteri.mail ya da sms. Kanal, kimin ulaşılabilir sayıldığını değiştirir.curl -X POST 'https://panel.ornek.com/api/v1/admin/tools/bulk/contacts' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"user_type":"client","notification_type":"mail","user_groups":[1]}'const res = await fetch('https://panel.ornek.com/api/v1/admin/tools/bulk/contacts', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
user_type: 'client',
notification_type: 'mail',
user_groups: [1],
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/tools/bulk/contacts');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'user_type' => 'client',
'notification_type' => 'mail',
'user_groups' => [1],
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Gondermeden ONCE sayin: ayni govdeyi gonderim ucuna verdiginizde bu sayi kadar kisiye gider.
$audience = ['user_type' => 'client', 'user_groups' => [1]];
$count = Api::Tools()->GetBulkContacts($audience)['data']['count'];
if ($count > 0 && $count < 5000) {
Api::Tools()->SubmitBulkNotification($audience + [
'subject' => 'Notice',
'message' => $html,
]);
}Test Gönderimi
Mesajı müşterilere değil, verdiğiniz adreslere ve departman çalışanlarına gönderir.
curl -X POST 'https://panel.ornek.com/api/v1/admin/tools/bulk/test' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"subject":"Test","message":"Hello.","emails":"[email protected]"}'const res = await fetch('https://panel.ornek.com/api/v1/admin/tools/bulk/test', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
subject: 'Test',
message: 'Hello.',
emails: '[email protected]',
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/tools/bulk/test');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'subject' => 'Test',
'message' => $html,
'emails' => '[email protected]',
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Test SUZGECLERI dikkate almaz: hedef kitleyi dogrulamaz, yalniz mesajin gorunumunu dogrular.
Api::Tools()->TestBulkNotification([
'subject' => 'Notice',
'message' => $html,
'emails' => '[email protected]',
]);Toplu Bildirimi Gönderme
Mesajı eşleşen tüm alıcılar için kuyruğa alır. Asıl gönderim budur.
single herkese ayrı mesaj, multiple tek zarfta toplu. Toplu zarfta alıcılar birbirini görebilir.curl -X POST 'https://panel.ornek.com/api/v1/admin/tools/bulk/submit' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"notification_type":"mail","user_type":"client","subject":"Notice","message":"Important update.","delivery":"single","user_groups":[1]}'const res = await fetch('https://panel.ornek.com/api/v1/admin/tools/bulk/submit', {
method: 'POST',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
notification_type: 'mail',
user_type: 'client',
subject: 'Notice',
message: 'Important update.',
delivery: 'single',
user_groups: [1],
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/tools/bulk/submit');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'subject' => 'Notice',
'message' => $html,
'delivery' => 'single',
'user_groups' => [1],
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Kuyruga alinan bir gonderim GERI ALINAMAZ; toplu iptalin yolu kuyruk satirlarini silmektir.
$batch = Api::Tools()->SubmitBulkNotification($audience + [
'subject' => 'Notice',
'message' => $html,
])['data'];
// Yanlis gitti: bekleyenleri kuyruktan cikarin.
$queued = Api::Tools()->GetNotificationQueue([], ['status' => 'pending'])['data'];
$ids = array_column(
array_filter($queued, fn (array $n): bool => $n['batch_id'] === $batch['batch_id']),
'id',
);
Api::Tools()->BulkDeleteNotificationQueue(['ids' => $ids]);{
"data": {
"queued": true,
"recipients": 1842,
"batch_id": "b7f3c1a9"
}
}{
"error": {
"code": "no_recipients",
"message": "No recipient matched the filters."
}
}Bülten Listesini Okuma
Bülten abonelerini döndürür. Bunlar müşteri olmak zorunda değildir.
email ya da sms. Varsayılan e-posta.curl -G 'https://panel.ornek.com/api/v1/admin/tools/bulk/newsletters' \
-H "Authorization: Bearer $API_KEY" \
-d type=email \
-d lang=enconst url = new URL('https://panel.ornek.com/api/v1/admin/tools/bulk/newsletters');
url.searchParams.set('type', 'email');
url.searchParams.set('lang', 'en');
const res = await fetch(url, { headers: { Authorization: `Bearer ${apiKey}` } });
const body = await res.json();$url = 'https://panel.ornek.com/api/v1/admin/tools/bulk/newsletters?' . http_build_query([
'type' => 'email',
'lang' => 'en',
]);
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $apiKey],
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Yanit dile gore SEKIL DEGISTIRIR: dil verirseniz duz liste, vermezseniz dil basina ozet.
$one = Api::Tools()->GetBulkNewsletters([], ['lang' => 'en'])['data']['entries'];
$all = Api::Tools()->GetBulkNewsletters()['data']['by_lang'];Bülten Listesini Yazma
Bir dil ve kanal için bülten listesini baştan yazar.
curl -X PUT 'https://panel.ornek.com/api/v1/admin/tools/bulk/newsletters' \
-H "Authorization: Bearer $API_KEY" \
-H 'Content-Type: application/json' \
-d '{"lang":"en","type":"email","entries":["[email protected]","[email protected]"]}'const res = await fetch('https://panel.ornek.com/api/v1/admin/tools/bulk/newsletters', {
method: 'PUT',
headers: {
Authorization: `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
lang: 'en',
type: 'email',
entries: ['[email protected]', '[email protected]'],
}),
});
const body = await res.json();$ch = curl_init('https://panel.ornek.com/api/v1/admin/tools/bulk/newsletters');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . $apiKey,
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'lang' => 'en',
'type' => 'email',
'entries' => $entries,
]),
]);
$body = json_decode(curl_exec($ch), true);
curl_close($ch);// Tek adres EKLEMEK icin mevcut listeyi de gonderin: gonderdiginiz set eskisinin yerine gecer.
$entries = Api::Tools()->GetBulkNewsletters([], ['lang' => 'en'])['data']['entries'];
$entries[] = '[email protected]';
Api::Tools()->SaveBulkNewsletters(['lang' => 'en', 'entries' => $entries]);Tuzaklar
Gönderim ucunun geri alma yolu yoktur. Yanlış bir mesajı durdurmanın tek yolu, yanıttaki gönderim kimliğiyle bildirim kuyruğundaki bekleyen satırları bulup silmektir; o ana kadar gitmiş olanlar gitmiştir. Bu yüzden göndermeden önce saymak bir formalite değil, tek güvenliktir.
Test ucu süzgeçleri hiç okumaz: yalnız verdiğiniz adreslere ve departman çalışanlarına gönderir. Yani mesajın görünümünü doğrular, kimlere gideceğini değil. Hedef kitleyi doğrulamak sayma ucunun işidir; ikisini birlikte kullanın.
Zarf biçimini toplu seçmek mesajı tek bir gönderide birleştirir. Bu hızlıdır ama alıcı adresleri birbirine görünür hâle gelebilir; müşteri listesi göndermek bir veri sızıntısıdır. Emin değilseniz tekil biçimi seçin.
Yazma ucu birleştirme yapmaz: gönderdiğiniz set o dilin listesinin yerine geçer. Tek bir adres eklemek için önce mevcut listeyi okuyup üzerine eklemeniz gerekir, yoksa geri kalan aboneler silinir.
Dil verirseniz düz bir liste alırsınız; vermezseniz dil başına gruplanmış bir özet gelir. Tek bir şekil bekleyen kod, dil parametresi unutulduğunda boş liste okur ve bunu "abone yok" sanır.
İ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.