Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sample code for pinpointsmsvoicev2 (End User Messaging) #5777

Closed
2 tasks
asardav opened this issue Jan 7, 2025 · 5 comments
Closed
2 tasks

Sample code for pinpointsmsvoicev2 (End User Messaging) #5777

asardav opened this issue Jan 7, 2025 · 5 comments
Assignees
Labels
documentation This is a problem with documentation. p2 This is a standard priority issue

Comments

@asardav
Copy link

asardav commented Jan 7, 2025

Describe the feature

Please provide sample codes for pinpointsmsvoicev2 (End User Messaging)

Use Case

Show how to use the AWS SDK for Java 2.x to work with End User Messaging

Proposed Solution

No response

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

AWS Java SDK version used

v2

JDK version used

21

Operating System and version

MAC

@asardav asardav added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 7, 2025
@debora-ito debora-ito added documentation This is a problem with documentation. and removed feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jan 7, 2025
@debora-ito debora-ito self-assigned this Jan 7, 2025
@debora-ito debora-ito added the p2 This is a standard priority issue label Jan 7, 2025
@debora-ito
Copy link
Member

Hi @asardav, I'm using the Python SDK example from the End User Messaging SMS documentation as a base:

        PinpointSmsVoiceV2Client client = PinpointSmsVoiceV2Client.builder()
                .region(Region.US_WEST_2)
                .build();

        String CONFIGURATION_SET = "MyConfigurationSet";
        String DESTINATION_NUMBER = "+12065550123";
        String ORIGINATION_NUMBER = "+18445550142";
        String MESSAGE = "<speak>" +
            "This is a test message sent from <emphasis>AWS End User Messaging SMS</emphasis>" +
            "using the <break strength='weak'/> AWS SDK for Java. " +
            "<amazon:effect phonation='soft'>Thank you for listening." +
            "</amazon:effect>" +
            "</speak>";

        SendVoiceMessageRequest request = SendVoiceMessageRequest.builder()
                .configurationSetName(CONFIGURATION_SET)
                .context(Map.of("my-key", "my-value"))
                .destinationPhoneNumber(DESTINATION_NUMBER)
                .maxPricePerMinute("2.00")
                .messageBody(MESSAGE)
                .messageBodyTextType(VoiceMessageBodyTextType.SSML)
                .originationIdentity(ORIGINATION_NUMBER)
                .timeToLive(120)
                .voiceId(VoiceId.MATTHEW)
                .dryRun(true)
                .build();

        SendVoiceMessageResponse response = client.sendVoiceMessage(request);

Let me know if this is what you were looking for.

@asardav
Copy link
Author

asardav commented Jan 8, 2025

yes. Can you add examples for sending MMS, SMS as well

@debora-ito
Copy link
Member

The other APIs follow the same idea, just fill the request with the relevant attributes.

Here's SendTextMessage (Javadoc):

        SendTextMessageRequest textRequest = SendTextMessageRequest.builder()
                .configurationSetName(CONFIGURATION_SET)
                .context(Map.of("my-key", "my-value"))
                .destinationPhoneNumber(DESTINATION_NUMBER)
                .destinationCountryParameters(
                        Map.of(DestinationCountryParameterKey.IN_ENTITY_ID, "ENTITY98765",
                                DestinationCountryParameterKey.IN_TEMPLATE_ID, "TEMPLATE01234"))
                .keyword(KEYWORD)
                .maxPrice("2.00")
                .messageBody(MESSAGE)
                .messageType(MessageType.TRANSACTIONAL)
                .originationIdentity(ORIGINATION_NUMBER)
                .timeToLive(120)
                .dryRun(true)
                .build();

        SendTextMessageResponse textResponse = client.sendTextMessage(textRequest);

I'll reach out the Documentation team and ask to add examples using the Java SDK to the page.

@debora-ito
Copy link
Member

Created an internal ticket to the Docs team. Resolving this.

Copy link

github-actions bot commented Jan 9, 2025

This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation This is a problem with documentation. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

2 participants