使用Postman调用AWS PinPoint发送SMS时遇请求体无效问题求助
Troubleshooting "Invalid Request Body" Error When Sending SMS via AWS PinPoint with Postman
Hey Jason, sorry to hear you're stuck with this frustrating validation error—let's break down what's likely going wrong with your request payload and fix it up.
First, here are the key issues I spot in your current request body:
- Incorrect variable formatting in
Addresses: You wrapped{{Destination}}in square brackets ([{{Destination}}]), which tells PinPoint you're using a literal string as the phone number instead of your Postman variable. Remove those brackets so the phone number key is just{{Destination}}. - Potentially invalid/unnecessary fields: The
Keywordfield is only required if you're using a dedicated short code with keyword setup. If you haven't configured one, removing this field can avoid validation failures. Also double-check that yourSenderIdmeets AWS's requirements (no special characters, max 11 alphanumeric characters for most regions). - Unreplaced placeholders: Make sure you've swapped out
<MyApplicationID>,<Origination number in E.164 Format>with your actual, valid values—leaving these placeholders in will definitely trigger a validation error.
Here's a cleaned-up, valid version of your request body to test:
{ "ApplicationId": "your-actual-application-id", "MessageRequest": { "Addresses": { "{{Destination}}": { "ChannelType": "SMS" } }, "MessageConfiguration": { "SMSMessage": { "Body": "Test", "SenderId": "ValidSenderID", "MessageType": "TRANSACTIONAL", "OriginationNumber": "+1234567890" } } } }
If you still want to use BodyOverride to customize the message for this specific recipient, add it back inside the recipient's object like this:
"{{Destination}}": { "BodyOverride": "Custom test message for this number", "ChannelType": "SMS" }
A few extra quick checks to rule out other issues:
- Use Postman's built-in JSON validator (switch to the "Raw" tab and select JSON from the dropdown) to catch any syntax errors like missing commas or mismatched brackets.
- Verify your IAM credentials have the
mobiletargeting:SendMessagespermission—while this usually throws a permission error, sometimes misconfigured permissions can manifest as request body issues.
Hopefully this gets your SMS sending working smoothly!
内容的提问来源于stack exchange,提问作者Jason N
相关产品推荐
相关产品推荐

