AWS Pinpoint sendMessages() Addresses param field error
I'm having trouble replicating the format of the params object's Addresses format in a way where I can easily add to the object.
If I use this as the params with destinationNumber[0]
and destinationNumber[1]
in the format of 1 + 9 digit number ie 13334535667
then it sends the message to both numbers no problem.
const params = {
ApplicationId: applicationId,
MessageRequest: {
Addresses: {
[destinationNumber[0]]: {
ChannelType: 'SMS'
},
[destinationNumber[1]]: {
ChannelType: 'SMS'
}
},
MessageConfiguration: {
SMSMessage: {
Body: message,
Keyword: registeredKeyword,
MessageType: messageType,
OriginationNumber: originationNumber
}
}
}
};
I'm trying to replicate this format for Addresses
, but I'm getting Unexpected key '13334535667' found in params.MessageRequest.Addresses['0']
. The format my console output shows for Addresses is
[
{ '12345678910': { ChannelType: 'SMS' } },
{ '12345678911': { ChannelType: 'SMS' } }
]
I'm using a map to call this
function createPhoneMessagingObject(phoneNumber: string) {
return {
[phoneNumber]: {
ChannelType: 'SMS'
}
};
}
I tried wrapping key in array like in phone object, but per the output, the brackets goes away so maybe there's an easier/more correct way of doing this. I appreciate any help!
How many English words
do you know?
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
how many words do you know
Powered by Examplum