Skip to content

End User Messaging SMS with a Phone Number shared from another account

0

I am trying to implement two-way SMS using AWS End User Messaging.

We have a multiple account structure with one account managing shared resources and this account has an Australian Long Code phone number activated now. I have shared this phone number using Resource Access Manager with another account (used for development). I can see the account is successfully shared with the test account with cli command aws pinpoint-sms-voice-v2 describe-pools --owner SHARED from the dev account.

I can also use the cli to send an SMS to a verified phone number (originator numbers are still in sandbox) successfully.

But when I try to send an sms using Java SDK (software.amazon.awssdk:pinpoint:2:20.136) PinpointClient, the sms delivery fails with a "The provided number does not exist or does not belong to the account" error. This error is in the messageResponse.result, under the destination phone number (verified).

Can you please tell me what I could be doing wrong here?

2 Answers
2

It seems like you're encountering an issue with using a shared phone number from another account in AWS End User Messaging SMS. There are a few things to consider that might help resolve your problem:

  1. Resource Identification: When using shared resources, including phone numbers, you must use the full Amazon Resource Name (ARN) of the resource. This is crucial when working with resources shared across accounts.

  2. API/SDK Usage: While you can see the shared resource using the CLI, it's important to note that shared resources can only be used through the AWS CLI or the AWS End User Messaging SMS and Voice v2 API. The Java SDK you're using (software.amazon.awssdk:pinpoint:2:20.136) might not be compatible with shared resources or the latest End User Messaging SMS features.

  3. Origination Identity: When sending an SMS, make sure you're specifying the OriginationIdentity correctly. For a shared phone number, you should use the full ARN of the phone number, not just the phone number itself.

  4. Permissions: Ensure that the IAM role or user in your development account has the necessary permissions to use the shared phone number. This includes permissions granted through Resource Access Manager as well as any required IAM policies.

  5. API Version: The error message you're receiving suggests you might be using an older version of the Pinpoint API. The End User Messaging SMS service uses a newer API (pinpoint-sms-voice-v2) which has different methods for sending SMS messages.

To resolve this issue:

  1. Update your code to use the latest AWS SDK for Java that supports the pinpoint-sms-voice-v2 API.
  2. When sending the SMS, use the full ARN of the shared phone number as the OriginationIdentity.
  3. Double-check the permissions in your development account to ensure they allow using the shared phone number.
  4. If possible, try sending a message using the AWS CLI with the shared phone number to confirm it works outside of your Java application.

If the issue persists after making these changes, you may need to contact AWS support for further assistance, as there could be account-specific configurations or limitations at play.
Sources
Working with shared resources in AWS End User Messaging SMS - AWS End User Messaging SMS
Share AWS End User Messaging SMS resources across multiple AWS accounts - AWS
SendTextMessage - AWS End User Messaging SMS

answered a year ago
EXPERT
reviewed a year ago
0
Accepted Answer

I was doing two things wrong:

  1. Wrong Java client. I should have used PinpointSmsVoiceV2Client (software.amazon.awssdk:pinpointsmsvoicev2)
  2. The resource policy in the source account (account owning the phone number) need to grant permissions to both the target account root as well as pinpoint service principle (pinpoint.amazonaws.com). Same can be done with RAM as well, but requires two resource shares as you can't add a different type of principal if a service principal is used in the resource share.
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.