2972.ir 中文文档教程

发布于 7年前 浏览 20 项目主页 更新于 3年前

2972.ir

2972.ir SMS 服务 Node.js API 库

Usage

npm 安装

npm install 2972.ir

,然后

var sendSMS = require('2972.ir');

sendSMS ({
    username: "account's username",
    password: "account's password",
    number: "account's number",
    recipient: ["09131234567", "09361234567"] // Or just "09131234567"
    message: "SMS's content",
    port: 10, // If you don't know what you're doing leave it out for it's default 0 value
    flash: false
}, function (err, res) {
    if (err)
        console.log("Error happened in sending SMS.");
    else
        console.log("SMS sent successfully");
});

If you want to use this package synchronously get help from packages like deasync.

What is flash option?

Flash SMS 消息是一条 SMS 消息, ,而不是存储在接收电话的 SIM 卡或内存中,而是在接收电话的屏幕上弹出,用户无需采取任何操作。 当关闭时,消息通常消失了。

What are callback function's parameters

err

第一个参数 (err) 表示是否发生错误。
如果 err0 那么一切正常 并且您发送 SMS 的请求已成功发送和服务 API 已发送成功响应。
如果它小于零,那么它是 SMS 服务的错​​误,代码在 2972.ir 中定义APIManual.pdf(PDF 文档为波斯语)。
如果它不是数字那么它是请求包的错误。 (更多细节参见它的文档)

res

第二个参数(res)是request 包裹的回应。 (有关详细信息,请参阅它的文档)**

Why this documentation is in English, why not in Persian?

虽然 2972​​.ir 服务是一项伊朗服务,因此它是网站及其所有文档 是英文的(在撰写本文时),我决定用英文编写这个 README 文件,因为 github 不支持波斯语 在 markdown README 中非常好,而且我认为现在几乎所有伊朗开发人员都知道(如果不是,应该知道)英语。
但请随意将此自述文件翻译成波斯语或 2972.irAPIManual.pdf 到英文或 或编辑此自述文件。 您只需一个 pull request 就可以实现这一目标!

2972.ir

2972.ir SMS service Node.js API library

Usage

Install from npm

npm install 2972.ir

and then

var sendSMS = require('2972.ir');

sendSMS ({
    username: "account's username",
    password: "account's password",
    number: "account's number",
    recipient: ["09131234567", "09361234567"] // Or just "09131234567"
    message: "SMS's content",
    port: 10, // If you don't know what you're doing leave it out for it's default 0 value
    flash: false
}, function (err, res) {
    if (err)
        console.log("Error happened in sending SMS.");
    else
        console.log("SMS sent successfully");
});

If you want to use this package synchronously get help from packages like deasync.

What is flash option?

A flash SMS message is an SMS message that, instead of being stored in the SIM or memory of the receiving phone, pops-up on the receiving phone’s screen, without the user taking any action. When dismissed the message is usually gone.

What are callback function's parameters

err

The first parameter (err) indicates whether any error happened or not.
If err is 0 then everything is OK and your request for sending SMS has successfully sent and service API has sent successful response.
If it's lower than zero then it's SMS service's error and codes are defined in 2972.irAPIManual.pdf (PDF document is in Persian language).
If it's not number then it's request package's error. (See it's documentation for more details)

res

The second parameter (res) is request package's response. (See it's documentation for more details)**

Why this documentation is in English, why not in Persian?

While the 2972.ir service is an Iranian service and therefore it's website and all of it's documentations are in English (At the time of writing), I decided to write this README file in english because github does not support Persian language in markdown READMEs very well and also I think nowadays almost all Iranian developers know (and if not, should know) English.
But feel free to translate this README to Persian or 2972.irAPIManual.pdf to English or or to edit this README. You're just a pull request away from this to happen!

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文