راهنما و نمونه کدهای نود جیاس Node.js
برای استفاده از وبسرویس اینباکسینو در نرم افزار نود جیاس خود مطابق راهنمای زیر عمل کنید.
فهرست راهنما
ارسال نوتیفیکیشن
اطلاعات وب سرویس
Web service for notifications (alerts) is provided in the table below. Use this web service for your notifications (alerts)
Web Service URL | Headers | Method |
---|---|---|
https://back.inboxino.com/api/access-api/message/send |
| POST |
نمونه کد json
Configure your notifications (alerts) according to the sample code provided below your messages, and based on the explanations provided below, send your data to the above web service to be able to send your notifications (alerts)
$requestData = [
"messages" => [
[
"message" => "your message type here 1",
"message_type" => "message",
"attachment_file" => "",
],
[
"message" => "your message type here 2 with file",
"message_type" => "image",
"attachment_file" => "dl1/AMFGlno94242qeBfyVuynXaF2QT9uxxZoc1RudVl.jpg",
]
],
"recipients" => ["۰۹۳۷۶۰۸۰۴۶۷", "۰۹۱۹۹۱۵۸۴۳۹", "۰۹۱۲۹۱۵۵۴۲۵"],
"platforms" => ["telegram", "bale", "eitaa"],
"setting" => [
"expired_minutes" => "",
],
"with_country_code" => true,
"country_code" => "+۹۸"
];
مشخصات پارامترها
In the table below, the types of parameters along with how to correctly send them and their explanations are provided. Please read carefully and send your messages according to the requested data.
فیلد | نوع | نمونه مقادیر | الزامی | توضیحات |
---|---|---|---|---|
messages | Array of Objects | "messages" => [ [ "message" => "your first text message", "message_type" => "message", "attachment_file" => "", ], [ "message" => "your message with image", "message_type" => "image", "attachment_file" => "image.jpg", ] ], | Yes | It is an array of messages, and each array is the necessary data for sending each message. To send multiple messages to one number, you must place multiple arrays of messages in this section. For example, two messages will now be sent to the number 09376080467. |
message | String | سلام، به اینباکسینو خوش آمدید | Yes | متن پیام شما |
message_type | String | message | image | video | file | audio | Yes | Specifies the type of message you are sending, and your message type can only be one of the values message | image | video | file | audio. Images, files, or … should be uploaded via the web service and placed in the attachment_file section. |
attachment_file | String | image.jpg | No | If the message you are sending contains an image, video, file, or … first upload your desired file through the Upload web service and replace the received file address in this section. Note that the message_type value must be completed according to the uploaded file. For example, if you have uploaded an image, the message_type should be sent as image. |
with_file | Boolean | true or false | No | If you want your desired file to be sent as a file in messengers so that its quality does not decrease, you must send this option as true. |
recipients | Array of Strings | [“۰۹۳۷۶۰۸۰۴۶۷”, “۰۹۱۹۹۱۵۸۴۳۹”, “۰۹۱۲۹۱۵۵۴۲۵”] | Yes | Place the list of numbers you want to send messages to in this section. |
platforms | Array of Strings | [“telegram”, “bale”, “eitaa”,”whatsapp”,”rubika”] | Yes | Send the platforms where you want the messages to be sent. Make sure your platform is connected to Inboxino. Select only the platforms that are active in the selected bot; otherwise, your messages will not be sent. |
with_country_code | Boolean | true or false | No | If the numbers are entered with the destination country code, this field should be off or false. If it is true, you should also send the country code (country_code). |
country_code | String | +۹۸ | No | Select the country you want to send the message to. The country code will be added to the beginning of the numbers. So send the numbers in the recipients field without the code. The default country is Iran. |
setting | Object | "setting" => [ "expired_minutes" => 3, ], | Yes | With this section, you can manage how to send your messages. |
expired_minutes | Integer | ۳ | No | Message expiry time. If a message, for example, is not sent within 3 minutes, it will no longer be sent. |
نمونه کدهای نوتیفیکیشن Node JS
const axios = require('axios');
// Data to send
const requestData = {
"messages": [
{
"message": "your first text message",
"message_type": "message",
"attachment_file": "",
"with_file": false
},
{
"message": "your message with image",
"message_type": "image",
"attachment_file": "image.jpg",
"with_file": false
}
],
"recipients": ["09376080467", "09199158439", "09129155425"],
"platforms": ["telegram", "bale", "eitaa"],
"setting": {
"expired_minutes": "",
},
"with_country_code": true,
"country_code": "+98"
};
// Your API token
const apiToken = 'API TOKEN';
// API server URL
const apiUrl = 'https://back.inboxino.com/api/access-api/message/send';
// Set up the request headers
const headers = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'api-token': apiToken,
'Authorization': `Bearer ${apiToken}`
};
// Send the POST request using Axios
axios.post(apiUrl, requestData, { headers })
.then(response => {
return;
})
.catch(error => {
console.error('Error sending request:', error);
});
ارسال فایل
مشخصات پارامترها
To send a file in your notification, first upload your files via the web service and replace the data according to the above documents.
Web Service URL | Headers |
---|---|
https://dl1.inboxino.com/api/upload/:type |
|
نمونه کد json ارسال فایل
To send a file in your notification, first send your file via the above web service in the format shown below, then save the file path and place it in the notification web service.
{
file: "image.jpg",
}
دریافت لیست پیامهای ارسال شده
اطلاعات وب سرویس
برای دریافت لیست پیامهای ارسال شده میتوانید از این وب سرویس استفاده کنید.
Web Service URL | Headers | Method |
---|---|---|
https://back.inboxino.com/api/access-api/message/notifications-log |
| GET |
مشخصات پارامترها
فیلد | نوع | نمونه مقادیر | الزامی | توضیحات |
---|---|---|---|---|
sort | string | latest_sends|status|newest | No | برای مرتب کردم دادهها |
page | number | ۱ | No | برای صفحه بندی |
دریافت جزئیات پیامهای ارسال شده
اطلاعات وب سرویس
You can use this web service to retrieve a list of sent messages.
Web Service URL | Headers | Method |
---|---|---|
https://back.inboxino.com/api/access-api/message/641′, |
| GET |
مشخصات پارامترها
فیلد | نوع | نمونه مقادیر | الزامی | توضیحات |
---|---|---|---|---|
id | number | ۶۴۱ | YES | نوتیفیکیشن (اعلان) ارسال شده برای دریافت لیست جزئیات پیام ها |