RapidAPI logo

Twilio

フリー
開発者 serg.osipchuk
更新日 6ヶ月前
SMS
7.6/10
人気度
12470ms
レイテンシ
79%
正常稼働率

「Twilio 」のドキュメント

SMS、音声、ビデオ、IPメッセージングをプログラム可能にします。

全文を表示する
POSTmakeCall
POSTsendMms
POSTsendSms
POSTwebhookEvent
POSTmakeCall

このブロックでは、音声通話を行うことができます。

ヘッダーパラメータ
X-RapidAPI-HostSTRING
REQUIRED
X-RapidAPI-KeySTRING
REQUIRED
必須パラメータ
accountSidCREDENTIALS
REQUIREDA 34 character string that uniquely identifies this account.
fromSTRING
REQUIREDThe phone number or client identifier to use as the caller id. If using a phone number, it must be a Twilio number or a Verified outgoing caller id for your account.
urlSTRING
REQUIREDThe fully qualified URL that should be consulted when the call connects. Just like when you set a URL on a phone number for handling inbound calls. See the Url Parameter section below for more details.
accountTokenCREDENTIALS
REQUIREDThe authorization token for this account.
toSTRING
REQUIREDThe phone number, SIP address or client identifier to call.
パラメータ(Option)
methodSTRING
OPTIONALThe HTTP method Twilio should use when making its request to the above Url parameter's value. Defaults to POST. If an ApplicationSid parameter is present, this parameter is ignored.
fallbackMethodSTRING
OPTIONALThe HTTP method that Twilio should use to request the FallbackUrl. Must be either GET or POST. Defaults to POST. If an ApplicationSid parameter is present, this parameter is ignored.
recordBOOLEAN
OPTIONALSet this parameter to 'true' to record the entirety of a phone call.
sendDigitsSTRING
OPTIONALA string of keys to dial after connecting to the number, maximum of 32 digits.
recordingStatusCallbackSTRING
OPTIONALThe recordingStatusCallback attribute takes an absolute URL as an argument.
statusCallbackMethodSTRING
OPTIONALThe HTTP method Twilio should use when requesting the above URL. Defaults to POST. If an ApplicationSid parameter is present, this parameter is ignored.
statusCallbackEventSTRING
OPTIONALThe call progress events that Twilio will send webhooks on. Available values are initiated, ringing, answered, and completed.
fallbackUrlSTRING
OPTIONALA URL that Twilio will request if an error occurs requesting or executing the TwiML at Url. If an ApplicationSid parameter is present, this parameter is ignored.
applicationSidSTRING
OPTIONALRequired if url not provided. The 34 character sid of the application Twilio should use to handle this phone call. If this parameter is present, Twilio will ignore all of the voice URLs passed and use the URLs set on the application.
recordingChannelsSELECT
OPTIONALMono or dual. Set this parameter to specify the number of channels in the final recording. Defaults to 'mono'.
timeoutSTRING
OPTIONALThe integer number of seconds that Twilio should allow the phone to ring before assuming there is no answer.
statusCallbackSTRING
OPTIONALA URL that Twilio will send asynchronous webhook requests to on every call event specified in the StatusCallbackEvent parameter. If no event is present, Twilio will send completed by default. If an ApplicationSid parameter is present, this parameter is ignored. URLs must contain a valid hostname.
recordingStatusCallbackMethodSTRING
OPTIONALThe HTTP method Twilio should use when requesting the above URL. Defaults to POST
コードスニペット
unirest.post("https://Twilioserg-osipchukV1.p.rapidapi.com/makeCall")
.header("X-RapidAPI-Host", "Twilioserg-osipchukV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "ログインしてキーを取得")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
サンプルレスポンス
概要
リクエストURL: https://Twilioserg-osipchukV1.p.rapidapi.com/makeCall
リクエストメソッド: POST
レスポンスヘッダ
レスポンスボディ

SDKをインストール(NodeJS)

インストール

Node.jsでUnirestを使用するには、NPMモジュールをインストールしてください。

$ npm install unirest

インストール完了後は、簡単にリクエストを行うことができるようになります。

var unirest = require('unirest');

リクエスト

unirest.post("https://Twilioserg-osipchukV1.p.rapidapi.com/makeCall")
.header("X-RapidAPI-Host", "Twilioserg-osipchukV1.p.rapidapi.com")
.header("X-RapidAPI-Key", "ログインしてキーを取得")
.header("Content-Type", "application/x-www-form-urlencoded")
.end(function (result) {
  console.log(result.status, result.headers, result.body);
});
OAuth2認証
クライアントID
クライアントシークレット
OAuth2認証