Amazon SNS Publish, howto set SenderID using MessageAttributes

0

I have trouble overriding the default SenderID when I Publish an SMS through Amazon SNS using Post. When I send the Post using this content body (phone number is dummy), it works, but uses the default SenderID:

Message=Test&PhoneNumber=+4712345678

My understanding is that I can add a MessageAttributes json like this:

{"AWS.SNS.SMS.SenderID":{"StringValue":"test","DataType":"String"}}

That gives the following content body, but when I try this override:

Message=Test&PhoneNumber=+4712345678&MessageAttributes=%7B%22AWS.SNS.SMS.SenderID%22:%7B%22StringValue%22:%22test%22,%22DataType%22:%22String%22%7D%7D

Then I get 400 Bad Request, and the following response:

{ "Error": { "Code": "MalformedInput", "Message": "End of list found where not expected", "Type": "Sender" }, "RequestId": "fd70e86a-79bc-5250-9e54-b3b397e2b707" }

What am I doing wrong? Do I have to create a pool in Pinpoint for SenderID?

Norway (+47) does not require preregistered SenderID. I'm using Delphi and the library sgcOpenApiAmazon, which is part of sgcWebSockets by esegece.com.

Thanks for any help

::tor

Midiar
已提問 2 年前檢視次數 445 次
1 個回答
0
已接受的答案

I finally found out what the documentation meant, by using aws CLI with the --debug parameter. The following content body worked:

Message=Test&PhoneNumber=+4712345678&MessageAttributes.entry.1.Name=AWS.SNS.SMS.SenderID&MessageAttributes.entry.1.Value.StringValue=test&MessageAttributes.entry.1.Value.DataType=String&

::tor

Midiar
已回答 2 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南