API v1
·
REST · JSON
Blastifi API
API بسيط يتيح لك إضافة وإدارة عملاء واتساب في Blastifi مباشرةً من متجرك أو تطبيقك أو أي نظام خارجي — بدون تسجيل دخول يدوي.
🔑 تحتاج مفتاح API للبدء. أنشئ مفتاحاً من لوحة API.
Base URL: https://blastifi.com/api/v1
المصادقة
أرسل مفتاح API في كل request عبر HTTP header:
HTTP Header
Authorization: Bearer blastifi_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
رموز الأخطاء
| Code | Error | Description |
|---|---|---|
401 | Unauthorized | مفتاح API غير صالح أو مفقود |
403 | plan_limit_reached | تجاوزت حد الخطة — ترقية من /app/billing |
400 | validation_error | بيانات مفقودة أو غير صحيحة |
404 | not_found | العميل غير موجود |
405 | method_not_allowed | HTTP method غير مدعوم |
POST /contacts
إضافة عميل واحد:
| Field | Type | Required | Description |
|---|---|---|---|
| name | string | required | اسم العميل |
| phone | string | required | الرقم أرقام فقط بدون + (962799123456) |
| group | string | optional | المجموعة (افتراضي: API) |
| notes | string | optional | ملاحظات |
| tags | array | optional | مصفوفة tags |
curl
curl -X POST https://blastifi.com/api/v1/contacts \
-H "Authorization: Bearer blastifi_live_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Ahmed Mohammed",
"phone": "962799123456",
"group": "Store Customers",
"tags": ["new", "vip"]
}'
Response 201
{
"ok": true,
"added": 1,
"errors": 0,
"contacts": [{"id": 42, "name": "Ahmed Mohammed", "phone": "962799123456", "group": "Store Customers"}],
"failed": null
}
POST /contacts (batch)
إضافة عدة عملاء في request واحد عبر مصفوفة contacts:
curl
curl -X POST https://blastifi.com/api/v1/contacts \
-H "Authorization: Bearer blastifi_live_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"contacts": [
{"name": "Ahmed", "phone": "962799111111", "group": "Batch"},
{"name": "Sara", "phone": "962799222222", "group": "Batch"},
{"name": "Omar", "phone": "962799333333", "group": "Batch"}
]
}'
GET /contacts
جلب قائمة العملاء مع دعم pagination وfiltration:
| Param | Type | Default | Description |
|---|---|---|---|
| limit | int | 50 | عدد النتائج (أقصى 100) |
| offset | int | 0 | للـ pagination |
| group | string | - | فلتر بالمجموعة |
curl
curl "https://blastifi.com/api/v1/contacts?limit=10&offset=0&group=Store+Customers" \
-H "Authorization: Bearer blastifi_live_YOUR_TOKEN"
DELETE /contacts?id={id}
curl
curl -X DELETE "https://blastifi.com/api/v1/contacts?id=42" \
-H "Authorization: Bearer blastifi_live_YOUR_TOKEN"
PHP
PHP
<?php
$token = "blastifi_live_YOUR_TOKEN";
$ch = curl_init("https://blastifi.com/api/v1/contacts");
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
"Authorization: Bearer " . $token,
"Content-Type: application/json",
],
CURLOPT_POSTFIELDS => json_encode([
"name" => "Ahmed",
"phone" => "962799123456",
"group" => "WooCommerce",
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
if ($response["ok"]) {
echo "Added contact ID: " . $response["contacts"][0]["id"];
}
JavaScript (fetch)
JavaScript
const res = await fetch('https://blastifi.com/api/v1/contacts', {
method: 'POST',
headers: {
'Authorization': 'Bearer blastifi_live_YOUR_TOKEN',
'Content-Type': 'application/json',
},
body: JSON.stringify({
name: 'Ahmed',
phone: '962799123456',
group: 'Website Leads',
}),
});
const data = await res.json();
console.log('Added:', data.contacts[0].id);
Python
Python
import requests
TOKEN = "blastifi_live_YOUR_TOKEN"
URL = "https://blastifi.com/api/v1/contacts"
response = requests.post(URL,
headers={"Authorization": f"Bearer {TOKEN}"},
json={
"name": "Ahmed",
"phone": "962799123456",
"group": "Python Script",
}
)
data = response.json()
print(f"Added ID: {data['contacts'][0]['id']}")
Zapier — إضافة تلقائية من أي تطبيق
استخدم "Webhooks by Zapier" كـ Action لإضافة عملاء من Shopify أو WooCommerce أو Google Forms أو أي تطبيق آخر:
Action: Webhooks by Zapier → Custom Request
Method: POST
URL:
https://blastifi.com/api/v1/contactsHeaders:
Authorization: Bearer blastifi_live_YOUR_TOKENData:
{"name": "{{Customer Name}}", "phone": "{{Phone}}", "group": "Zapier"}
💡 تأكد أن الرقم أرقام فقط بدون + أو مسافات — استخدم Zapier Formatter لتنظيفه إذا لزم