سرویس پیامک
ارسال و مدیریت پیامکها
ارسال پیامک
ارسال یک پیام متنی به شماره گیرنده.
POST
/messagesAuthentication
bearerRequest body
| Name | Type | Description |
|---|---|---|
recipientRequired | string | شماره گیرنده |
messageRequired | string | متن پیامک |
Response
درخواست موفق
| Name | Type | Description |
|---|---|---|
id | string | شناسه پیام |
status | string | وضعیت ارسال |
request.js
const response = await fetch("https://api.example.invalid/v1/messages", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"recipient": "+989120000000",
"message": "Hello World"
})
});
const data = await response.json();Response
{
"id": "msg_01",
"status": "queued"
}ارسال گروهی
ارسال متن مشترک به چند گیرنده.
POST
/messages/bulkAuthentication
bearerRequest body
| Name | Type | Description |
|---|---|---|
recipientsRequired | string[] | شمارههای گیرنده |
messageRequired | string | متن پیامک |
Response
درخواست موفق
| Name | Type | Description |
|---|---|---|
id | string | شناسه پیام |
status | string | وضعیت ارسال |
request.js
const response = await fetch("https://api.example.invalid/v1/messages/bulk", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"recipients": [
"+989120000000",
"+989130000000"
],
"message": "Hello World"
})
});
const data = await response.json();Response
[
{
"id": "msg_01",
"status": "queued"
}
]ارسال کد تأیید
ارسال پیام با قالب و پارامترهای آن.
POST
/messages/verifyAuthentication
bearerRequest body
| Name | Type | Description |
|---|---|---|
recipientRequired | string | شماره گیرنده |
templateIdRequired | string | شناسه قالب |
parametersRequired | object | متغیرهای قالب |
Response
درخواست موفق
| Name | Type | Description |
|---|---|---|
id | string | شناسه پیام |
status | string | وضعیت ارسال |
request.js
const response = await fetch("https://api.example.invalid/v1/messages/verify", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"recipient": "+989120000000",
"templateId": "template_01",
"parameters": {
"code": "123456"
}
})
});
const data = await response.json();Response
{
"id": "msg_01",
"status": "queued"
}گزارش وضعیت پیامک
بررسی وضعیت پیام با شناسه آن.
GET
/messages/{messageId}Authentication
bearerPath parameters
| Name | Type | Description |
|---|---|---|
messageIdRequired | string | شناسه یکتا |
Response
درخواست موفق
| Name | Type | Description |
|---|---|---|
id | string | شناسه پیام |
status | string | وضعیت ارسال |
request.js
const response = await fetch("https://api.example.invalid/v1/messages/id_01", {
method: "GET",
headers: {
"Authorization": "Bearer YOUR_API_TOKEN"
}
});
const data = await response.json();Response
{
"id": "msg_01",
"status": "queued"
}