用于发送短信的 Amazon AWS SNS 无法发送短信,return 状态为 "WaitingForActivation"
Amazon AWS SNS For Sending SMS could not send SMS , return status is "WaitingForActivation"
我是 AWS 的新手,正在尝试设置我的系统以向最终用户 post 预订发送短信作为确认消息。
到目前为止,我做了以下操作:
AmazonSimpleNotificationServiceClient smsClient = new AmazonSimpleNotificationServiceClient(key, secreteKey, token, Amazon.RegionEndpoint.APSoutheast2);
var smsAttributes = new Dictionary<string, MessageAttributeValue>();
MessageAttributeValue senderID = new MessageAttributeValue();
senderID.DataType = "String";
senderID.StringValue = "my-sender-id";
MessageAttributeValue sMSType = new MessageAttributeValue();
senderID.DataType = "String";
senderID.StringValue = "Transactional";
CancellationTokenSource source = new CancellationTokenSource();
CancellationToken token = source.Token;
smsAttributes.Add("SenderID", senderID);
smsAttributes.Add("SMSType", sMSType);
PublishRequest publishRequest = new PublishRequest();
publishRequest.Message = "This is 2nd sample message";
publishRequest.MessageAttributes = smsAttributes;
publishRequest.PhoneNumber = "my number with + and country code";
Task<PublishResponse> result = smsClient.PublishAsync(publishRequest, token);
但是我没有收到任何短信。
当我调试代码时,我看到以下消息:
谁能帮忙。
我通过以下更改解决了这个问题,
将 SenderID 更改为 AWS.SNS.SMS.SenderID
和 sMSType 到 AWS.SNS.SMS.SMSType
总的来说,整体流量就像
下载 AWSSDK nugget for simple notification v3.3.5.12
使用下面的简单方法发送单条短信。
下面是 C#.NET 核心 1.1 的工作片段
AmazonSimpleNotificationServiceClient smsClient = new AmazonSimpleNotificationServiceClient(my_access_key, my_secret_key, Amazon.RegionEndpoint.APSoutheast2);
var smsAttributes = new Dictionary<string, MessageAttributeValue>();
MessageAttributeValue senderID = new MessageAttributeValue();
senderID.DataType = "String";
senderID.StringValue = "mySenderId";
MessageAttributeValue sMSType = new MessageAttributeValue();
sMSType.DataType = "String";
sMSType.StringValue = "Transactional";
MessageAttributeValue maxPrice = new MessageAttributeValue();
maxPrice.DataType = "Number";
maxPrice.StringValue = "0.5";
CancellationTokenSource source = new CancellationTokenSource();
CancellationToken token = source.Token;
smsAttributes.Add("AWS.SNS.SMS.SenderID", senderID);
smsAttributes.Add("AWS.SNS.SMS.SMSType", sMSType);
smsAttributes.Add("AWS.SNS.SMS.MaxPrice", maxPrice);
PublishRequest publishRequest = new PublishRequest();
publishRequest.Message = "This is 2nd sample message";
publishRequest.MessageAttributes = smsAttributes;
publishRequest.PhoneNumber = "received phone no with + and country code";
Task<PublishResponse> result = smsClient.PublishAsync(publishRequest, token);
我是 AWS 的新手,正在尝试设置我的系统以向最终用户 post 预订发送短信作为确认消息。
到目前为止,我做了以下操作:
AmazonSimpleNotificationServiceClient smsClient = new AmazonSimpleNotificationServiceClient(key, secreteKey, token, Amazon.RegionEndpoint.APSoutheast2);
var smsAttributes = new Dictionary<string, MessageAttributeValue>();
MessageAttributeValue senderID = new MessageAttributeValue();
senderID.DataType = "String";
senderID.StringValue = "my-sender-id";
MessageAttributeValue sMSType = new MessageAttributeValue();
senderID.DataType = "String";
senderID.StringValue = "Transactional";
CancellationTokenSource source = new CancellationTokenSource();
CancellationToken token = source.Token;
smsAttributes.Add("SenderID", senderID);
smsAttributes.Add("SMSType", sMSType);
PublishRequest publishRequest = new PublishRequest();
publishRequest.Message = "This is 2nd sample message";
publishRequest.MessageAttributes = smsAttributes;
publishRequest.PhoneNumber = "my number with + and country code";
Task<PublishResponse> result = smsClient.PublishAsync(publishRequest, token);
但是我没有收到任何短信。
当我调试代码时,我看到以下消息:
谁能帮忙。
我通过以下更改解决了这个问题, 将 SenderID 更改为 AWS.SNS.SMS.SenderID 和 sMSType 到 AWS.SNS.SMS.SMSType
总的来说,整体流量就像
下载 AWSSDK nugget for simple notification v3.3.5.12
使用下面的简单方法发送单条短信。
下面是 C#.NET 核心 1.1 的工作片段
AmazonSimpleNotificationServiceClient smsClient = new AmazonSimpleNotificationServiceClient(my_access_key, my_secret_key, Amazon.RegionEndpoint.APSoutheast2);
var smsAttributes = new Dictionary<string, MessageAttributeValue>();
MessageAttributeValue senderID = new MessageAttributeValue();
senderID.DataType = "String";
senderID.StringValue = "mySenderId";
MessageAttributeValue sMSType = new MessageAttributeValue();
sMSType.DataType = "String";
sMSType.StringValue = "Transactional";
MessageAttributeValue maxPrice = new MessageAttributeValue();
maxPrice.DataType = "Number";
maxPrice.StringValue = "0.5";
CancellationTokenSource source = new CancellationTokenSource();
CancellationToken token = source.Token;
smsAttributes.Add("AWS.SNS.SMS.SenderID", senderID);
smsAttributes.Add("AWS.SNS.SMS.SMSType", sMSType);
smsAttributes.Add("AWS.SNS.SMS.MaxPrice", maxPrice);
PublishRequest publishRequest = new PublishRequest();
publishRequest.Message = "This is 2nd sample message";
publishRequest.MessageAttributes = smsAttributes;
publishRequest.PhoneNumber = "received phone no with + and country code";
Task<PublishResponse> result = smsClient.PublishAsync(publishRequest, token);