1

I currently have a Node.js service to send a voice call through AWS Pinpoint. However, I'm getting a Resource not found response after making a call. I tested with PinpointSMSVoice.sendVoiceMessage which succeeds in making the call. The one that doesn't work is Pinpoint.sendMessages. My request object looks like this:

{
  ApplicationId: 'project-id',
  MessageRequest: {
    Addresses: {
      ['destination-number']: {
        ChannelType: 'VOICE',
        Substitutions: {
          // Using a template
        }
      }
    },
    MessageConfiguration: {
      VoiceMessage: {
        LanguageCode: 'en-US',
        OriginationNumber: 'origination-number'
      }
    },
    TemplateConfiguration: {
      VoiceTemplate: {
        Name: 'voice-template
      }
    }
  }
};

pinpoint.sendMessages(requestObj, callback);

I should note that I am not in sandbox mode, it was approved and moved to production mode. I have tested the same setup with SMS which works perfectly well. I'm not quite sure what the difference is between PinpointSMSVoice.sendVoiceMessage and Pinpoint.sendMessages, except for the fact that Pinpoint.sendMessages allows me to set a template. Any ideas on what else I could be missing?

march
  • 21
  • 3

2 Answers2

1

I'm encountering the same issue. It works using PinPointSMSVoice client, but that won't let me use a template. I've also tested this using V3 of the AWS JS SDK, which modularizes the clients @aws-sdk/client-pinpoint-sms-voice and @aws-sdk/client-pinpoint, but the behaviour is the same. It works uses the same tempplate in the 'Test Message' feature in the console, so seems to be a JS SDK issue. I suggest you raise the issue with JS SDK team https://github.com/aws/aws-sdk-js-v3

bmur
  • 406
  • 2
  • 6
0

When you use PinPoint to perform the sendVoiceMessage operation, you need to set the content type to application/json. If you do not, you get this exception. To see an example (this is the AWS Java API), see this Github URL:

https://github.com/awsdocs/aws-doc-sdk-examples/blob/master/javav2/example_code/pinpoint/src/main/java/com/example/pinpoint/SendVoiceMessage.java

smac2020
  • 9,637
  • 4
  • 24
  • 38
  • I was able to send a voice call with `sendVoiceMessage` from (`pinpointSMSVoice`) without setting the content type. The one I'm having problems with is `sendMessages` from (`pinpoint`, different client from the other one). This is the specific client https://github.com/awsdocs/aws-doc-sdk-examples/tree/master/javascript/example_code/pinpoint. The docs list voice as an option here https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/pinpoint.html#Pinpoint.Client.send_messages. Any ideas on why this client isn't working for voice? – march Jan 08 '21 at 04:33
  • My colleague tested this with the new JS client. Looks like there is an issue. Recommend that you open a ticket with the JavaScript SDK team.- https://github.com/aws/aws-sdk-js-v3 – smac2020 Jan 08 '21 at 15:02