Home >PHP Framework >ThinkPHP >Detailed introduction to ThinkAPI SMS service

Detailed introduction to ThinkAPI SMS service

藏色散人
藏色散人forward
2021-08-18 11:29:361792browse

The following is a detailed introduction to the ThinkAPI SMS service from the thinkphp framework tutorial column. I hope it will be helpful to friends in need!

Service Overview

In order to better serve developers and the ThinkPHP ecosystem, the official selected high-quality and stable SMS service provider has officially launched the SMS API service, which currently only supports verification. code and notification SMS, and more SMS services will be launched in the future.

Since the SMS service is planned and designed separately, the calling interface is unified into the ThinkAPI service, so we have made a unified plan for the SMS API interface, and will continue to access more SMS service channels and SMS businesses in the future. , since the specifications such as call parameters and return data have been unified, it will not affect the use of the original interface.

Interface call (calling instructions)

Before sending a text message, you must first complete the application for template and signature. After logging into the market, click the user avatar in the upper right corner and select "My Services" ->SMS Service", you can apply for it in signature management and template management. After passing the review, you can send SMS calls. Once the inspection finds that any illegal content has been sent, we will freeze the signatures and templates, the purchased package fees will not be refunded, and we reserve the right to pursue relevant responsibilities.

Request address

GET https://api.topthink.com/sms/send

Request parameter

Detailed introduction to ThinkAPI SMS service

Return data parameter

Detailed introduction to ThinkAPI SMS service

Note: The confirmation of final success of SMS sending is asynchronously confirmed by the operator, so you need to go to My Services->SMS Service->Send Letter Confirm in the record, and the final billing will be based on the number of successes in the sending record.

SDK call

$client = new Client("YourAppCode");
$result = $client->smsSend()
    ->withSignId('78')
    ->withTemplateId('234')
    ->withPhone('15687902345')
    ->withParams('{"code": "7865"}')
    ->request();
dump($result);

Return result example:

{
"code": 0,
"message": "发送成功",
"data":{
    "id": "6055df2f45e10"
    }
}

→Interface fee (from ¥0.035/click to purchase)

→The current single price for notification text messages and verification code text messages starts at ¥0.035, and the number of times is purchased in a package package.

More interface services

ThinkAPI unified API interface service is a set of interface calling services and SDK encapsulated by official joint partners, designed to help ThinkPHP It is more convenient and cost-effective for developers to call various API interfaces and services provided by official and third parties, thereby better building a developer ecosystem.

Recommended: "The latest 10 thinkphp video tutorials"

The above is the detailed content of Detailed introduction to ThinkAPI SMS service. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:thinkphp.cn. If there is any infringement, please contact admin@php.cn delete