Twillio 预约系统出版社
Twillio Appointment System Parse
我正在尝试使 Twilio 与我们的解析服务器集成,我知道如何向人们发送消息,但我感到困惑的是您如何处理对解析服务器的响应。我需要使用传入的数字来处理(仅一次)更改 Parse 中的字段。
我如何在我的服务器上处理这个问题?
这里是 Twilio 开发人员布道者。
当有人向您的 Twilio 号码发送短信时,Twilio will make an HTTP request to a URL that you supply. You can set that URL when you edit one of your phone numbers。然后您需要创建一个应用程序来处理传入的 HTTP 请求。
据我所知,解析服务器是基于 Express 的。所以你大概可以关注 this guide which takes you through setting up a server to receive and then reply to an incoming SMS message with Node.js and Express.
更具体地说,对于 Parse,如果您使用 Parse-Server 项目中的示例代码,则需要执行如下操作:
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var app = express();
var api = new ParseServer({
databaseURI: 'mongodb://localhost:27017/dev', // Connection string for your MongoDB database
cloud: '/home/myApp/cloud/main.js', // Absolute path to your Cloud Code
appId: 'myAppId',
masterKey: 'myMasterKey', // Keep this key secret!
fileKey: 'optionalFileKey',
serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed
});
// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);
// Receive incoming Twilio SMS messages
app.post('/messages', function(req, res) {
console.log(req.body.Body);
// do something
// send an empty response to Twilio
res.send("<Response />");
});
app.listen(1337, function() {
console.log('parse-server-example running on port 1337.');
});
如果这有帮助,请告诉我。
我正在尝试使 Twilio 与我们的解析服务器集成,我知道如何向人们发送消息,但我感到困惑的是您如何处理对解析服务器的响应。我需要使用传入的数字来处理(仅一次)更改 Parse 中的字段。
我如何在我的服务器上处理这个问题?
这里是 Twilio 开发人员布道者。
当有人向您的 Twilio 号码发送短信时,Twilio will make an HTTP request to a URL that you supply. You can set that URL when you edit one of your phone numbers。然后您需要创建一个应用程序来处理传入的 HTTP 请求。
据我所知,解析服务器是基于 Express 的。所以你大概可以关注 this guide which takes you through setting up a server to receive and then reply to an incoming SMS message with Node.js and Express.
更具体地说,对于 Parse,如果您使用 Parse-Server 项目中的示例代码,则需要执行如下操作:
var express = require('express');
var ParseServer = require('parse-server').ParseServer;
var app = express();
var api = new ParseServer({
databaseURI: 'mongodb://localhost:27017/dev', // Connection string for your MongoDB database
cloud: '/home/myApp/cloud/main.js', // Absolute path to your Cloud Code
appId: 'myAppId',
masterKey: 'myMasterKey', // Keep this key secret!
fileKey: 'optionalFileKey',
serverURL: 'http://localhost:1337/parse' // Don't forget to change to https if needed
});
// Serve the Parse API on the /parse URL prefix
app.use('/parse', api);
// Receive incoming Twilio SMS messages
app.post('/messages', function(req, res) {
console.log(req.body.Body);
// do something
// send an empty response to Twilio
res.send("<Response />");
});
app.listen(1337, function() {
console.log('parse-server-example running on port 1337.');
});
如果这有帮助,请告诉我。