إنشاء جلسة واتساب جديدة

تجهيز حاوية برمجية مخصصة لربط رقم جديد بالمنصة.

POST
https://api.wawp.net/v2/session/create?access_token=YOUR_ACCESS_TOKEN&phone_number=201012345678

تسجيل الدخول مطلوب

سجل الدخول لاستبدال المعرفات (Instance ID) ورمز الوصول (Access Token) بمعلومات حسابك الحقيقي لاختبار ال API مباشرة.

تسجيل الدخول
اختبار /v2/session/create
POST
POST

لا توجد معاملات استعلام مطلوبة

هذه النهاية الطرفية لا تتوقع بيانات في الرابط.

توصيات

  • Provision sessions 'On-Demand' to keep your dashboard clean and maximize your quota usage.

  • Always follow a Create call with a Start call to initiate the QR code generation process.

  • Ensure your database schema can handle 12-character alphanumeric strings for the 'instance_id'.

Provisioning Your Digital Infrastructure: The Create Session Endpoint

The /v2/session/create endpoint is the specialized "Factory" for Wawp instances. While it may seem like a simple registration step, it handles a sophisticated backend process of resource allocation, container provisioning, and server assignment. Understanding how to use this factory efficiently is the foundation of a scalable WhatsApp integration.


🛠️ The Provisioning Architecture

When you call create, Wawp does not just create a record in a database; it orchestrates the following:

  1. Node Selection: Our balancer identifies the high-performance node with the lowest latency and highest availability for your region.
  2. Instance Isolation: A dedicated, isolated environment is carved out for your session, ensuring that your data and encryption keys never mingle with other users.
  3. Identifier Assignment: You are issued a unique instance_id, which serves as your permanent handle for all future interactions with that specific WhatsApp account.

🛡️ Strategic Best Practices

1. Data Integrity and Persistence

Always save the returned instance_id and server_name in your local database immediately.

  • The "Context Store": Associate this ID with your internal User IDs or Business IDs.
  • Troubleshooting: If you ever need to contact support, providing the server_name allows our engineers to pinpoint the exact infrastructure node hosting your session, reducing resolution time from hours to minutes.

2. Idempotency and Deduplication

Before calling create, always check your own system state.

  • The Trap: Re-creating instances every time a user refreshes their settings page will quickly exhaust your quota.
  • The Solution: Implement a "Check-then-Create" logic. Only call this endpoint if your database shows that the user has no existing instance_id or if they have explicitly requested to "Delete and Start New."

3. "Lazy" Provisioning

Don't create sessions in bulk. Provision an instance only when a user is actively "Onboarding." This maintains a clean environment and ensures that your allocated resources are being used by active, paying, or engaged customers.


💡 Industry-Standard Use Cases

A. Customer Relationship Management (CRM)

Automatically provision a unique WhatsApp instance for every new high-value account. This allows your sales team to have dedicated communication channels that are fully logged and auditable within your CRM.

B. Automated Appointment Reminders

For medical or service industries, use this endpoint to spin up "Notification Engines." By separating "Notifications" from "Customer Support" across different instances, you reduce the risk of account flagging and ensure high delivery rates.

C. Multi-Tenant SaaS Platforms

If you build software for other businesses, you can use this endpoint to offer "WhatsApp-as-a-Service" to your clients. Each of your clients gets their own instance_id, giving them a private, secure connection to their own customers.


⚠️ Common Pitfalls and Troubleshooting

"quota_reached" (403 Forbidden)

This is the most common error for growing applications. It means you have used all the "slots" provided by your current plan.

  • Fix: Either upgrade your plan or use the /v2/session/delete endpoint to remove stagnant or unused sessions.

"missing_param" (400 Bad Request)

The "Factory" cannot verify your identity without the access_token.

  • Fix: Ensure your token is included in the request body (POST). Double-check for trailing spaces or hidden characters if copying from a dashboard.

🚀 The Next Step: "The Warm Boot"

Creating a session is like "registering a car." You now have the keys, but the engine isn't running yet. Your newly created session will be in the STOPPED state. To actually start the authentication process and generate a QR code, you must call the /v2/session/start endpoint immediately after success.

البارامترات

قم بتهيئة المعاملات المطلوبة للتفاعل مع نقطة النهاية هذه. جميع وسائط الاستعلام والبيانات مدرجة أدناه مع تفاصيلها.

محتوى الطلب

يرسل كـ JSON
string

Your API Access Token

مثال:
string—

WhatsApp phone number with international country code (e.g., 201012345678). Strongly recommended to ensure optimal server routing, session continuity, and account protection.

مثال:

برمج بالذكاء الاصطناعي باستخدام Wawp MCP

MCP READY

قم بربط الـ API مباشرة مع Cursor أو Windsurf أو Claude Desktop، ودع الذكاء الاصطناعي يكتب لك كود الربط وينفذه تلقائياً!

طريقة الربط والإعداد

أمثلة الكود

استخدم أمثلة الكود الجاهزة لدمج واجهة برمجة التطبيقات (API) في مشروعك بسرعة وكفاءة. اختر لغة البرمجة والمكتبة التي تفضلها.

1const baseUrl = "https://api.wawp.net";
2const endpoint = "/v2/session/create";
3const params = new URLSearchParams({
4 "access_token": "YOUR_ACCESS_TOKEN"
5}).toString();
6const body = {
7 "phone_number": "201012345678"
8};
9
10fetch(`${baseUrl}${endpoint}${params ? '?' + params : ''}`, {
11 method: "POST",
12 headers: { "Content-Type": "application/json" },
13 body: JSON.stringify(body)
14})
15 .then(async (response) => {
16 if (response.ok) {
17 const data = await response.json();
18 console.log("Success:", data);
19 return data;
20 }
21
22 // Error Handling
23 if (response.status === 400) {
24 console.error("Error 400: Bad Request - Missing Token");
25 }
26 if (response.status === 401) {
27 console.error("Error 401: غير مصرح - مفتاح الوصول غير صالح أو مفقود");
28 }
29 if (response.status === 403) {
30 console.error("Error 403: ممنوع - تم الوصول إلى الحصة أو الحد");
31 }
32 if (response.status === 500) {
33 console.error("Error 500: خطأ في الخادم الداخلي - فشل غير متوقع");
34 }
35
36 const errorText = await response.text();
37 console.error(`Error ${response.status}: ${errorText}`);
38 })
39 .catch((error) => console.error("Network Error:", error));
عينات تفاعلية
Ln 39, Col 1javascript

الردود المتوقعة

استكشف كافة الردود والنتائج المحتملة من الخادم. قمنا بتوثيق كل كود حالة (Status Code) مع أمثلة للبيانات لتسهيل معالجة الأخطاء والنجاح.

تم إنشاء الجلسة بنجاح وجاهزة للتفعيل.
Bad Request - Missing Token
غير مصرح - مفتاح الوصول غير صالح أو مفقود
ممنوع - تم الوصول إلى الحصة أو الحد
خطأ في الخادم الداخلي - فشل غير متوقع
الموضوع السابقدليل إدارة الجلسات
الموضوع التاليتشغيل جلسة الواتساب

Command Palette

Search for a command to run...