简体   繁体   English

有没有人建立与任何短信接收器的集成?

[英]Has anyone built an integration with any SMS Receivers?

I want to be able to send a text message to some number and then (upon receiving the text) basically just send a post request off to a different service after receiving the text.我希望能够向某个号码发送短信,然后(在收到短信后)基本上只是在收到短信后向不同的服务发送邮寄请求。 Does anyone know of a service I could use to set this up?有谁知道我可以用来设置它的服务? Would like for it to be as fast as possible希望它尽可能快

Here's a summary of the steps to setup a sample app:以下是设置示例应用程序的步骤摘要:

  1. Navigate to Amazon SNS Service → Topics导航到Amazon SNS服务 → Topics
  2. Enter Name and create a new Topic输入Name并创建一个新主题
  3. For the newly created topic, create a subscription where the Protocol is AWS Lambda (see image1 below)对于新创建的主题,创建一个订阅,其中协议为AWS Lambda (见下图 1)
  4. Navigate to Amazon Pinpoint Service, create new Pinpoint application导航到Amazon Pinpoint Service,创建新的 Pinpoint 应用程序
  5. Enable SMS & voice feature for this Pinpoint application为此 Pinpoint 应用程序启用SMS & voice功能
  6. Get a new Long Code (long code price is $1/month)获取新的长码(长码价格为 $1/月)
  7. For the long code, Enable two-way SMS , select the Choose an existing SNS topic option and select the SNS topic created in Step 2 above (see image2 below)对于长代码, Enable two-way SMS ,选择Choose an existing SNS topic选项并选择在上面的步骤 2 中创建的 SNS 主题(见下图 2)
  8. Finally, now you can send a message to that phone number from your phone and it will trigger your lambda function.最后,现在您可以从您的手机向该电话号码发送一条消息,它将触发您的 lambda 函数。 In your lambda function, you can send a POST request to a different service or do whatever else.在您的 lambda 函数中,您可以向不同的服务发送 POST 请求或执行其他任何操作。 You can also respond back to the user's message - see example below.您还可以回复用户的消息 - 请参见下面的示例。

Here's an example of how to send a message using Amazon Pinpoint in Java:以下是如何在 Java 中使用 Amazon Pinpoint 发送消息的示例:

public void sendSMS(String pinpointPhoneNumber, String userPhoneNumber, String messageContent) {
    // define who the message is going to and via what platform
    Map<String, AddressConfiguration> addressMap = new HashMap<>();
    addressMap.put(userPhoneNumber, new AddressConfiguration().withChannelType(ChannelType.SMS));

    SMSMessage smsMessage = new SMSMessage();
    smsMessage.setOriginationNumber(pinpointPhoneNumber);
    smsMessage.setMessageType(MessageType.TRANSACTIONAL);
    smsMessage.setBody(messageContent);

    // add sms message to the direct message config
    // this can have many other types of messages
    DirectMessageConfiguration directMessageConfiguration = new DirectMessageConfiguration()
        .withSMSMessage(smsMessage);

    // put the phone numbers and all messages in here
    MessageRequest messageRequest = new MessageRequest()
        .withAddresses(addressMap)
        .withMessageConfiguration(directMessageConfiguration);

    // create send request
    SendMessagesRequest sendMessagesRequest = new SendMessagesRequest()
        .withApplicationId("put-pinpoint-app-id-here")
        .withMessageRequest(messageRequest);

    // send the message
    AmazonPinpoint pinpointClient = AmazonPinpointClientBuilder.standard().build();
    SendMessagesResult sendMessagesResult = pinpointClient.sendMessages(sendMessagesRequest);
    MessageResponse messageResponse = sendMessagesResult.getMessageResponse();
}

创建 Lambda 函数的 SNS 主题订阅 Amazon Pinpoint 的双向 SMS 配置

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 有没有人有幸让 .NET 6 REST API 项目在 AWS Z04A7DA3C5B05CAD85DA1EEBB923 中工作? - Has anyone had any luck getting a .NET 6 REST API project to work in an AWS Lambda? SMS 的 Amazon AWS SNS 传输状态具有随机日志流 - Amazon AWS SNS Delivery Status For SMS has random Log Streams 有没有人有用于将单个构建的 docker 图像推送到不同 AWS 帐户上的两个不同 ECR 的示例构建规范? - Does anyone have a sample buildspec for pushing single built docker image into two different ECR on different AWS accounts? 设置 CIDR/IP 以便任何人都可以从任何 IP 访问它? - Setting CIDR/IP so anyone can access it from any IP? 有没有人想出如何扩展亚马逊RDS阅读副本? - Has anyone figured out how to scale Amazon RDS read replicas? 有没有人成功使用Amazon OpsWorks部署节点(快速)应用程序? - Has anyone been successful deploying a node (express) app with Amazon OpsWorks? 有没有人在 lambda 中不得不超过 1000 个并发执行? - Has anyone ever had to exceed 1000 concurrent executions in lambda? 有没有人使用Redshift来获取Excel数据透视表? - Has anyone used Redshift to source an Excel pivot table? 有没有人让 OQTANE 在 AWS 应用程序负载均衡器后面工作 - Has anyone gotten OQTANE to work behind an AWS Application Load Balancer AWS - 有没有人成功地使用流量镜像到另一个地区的目标? - AWS - Has anyone successfully used traffic mirroring to a target in another region?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM