Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to send the sms to the user via Amazon SNS .i wrote the following code in vb.net but error occured "The message attribute 'AWS.SNS.SMS.SMSType' has an invalid message attribute type, the set of supported type prefixes is Binary, Number, and String."....... i Don't know where the problem in the code.my code on button click event is:

What I have tried:

 Imports Amazon.SimpleNotificationService
 Imports Amazon.SimpleNotificationService.Model
 Public Class Form1
     Dim myclient As New AmazonSimpleNotificationServiceClient
     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim snsreq As New PublishRequest
        Dim snsres As New PublishResponse
        Dim snsmsgstng As New Dictionary(Of String, MessageAttributeValue)()
        snsmsgstng.Add("AWS.SNS.SMS.SenderID", New MessageAttributeValue() With {.StringValue = "testing", .DataType = "string"})
        snsmsgstng.Add("AWS.SNS.SMS.SMSType", New MessageAttributeValue() With {.StringValue = "Promotional", .DataType = "string"})
        snsreq.MessageAttributes = snsmsgstng
        snsreq.PhoneNumber = "+972543784512"     'phone No
        snsreq.Message = "you get message ,if yes then tells me???.."
        snsres = myclient.Publish(snsreq)
     End Sub
End Class

i also add following in app.config
<appSettings  >
 <add  key="AWSAccessKey" value="MYAWSAccessKey" />
 <add key="AWSSecretKey" value="MYAWSSecretKey"/>
 <add key="AWSRegion" value="ap-southeast-1"/>
</appSettings>


please tell me where i should change the code...!!!
Posted
Updated 28-May-19 19:03pm

1 solution

.DataType is CaSe SeNsItIve ....

Try "String" (instead of "string").
 
Share this answer
 
Comments
Member 14197412 29-May-19 8:05am    
thank you so much..it is really working ...i can't believe that this can working by such little change...i appreciate you for reading appropriately and respond to me....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900