如何将twilio导入nodejs es模块?
const client = require("twilio")(YOUR_ACCOUNT_SID, YOUR_AUTH_TOKEN);
Run Code Online (Sandbox Code Playgroud) 有什么方法可以在我的两个用户之间拨打电话吗?我的意思是...我有一个带有注册号码的 twilio 帐户,我必须给我的客户“Bill”打电话,所以当他接听电话时,电话应该重定向到 Bill 选择的另一个客户,让我们说“Joe” ”。因此,比尔点击了一个按钮,他的电话响了,他接听并开始给乔打电话。当其中一些人挂断电话时,所有通话就应该结束。有人做过吗?帮我!我很抱歉我的英语不好(哦是的,我正在使用 php)
我正在使用此链接中的代码进行传出浏览器调用。我正在使用与链接中显示的相同的代码,也使用 twiML 应用程序。
我正在使用升级的 twilio 帐户。我尝试拨打我的号码,但没有接听电话。
1) 为什么它显示两个条目 - 即使我只是在拨出电话,通话记录中也会显示两个条目 - 拨出拨号和来电?
通话记录
DATE DIRECTION FROM TO TYPE STATUS RECORDING DURATION
14:52:54 UTC
2016-11-29 Outgoing Dial (512) xxx-xxxx +91xxxxxxxxxx Phone No Answer — —
14:52:53 UTC
2016-11-29 Incoming Anonymous — Client Completed — 37 secs
Run Code Online (Sandbox Code Playgroud)
此外,当我从日志中单击来电的通话详情时,显示通话费用为 0.0025 美元。
2) 为什么我不接电话也要收费?
请帮我澄清这些疑问。提前致谢。
我让 twilio 工作了一段时间,但我想进行一些更改并将发送错误所带来的数字保存在数据库中以避免再次发送它们,不知何故,Twilio 停止工作。我从没有显示错误的浏览器中使用它,但是当我尝试从命令行运行脚本文件时出现了这些错误。
任何帮助表示赞赏。
PHP Notice: Use of undefined constant CURLOPT_URL - assumed 'CURLOPT_URL' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 80
PHP Notice: Use of undefined constant CURLOPT_HEADER - assumed 'CURLOPT_HEADER' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 81
PHP Notice: Use of undefined constant CURLOPT_RETURNTRANSFER - assumed 'CURLOPT_RETURNTRANSFER' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 82
PHP Notice: Use of undefined constant CURLOPT_INFILESIZE - assumed 'CURLOPT_INFILESIZE' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 83
PHP Notice: Use of undefined constant CURLOPT_HTTPHEADER - assumed 'CURLOPT_HTTPHEADER' in /var/www/twilio/twilio-php-master/Twilio/Http/CurlClient.php on line 84 …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用curl向我的手机发送消息:
curl -X POST 'https://api.twilio.com/2010-04-01/Accounts/<my-trial-sid>/Messages.json' \
--data-urlencode 'To=+<my-phone-number>' \
--data-urlencode 'From=+15005550006' \
--data-urlencode 'Body=Hello from twilio' \
-u <my-trial-sid>:<my-trial-token>
Run Code Online (Sandbox Code Playgroud)
然而我从来没有在电话里收到过这条消息。响应显示状态为“已排队”。是什么阻止了它被发送?
我得到的完整回复:
{"sid": "SM18ce5f04a0ed4d6e8bfdc91d862d7b7f", "date_created": "Wed, 08 Mar 2017 01:59:07 +0000", "date_updated": "Wed, 08 Mar 2017 01:59:07 +0000", "date_sent": null, "account_sid": "<my-trial-sid>", "to": "+<my-phone-number>", "from": "+15005550006", "messaging_service_sid": null, "body": "Sent from your Twilio trial account - Hello from twilio", "status": "queued", "num_segments": "1", "num_media": "0", "direction": "outbound-api", "api_version": "2010-04-01", "price": null, "price_unit": "USD", "error_code": null, "error_message": null, "uri": "/2010-04-01/Accounts/<my-trial-sid>/Messages/SM18ce5f04a0ed4d6e8bfdc91d862d7b7f.json", "subresource_uris": {"media": …Run Code Online (Sandbox Code Playgroud) 我正在开发一个使用 Twillios Programmable Video API 的应用程序。
我是使用 Node JS 的新手,但文档相当简单,但我仍然有一些问题。
这是我引用的代码。
const AccessToken = require('twilio').jwt.AccessToken;
const VideoGrant = AccessToken.VideoGrant;
// Used when generating any kind of tokens
const twilioAccountSid = 'ACxxxxxxxxxx';
const twilioApiKey = 'SKxxxxxxxxxx';
const twilioApiSecret = 'xxxxxxxxxxxx';
const identity = 'user';
// Create Video Grant
const videoGrant = new VideoGrant({
room: 'cool room'
});
// Create an access token which we will sign and return to the client,
// containing the grant we just created
const token = …Run Code Online (Sandbox Code Playgroud) 我已经使用 Twilio api 发送通知消息。消息发送正常。
$notification = $client
->notify->services($serviceSid)
->notifications->create([
"toBinding" => [
'{"binding_type":"sms", "address":"+971444444444"}',
'{"binding_type":"sms", "address":"+971444444445"}'
],
'body' => 'Test message 8'
]);
Run Code Online (Sandbox Code Playgroud)
请求的响应是 201 并返回以'NT'. 如何跟踪此消息的状态?
我有一个具有语音和短信功能的 Twilio 手机号码。我可以在 Zoiper 中拨打和接听电话,但我不知道如何设置它以便我也可以发送/接收短信。没有关于如何执行此操作的指南。我该如何设置?
我正在关注有关如何使用我的应用程序回复短信的 Twilio 教程: https://www.twilio.com/docs/sms/tutorials/how-to-receive-and-reply-node-js
本教程假设您使用的是 Express,但我使用 Cloud Function 执行此操作,因此我的代码看起来有点不同:
exports.sms = functions.https.onCall((req: any, res: any) => {
const twiml = new MessagingResponse();
if (req.body.Body === 'hello') {
twiml.message('Hi!');
} else if (req.body.Body === 'bye') {
twiml.message('Goodbye');
} else {
twiml.message(
'No Body param match, Twilio sends this in the request to your server.',
);
}
res.writeHead(200, { 'Content-Type': 'text/xml' });
res.end(twiml.toString());
});
Run Code Online (Sandbox Code Playgroud)
当我向 Twilio # 发送短信时,它会到达该端点,但出现以下错误:
请求的内容类型不正确。应用程序/x-www-form-urlencoded
我该如何解决这个问题?
我正在尝试通过发送网格使用电子邮件验证服务,在编写所有占位符后,我收到此错误:“SendGrid 模板不包含所需的占位符”,并且我找不到任何解决方案。
有人可以指导我吗?谢谢你!
twilio ×10
twilio-api ×10
twilio-php ×3
node.js ×2
firebase ×1
javascript ×1
php ×1
sendgrid ×1
sip ×1
sms ×1
voip ×1