简体   繁体   中英

Resource not found when attempting to send voice message through AWS Pinpoint

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?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM