[英]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:以下是设置示例应用程序的步骤摘要:
Amazon SNS
Service → Topics
导航到Amazon SNS
服务 → Topics
Name
and create a new Topic输入Name
并创建一个新主题AWS Lambda
(see image1 below)对于新创建的主题,创建一个订阅,其中协议为AWS Lambda
(见下图 1)Amazon Pinpoint
Service, create new Pinpoint application导航到Amazon Pinpoint
Service,创建新的 Pinpoint 应用程序SMS & voice
feature for this Pinpoint application为此 Pinpoint 应用程序启用SMS & voice
功能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)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();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.