Mesajlar API
Mesajlari programatik olarak yonetin ve gonderin.
Endpoints
| Method | Endpoint | Aciklama |
|---|---|---|
| GET | /messages | Mesaj listesi |
| GET | /messages/:id | Mesaj detayi |
| POST | /messages | Yeni mesaj gonder |
| POST | /messages/template | Sablon mesaj gonder |
Mesaj Gonderme
Metin Mesaji
http
POST /api/v1/messages1
json
{
"to": "+905551234567",
"channel": "whatsapp",
"type": "text",
"text": "Merhaba! Siparisiniaz hazirlandi."
}1
2
3
4
5
6
2
3
4
5
6
Resim Mesaji
json
{
"to": "+905551234567",
"channel": "whatsapp",
"type": "image",
"mediaUrl": "https://example.com/image.jpg",
"caption": "Urun gorseli"
}1
2
3
4
5
6
7
2
3
4
5
6
7
Video Mesaji
json
{
"to": "+905551234567",
"channel": "whatsapp",
"type": "video",
"mediaUrl": "https://example.com/video.mp4",
"caption": "Tanitim videosu"
}1
2
3
4
5
6
7
2
3
4
5
6
7
Belge Mesaji
json
{
"to": "+905551234567",
"channel": "whatsapp",
"type": "document",
"mediaUrl": "https://example.com/doc.pdf",
"filename": "fatura.pdf"
}1
2
3
4
5
6
7
2
3
4
5
6
7
Konum Mesaji
json
{
"to": "+905551234567",
"channel": "whatsapp",
"type": "location",
"latitude": 41.0082,
"longitude": 28.9784,
"name": "DOLU.ai Ofis",
"address": "Kadikoy, Istanbul"
}1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Sablon Mesajlari
WhatsApp onaylanmis sablonlari gonderin:
http
POST /api/v1/messages/template1
json
{
"to": "+905551234567",
"channel": "whatsapp",
"templateName": "siparis_bildirim",
"templateLanguage": "tr",
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "Ahmet" },
{ "type": "text", "text": "12345" },
{ "type": "text", "text": "Yarin" }
]
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
Butonlu Sablon
json
{
"to": "+905551234567",
"templateName": "onay_talebi",
"components": [
{
"type": "body",
"parameters": [
{ "type": "text", "text": "Siparis #12345" }
]
},
{
"type": "button",
"sub_type": "quick_reply",
"index": 0,
"parameters": [
{ "type": "payload", "payload": "confirm_12345" }
]
}
]
}1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Toplu Mesaj
Birden fazla kisiye mesaj gonderin:
http
POST /api/v1/messages/bulk1
json
{
"recipients": [
"+905551234567",
"+905559876543"
],
"channel": "whatsapp",
"templateName": "kampanya_duyuru",
"components": [...]
}1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Segment Bazli
json
{
"segmentId": "segment_vip",
"templateName": "ozel_teklif",
"components": [...]
}1
2
3
4
5
2
3
4
5
Mesaj Durumu
Durum Sorgulama
http
GET /api/v1/messages/:id/status1
Ornek Yanit
json
{
"success": true,
"data": {
"id": "msg_abc123",
"status": "delivered",
"sentAt": "2024-01-21T10:00:00Z",
"deliveredAt": "2024-01-21T10:00:02Z",
"readAt": null
}
}1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Durum Degerleri
| Durum | Aciklama |
|---|---|
| pending | Kuyrukta |
| sent | Gonderildi |
| delivered | Teslim edildi |
| read | Okundu |
| failed | Basarisiz |
Medya Yukleme
Gonderilecek medyayi onceden yukleyin:
http
POST /api/v1/media/upload
Content-Type: multipart/form-data1
2
2
Ornek Yanit
json
{
"success": true,
"data": {
"mediaId": "media_xyz789",
"url": "https://cdn.dolu.ai/media/xyz789.jpg",
"type": "image/jpeg",
"size": 245000,
"expiresAt": "2024-01-28T10:00:00Z"
}
}1
2
3
4
5
6
7
8
9
10
2
3
4
5
6
7
8
9
10
Rate Limiting
Mesaj gonderim limitleri:
| Kanal | Limit |
|---|---|
| 80 mesaj/saniye | |
| 40 mesaj/saniye | |
| Telegram | 30 mesaj/saniye |
Limit asildiginda 429 Too Many Requests yaniti alirsiniz.
Webhooks
Mesaj olaylari icin webhook'lar:
message.sent- Mesaj gonderildimessage.delivered- Mesaj teslim edildimessage.read- Mesaj okundumessage.failed- Mesaj basarisiz
Webhook Payload
json
{
"event": "message.delivered",
"timestamp": "2024-01-21T10:00:02Z",
"data": {
"messageId": "msg_abc123",
"conversationId": "conv_xyz",
"status": "delivered"
}
}1
2
3
4
5
6
7
8
9
2
3
4
5
6
7
8
9
Hata Kodlari
| Kod | Mesaj | Aciklama |
|---|---|---|
| 400 | Invalid phone | Gecersiz telefon numarasi |
| 404 | Contact not found | Kisi bulunamadi |
| 429 | Rate limited | Limit asildi |
| 503 | Channel unavailable | Kanal kulanilamaz |
