如何在.NET中进行交互式短信?
我想编写一个向用户发送短信的应用程序,当收件人回复短信时,我会收到该响应,包括原始电话号码,并且我的程序可以对该响应做出反应。
我在谷歌上搜索了“交互式短信”,但没有找到任何明显合适的内容。有其他人这样做过吗,对提供这种功能的付费服务有什么建议吗?
或者,对于如何将此服务构建到我的应用程序中(可能用 C# 编写),您还有其他建议吗?
I want to write an app that sends an SMS to users, and when the recipients texts back, I receive that response, including the originating phone number, and my program can react to that response.
I've googled "Interactive SMS" but didn't find anything that was clearly a fit. Has anyone else done this, got any recommendations for a paid service that provides this kind of functionality?
Alternatively, do you have any other recommendations for how to build this service into my app, which will probably be written in C#?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
查找 SMS 服务提供商 为您提供可以使用的 API(例如 HTTP API)。然后阅读他们的文档。
Find an SMS service provider that gives you an API you can use (e.g. an HTTP API). Then read their documentation.
您需要了解SMPP(短消息点对点)协议。是通常用于与运营商的SMSC(短信服务中心)通信的协议。 这是一篇博客文章,总结了一些 C# SMPP 库。如果您不想使用现有的 .NET 库,您始终可以编写自己的库。毕竟 SMPP 并不是一个非常复杂的协议。
另一种方法可能是将您的应用程序附加到手机上,如果该手机为您提供 API,则可以使用它来发送和接收文本。这里的问题是,如果您的应用程序预计每天发送和接收数十万条短信,那么它就无法扩展。
另一种选择是使用 CARRIER AGGREGATOR 公司,该公司为您的应用程序提供 API。有一些,但我不知道他们是否能够为您提供一个简短的代码以及在您的申请中接收短信的可能性。根据您的目标市场,您应该对其他增值服务公司在该市场的做法进行一些研究。
You need to learn about SMPP (short message peer to peer) protocol. Is the protocol usually used to communicate with carrier's SMSC (Short Message Service Center). Here's a blog entry summarizing the actual status of some C# SMPP libraries. If you don't want to use an existing .NET library, you can always write your own. SMPP is not a very complex protocol after all.
An alternative might be attach your application to a cell phone, and if that cell phone provides you with an API, use it to send and receive texts. The problem here is that it won't scale if your application expects to send and receive hundreds of thousands of text messages per day.
Yet another alternative will be to use a CARRIER AGGREGATOR company that provides you with an API for your application. There are some out there, but I don't know if they will be able to offer you a short code and the possibility to receive texts in your application. Depending on the market you are targeting, you should do a little bit of research on how other VAS companies do it over there.
为此,您可以使用 TextMarks API。它基于 REST,并且使用起来超级简单。如此简单,哈佛用它来教新生如何使用 API。文档此处。
You can use the TextMarks API for this. It's REST-based and super simple to use. So simple that Harvard uses it to teach new students how to use APIs. Docs here.
从用户路由到您的消息称为 MO 消息(移动发起),大多数第 3 方 SMS 网关实现简单的 API,从而它们将简单地通过 HTTP 向您发送传入消息(包括发起者 msisdn 和家庭网络)。
例如 http://www.clickatell.com/products/two_way.php
搜索为其他人提供 SMS 网关的站点。
Messages routed to you from a user are called MO messages (Mobile Originated) and most 3rd party SMS gateways implement simple api's whereby they will simply HTTP post you incoming messages (including the originators msisdn and home network).
For example http://www.clickatell.com/products/two_way.php
Search the site for SMS Gateways for others.
检查 SMS Studio - 人们在这个主题上做了很多工作,也许你可以使用 -搁置软件或对其进行一些定制以满足您的需求。
如果没有,至少你可以通过谷歌搜索找到一些好的关键词。
无论如何,您将有一个选择 - 要么使用 SMS 网关,要么对于低容量的 SMS 流量,您可以使用 GSM 调制解调器并手动处理,但不建议这样做。
Check SMS Studio - guys have done a lot on that subject and maybe you can use of-the-shelve software or customize it a little to suit your needs.
If not, at least you can find some good keywords for googling.
Anyway, you will have a choice - either go with SMS gateway, or for low volume SMS traffic, you can go with GSM Modem and handle it manually, though it's not recommended.