Hey everyone so I am trying to send an SMS message via amazon pinpoint using a toll-free number via nodejs. Note the numbers in this code have been changed for security. Heres my code:
router.get("/send-text", async (req, res, next) => {
try {
const sender = "+18446850251";
const destinationNumber = "+14325948991";
const message = "HELLO from AWS";
const applicationId = "myApplicationId";
const messageType = "TRANSACTIONAL";
AWS.config.update({ region: "us-east-1" });
const pinpoint = new AWS.Pinpoint();
const params = {
ApplicationId: applicationId,
MessageRequest: {
Addresses: {
[destinationNumber]: {
BodyOverride: message,
ChannelType: "SMS"
}
},
MessageConfiguration: {
SMSMessage: {
Body: message,
MessageType: messageType,
OriginationNumber: sender
}
}
}
};
const result = await pinpoint.sendMessages(params).promise();
res.send(result);
} catch (error) {
console.log(error);
next(error);
}
});
Upon running this code I get the following response:
{
MessageResponse: {
ApplicationId: "myApplicationId",
RequestId: "8beaebf0-f33a-42d3-bb88-1f3efcf493eb",
Result: {
+14325948991: {
DeliveryStatus: "PERMANENT_FAILURE",
StatusCode: 404,
StatusMessage: "Resource not found"
}
}
}
}
Side note: the reason I am doing this is that I received an email from AWS and my understanding is that I can no longer send text messages via the application to a person (a 10 digit long code) via SNS topics and must send them via pinpoint using a 10DLC long code or toll-free number starting June 1st is that correct?
SNS messaging was not explicitly enabled. Make sure you double-check this setting