如何从Twilio函数中连接到SQL Server数据库
当我的Twilio号码发出短信时,我希望关联的功能查询我的SQL Server数据库,以确定我是否具有与此数字关联的名称。
我可以从node.js代码中连接我的twilio函数写在外部数据库中吗?
When a text message comes in to my Twilio number, I would like the associated function to query my SQL Server database to be able to determine if I have a name associated with this number.
Can I connect from within the node.js code that my Twilio function is written in to an external database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以从Twilio函数中连接到SQL数据库。我建议您阅读此博客文章,这是连接到连接到来自Twilio函数的MySQL数据库。在博客文章中,代码使用
mySQL
节点软件包连接到数据库并发送SQL命令。对于SQL Server,您可以使用node-mssql
package。您也可以使用ORM来更容易提出请求。
博客文章确实使用了旧版本的函数,我建议使用功能服务,但是其他所有内容都应按照所述工作。
You can connect to a SQL database from within a Twilio Function. I recommend you read this blog post, which is a good example of connecting to a MySQL database from a Twilio Function. In the blog post, the code uses the
mysql
Node package to connect to a database and send SQL commands. For SQL Server you can use thenode-mssql
package. You could also use an ORM to make it easier to make requests.The blog post does use the older version of Functions, I recommend Function Services, but everything else should work as described.