├── .env-example ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ └── bug_report.md └── workflows │ ├── build.yml │ └── codeql.yml ├── .gitignore ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── SNIPPETS.md ├── build.gradle ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── src └── main └── java ├── AggregateSnippets.java └── com └── vonage └── quickstart ├── EnvironmentVariables.java ├── account ├── ConfigureAccount.java ├── CreateSecret.java ├── GetBalance.java ├── GetSecret.java ├── ListSecrets.java └── RevokeSecret.java ├── application ├── CreateApplication.java ├── DeleteApplication.java ├── GetApplication.java ├── ListApplications.java └── UpdateApplication.java ├── conversation ├── CreateConversation.java ├── CreateCustomEvent.java ├── CreateEvent.java ├── CreateMember.java ├── DeleteConversation.java ├── DeleteEvent.java ├── GetConversation.java ├── GetEvent.java ├── GetMember.java ├── ListConversations.java ├── ListEvents.java ├── ListMembers.java ├── ListUserConversations.java ├── UpdateConversation.java └── UpdateMember.java ├── custom ├── DeleteRequest.java ├── GetRequestBinary.java ├── GetRequestJsonable.java ├── GetRequestMap.java ├── GetRequestString.java └── PostRequestMap.java ├── initialize ├── ApplicationAuthWithKeyContents.java ├── ApplicationAuthWithKeyPath.java ├── BasicAuth.java └── FullAuth.java ├── insight ├── AdvancedInsight.java ├── AdvancedInsightAsync.java ├── AdvancedInsightWithCnam.java ├── AsyncInsightTrigger.java ├── BasicInsight.java └── StandardInsight.java ├── jwt ├── GenerateJwt.java └── ValidateInboundJwt.java ├── messages ├── IncomingMessage.java ├── MessageStatusWebhook.java ├── SendMessageWithFailover.java ├── messenger │ ├── SendMessengerAudio.java │ ├── SendMessengerFile.java │ ├── SendMessengerImage.java │ ├── SendMessengerText.java │ └── SendMessengerVideo.java ├── mms │ ├── SendMmsAudio.java │ ├── SendMmsContent.java │ ├── SendMmsFile.java │ ├── SendMmsImage.java │ ├── SendMmsText.java │ ├── SendMmsVcard.java │ └── SendMmsVideo.java ├── rcs │ ├── RevokeMessage.java │ ├── SendRcsFile.java │ ├── SendRcsImage.java │ ├── SendRcsRichCard.java │ ├── SendRcsRichCardCarousel.java │ ├── SendRcsSuggestedCalendarEvent.java │ ├── SendRcsSuggestedDialNumber.java │ ├── SendRcsSuggestedMultipleActions.java │ ├── SendRcsSuggestedOpenUrl.java │ ├── SendRcsSuggestedReply.java │ ├── SendRcsSuggestedShareLocation.java │ ├── SendRcsSuggestedViewLocation.java │ ├── SendRcsText.java │ └── SendRcsVideo.java ├── sandbox │ ├── messenger │ │ ├── SendMessengerText.java │ │ └── SendMessengerVideo.java │ ├── viber │ │ ├── SendViberText.java │ │ └── SendViberVideo.java │ └── whatsapp │ │ ├── SendWhatsappAudio.java │ │ ├── SendWhatsappContact.java │ │ ├── SendWhatsappFile.java │ │ ├── SendWhatsappImage.java │ │ ├── SendWhatsappLocation.java │ │ ├── SendWhatsappReaction.java │ │ ├── SendWhatsappSticker.java │ │ ├── SendWhatsappText.java │ │ ├── SendWhatsappUnreaction.java │ │ └── SendWhatsappVideo.java ├── sms │ └── SendSmsText.java ├── viber │ ├── SendViberFile.java │ ├── SendViberImage.java │ ├── SendViberText.java │ └── SendViberVideo.java └── whatsapp │ ├── MarkAsRead.java │ ├── SendWhatsappAudio.java │ ├── SendWhatsappAuthenticationTemplate.java │ ├── SendWhatsappContact.java │ ├── SendWhatsappFile.java │ ├── SendWhatsappImage.java │ ├── SendWhatsappLinkButton.java │ ├── SendWhatsappLocation.java │ ├── SendWhatsappMediaTemplate.java │ ├── SendWhatsappMultiProduct.java │ ├── SendWhatsappOTP.java │ ├── SendWhatsappQuickReplyButton.java │ ├── SendWhatsappReaction.java │ ├── SendWhatsappSingleProduct.java │ ├── SendWhatsappStickerId.java │ ├── SendWhatsappStickerUrl.java │ ├── SendWhatsappTemplate.java │ ├── SendWhatsappText.java │ ├── SendWhatsappUnreaction.java │ └── SendWhatsappVideo.java ├── numbers ├── BuyNumber.java ├── CancelNumber.java ├── ListNumbers.java ├── SearchNumbers.java └── UpdateNumber.java ├── redact └── RedactATransaction.java ├── simswap ├── RetrieveSimSwapDate.java └── SimSwapped.java ├── sms ├── ReceiveDlr.java ├── ReceiveSignedSms.java ├── ReceiveSms.java ├── SendMessage.java ├── SendSignedSms.java └── SendUnicodeMessage.java ├── subaccounts ├── CreateSubaccount.java ├── DeactivateSubaccount.java ├── GetSubaccount.java ├── ListBalanceTransfers.java ├── ListCreditTransfers.java ├── ListSubaccounts.java ├── ReactivateSubaccount.java ├── RenameSubaccount.java ├── TransferBalance.java ├── TransferCredit.java └── TransferNumber.java ├── users ├── CreateUser.java ├── DeleteUser.java ├── GetUser.java ├── ListUsers.java └── UpdateUser.java ├── verify ├── AdvanceVerification.java ├── CancelVerification.java ├── CheckVerification.java ├── SearchVerification.java ├── StartPsd2Verification.java ├── StartPsd2VerificationWithWorkflow.java ├── StartVerification.java └── StartVerificationWithWorkflow.java ├── verify2 ├── CancelRequest.java ├── CheckVerificationCode.java ├── SendRequestAllChannels.java ├── SendRequestEmail.java ├── SendRequestSilentAuth.java ├── SendRequestSms.java ├── SendRequestVoice.java ├── SendRequestWhatsapp.java ├── SendRequestWithFallback.java └── templates │ ├── CreateTemplate.java │ ├── CreateTemplateFragment.java │ ├── DeleteTemplate.java │ ├── DeleteTemplateFragment.java │ ├── GetTemplate.java │ ├── GetTemplateFragment.java │ ├── ListTemplateFragments.java │ ├── ListTemplates.java │ ├── UpdateTemplate.java │ └── UpdateTemplateFragment.java ├── video ├── AddArchiveStream.java ├── AddBroadcastStream.java ├── CreateArchive.java ├── CreateBroadcast.java ├── CreateSession.java ├── DeleteArchive.java ├── ForceDisconnect.java ├── ForceMute.java ├── GenerateToken.java ├── GetArchive.java ├── GetBroadcast.java ├── GetStream.java ├── ListArchives.java ├── ListBroadcasts.java ├── ListStreams.java ├── RemoveArchiveStream.java ├── RemoveBroadcastStream.java ├── SendSignal.java ├── SetStreamLayout.java ├── SipDial.java ├── StopArchive.java ├── StopBroadcast.java ├── UpdateArchiveLayout.java └── UpdateBroadcastLayout.java └── voice ├── AsrInput.java ├── ConferenceCall.java ├── ConnectInboundCall.java ├── DownloadRecording.java ├── DtmfInput.java ├── EarmuffCall.java ├── EndCall.java ├── InboundCall.java ├── MuteCall.java ├── OutboundTextToSpeech.java ├── OutboundTextToSpeechWithEventUrl.java ├── OutboundTextToSpeechWithNcco.java ├── RecordCall.java ├── RecordCallSplitAudio.java ├── RecordConversation.java ├── RecordMessage.java ├── RetrieveCallInfo.java ├── RetrieveInfoForAllCalls.java ├── SendDtmfToCall.java ├── SendTalkToCall.java ├── StopAudioStream.java ├── StopTextToSpeech.java ├── StreamAudioToCall.java ├── SubscribeToDtmfEvents.java ├── TrackNccoProgress.java ├── TransferCall.java ├── TransferCallNCCO.java └── UnsubscribeFromDtmfEvents.java /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # Tooling Team 2 | * @Vonage/server-sdk 3 | * @SMadani 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Request/Response** 27 | If applicable, please provide the request used and the response 28 | 29 | **Java Version** 30 | - Version: 31 | 32 | **Java SDK Version** 33 | - Version: 34 | 35 | **Additional context/ Error Log** 36 | Add any other context about the problem here. 37 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Build 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | 8 | permissions: read-all 9 | 10 | jobs: 11 | build: 12 | permissions: 13 | contents: read 14 | checks: write 15 | statuses: write 16 | runs-on: ${{ matrix.os }} 17 | strategy: 18 | fail-fast: true 19 | matrix: 20 | java: [17, 21] 21 | os: [ubuntu-latest, macos-latest, windows-latest] 22 | steps: 23 | - name: Checkout the repo 24 | uses: actions/checkout@v4 25 | - name: Setup Java 26 | uses: actions/setup-java@v4 27 | with: 28 | distribution: 'temurin' 29 | java-version: ${{ matrix.java }} 30 | - name: Setup Gradle 31 | uses: gradle/actions/setup-gradle@v4 32 | - name: Build with Gradle 33 | run: ./gradlew build 34 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: CodeQL 2 | on: 3 | push: 4 | branches: [ "main" ] 5 | pull_request: 6 | branches: [ "main" ] 7 | schedule: 8 | - cron: '35 2 * * 2' 9 | 10 | permissions: read-all 11 | 12 | jobs: 13 | analyze: 14 | name: Analyze (${{ matrix.language }}) 15 | runs-on: 'ubuntu-latest' 16 | permissions: 17 | security-events: write 18 | packages: read 19 | actions: read 20 | contents: read 21 | 22 | strategy: 23 | fail-fast: false 24 | matrix: 25 | include: 26 | - language: java-kotlin 27 | build-mode: autobuild 28 | steps: 29 | - name: Checkout repository 30 | uses: actions/checkout@85e6279cec87321a52edac9c87bce653a07cf6c2 31 | - name: Initialize CodeQL 32 | uses: github/codeql-action/init@486ab5a2922b634015408a83e10f6867efb5922c 33 | with: 34 | languages: ${{ matrix.language }} 35 | build-mode: ${{ matrix.build-mode }} 36 | - name: Perform CodeQL Analysis 37 | uses: github/codeql-action/analyze@486ab5a2922b634015408a83e10f6867efb5922c 38 | with: 39 | category: "/language:${{matrix.language}}" 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | 4 | # Log file 5 | *.log 6 | 7 | # BlueJ files 8 | *.ctxt 9 | 10 | # Mobile Tools for Java (J2ME) 11 | .mtj.tmp/ 12 | 13 | # Package Files # 14 | *.war 15 | *.ear 16 | *.zip 17 | *.tar.gz 18 | *.rar 19 | 20 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 21 | hs_err_pid* 22 | 23 | .idea 24 | *.iml 25 | .project 26 | .settings 27 | .metadata 28 | .gradle 29 | .classpath 30 | build 31 | .vagrant 32 | 33 | *.key 34 | 35 | *.env 36 | .DS_Store -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Getting Involved 2 | 3 | Thanks for your interest in the project, we'd love to have you involved! Check out the sections below to find out more about what to do next... 4 | 5 | ## Opening an Issue 6 | 7 | We always welcome issues, if you've seen something that isn't quite right or you have a suggestion for a new feature, please go ahead and open an issue in this project. Include as much information as you have, it really helps. 8 | 9 | ## Making a Code Change 10 | 11 | We're always open to pull requests, but these should be small and clearly described so that we can understand what you're trying to do. Feel free to open an issue first and get some discussion going. 12 | 13 | When you're ready to start coding, fork this repository to your own GitHub account and make your changes in a new branch. Once you're happy, open a pull request and explain what the change is and why you think we should include it in our project. 14 | 15 | 16 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright 2025 Vonage 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /build.gradle: -------------------------------------------------------------------------------- 1 | plugins { 2 | id 'java' 3 | } 4 | 5 | repositories { 6 | mavenLocal() 7 | mavenCentral() 8 | } 9 | 10 | java { 11 | sourceCompatibility = JavaVersion.VERSION_17 12 | targetCompatibility = sourceCompatibility 13 | } 14 | 15 | dependencies { 16 | implementation 'io.github.cdimascio:dotenv-java:3.+' 17 | implementation 'com.vonage:server-sdk:9.3.1' 18 | implementation 'com.vonage:jwt:2.+' 19 | implementation 'com.sparkjava:spark-core:2.+' 20 | implementation 'com.fasterxml.jackson.core:jackson-databind:2.+' 21 | } 22 | 23 | tasks.register('fatJar', Jar) { 24 | dependsOn configurations.runtimeClasspath 25 | archiveBaseName = project.name + '-with-dependencies' 26 | from { configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) } } 27 | with jar 28 | duplicatesStrategy = DuplicatesStrategy.EXCLUDE 29 | } 30 | assemble.dependsOn fatJar 31 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Vonage/vonage-java-code-snippets/be11183a678be64f7c39d122368890f75b51c389/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zip 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStorePath=wrapper/dists 5 | zipStoreBase=GRADLE_USER_HOME 6 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/account/ConfigureAccount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.account; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.account.SettingsResponse; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class ConfigureAccount { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .apiKey(VONAGE_API_KEY) 32 | .apiSecret(VONAGE_API_SECRET) 33 | .build(); 34 | 35 | SettingsResponse response = client.getAccountClient().updateSmsIncomingUrl(ACCOUNT_SMS_CALLBACK_URL); 36 | System.out.println("SMS Callback URL is now " + response.getIncomingSmsUrl()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/account/CreateSecret.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.account; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.account.SecretResponse; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class CreateSecret { 29 | public static void main(String[] args) { 30 | VonageClient client = VonageClient.builder() 31 | .apiKey(VONAGE_API_KEY) 32 | .apiSecret(VONAGE_API_SECRET) 33 | .build(); 34 | 35 | SecretResponse response = client.getAccountClient().createSecret(ACCOUNT_ID, ACCOUNT_SECRET); 36 | System.out.println(response.getId() + " created at " + response.getCreated()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/account/GetBalance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.account; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.account.BalanceResponse; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class GetBalance { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .apiKey(VONAGE_API_KEY) 32 | .apiSecret(VONAGE_API_SECRET) 33 | .build(); 34 | 35 | BalanceResponse response = client.getAccountClient().getBalance(); 36 | System.out.printf("Balance: %s EUR\n", response.getValue()); 37 | System.out.printf("Auto-reload Enabled: %s\n", response.isAutoReload()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/account/GetSecret.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.account; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.account.SecretResponse; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class GetSecret { 29 | public static void main(String[] args) { 30 | VonageClient client = VonageClient.builder() 31 | .apiKey(VONAGE_API_KEY) 32 | .apiSecret(VONAGE_API_SECRET) 33 | .build(); 34 | 35 | SecretResponse response = client.getAccountClient().getSecret(ACCOUNT_ID, ACCOUNT_SECRET_ID); 36 | System.out.println(response.getId() + " created at " + response.getCreated()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/account/ListSecrets.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.account; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.account.SecretResponse; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | import java.util.List; 28 | 29 | public class ListSecrets { 30 | public static void main(String[] args) { 31 | VonageClient client = VonageClient.builder() 32 | .apiKey(VONAGE_API_KEY) 33 | .apiSecret(VONAGE_API_SECRET) 34 | .build(); 35 | 36 | List response = client.getAccountClient().listSecrets(ACCOUNT_ID); 37 | 38 | for (SecretResponse secret : response) { 39 | System.out.println(secret.getId() + " created at " + secret.getCreated()); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/account/RevokeSecret.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.account; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class RevokeSecret { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .apiKey(VONAGE_API_KEY) 31 | .apiSecret(VONAGE_API_SECRET) 32 | .build(); 33 | 34 | client.getAccountClient().revokeSecret(ACCOUNT_ID, ACCOUNT_SECRET_ID); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/application/DeleteApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.application; 23 | 24 | import com.vonage.client.VonageClient; 25 | 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class DeleteApplication { 29 | public static void main(String... args) { 30 | VonageClient client = VonageClient.builder() 31 | .apiKey(VONAGE_API_KEY) 32 | .apiSecret(VONAGE_API_SECRET) 33 | .build(); 34 | 35 | client.getApplicationClient().deleteApplication(VONAGE_APPLICATION_ID); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/application/GetApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.application; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.application.Application; 26 | 27 | import static com.vonage.quickstart.EnvironmentVariables.*; 28 | 29 | public class GetApplication { 30 | public static void main(String... args) { 31 | VonageClient client = VonageClient.builder() 32 | .apiKey(VONAGE_API_KEY) 33 | .apiSecret(VONAGE_API_SECRET) 34 | .build(); 35 | 36 | Application application = client.getApplicationClient().getApplication(VONAGE_APPLICATION_ID); 37 | 38 | System.out.println(application.toJson()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/application/ListApplications.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.application; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.application.ApplicationList; 26 | 27 | import static com.vonage.quickstart.EnvironmentVariables.*; 28 | 29 | public class ListApplications { 30 | public static void main(String... args) { 31 | VonageClient client = VonageClient.builder() 32 | .apiKey(VONAGE_API_KEY) 33 | .apiSecret(VONAGE_API_SECRET) 34 | .build(); 35 | 36 | ApplicationList applications = client.getApplicationClient().listApplications(); 37 | 38 | applications.getApplications().forEach( 39 | application -> System.out.println(application.toJson()) 40 | ); 41 | } 42 | } 43 | 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/conversation/DeleteConversation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.conversation; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class DeleteConversation { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | client.getConversationsClient().deleteConversation(CONV_ID); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/conversation/DeleteEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.conversation; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class DeleteEvent { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | client.getConversationsClient().deleteEvent(CONV_ID, CONV_EVENT_ID); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/conversation/GetConversation.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.conversation; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class GetConversation { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var conversation = client.getConversationsClient().getConversation(CONV_ID); 35 | System.out.println(conversation); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/conversation/GetEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.conversation; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class GetEvent { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var event = client.getConversationsClient().getEvent(CONV_ID, CONV_EVENT_ID); 35 | System.out.println(event); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/conversation/GetMember.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.conversation; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class GetMember { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var member = client.getConversationsClient().getMember(CONV_ID, CONV_MEMBER_ID); 35 | System.out.println(member); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/conversation/ListConversations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.conversation; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class ListConversations { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var conversations = client.getConversationsClient().listConversations(); 35 | conversations.forEach(System.out::println); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/conversation/ListEvents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.conversation; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class ListEvents { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var events = client.getConversationsClient().listEvents(CONV_ID); 35 | events.forEach(System.out::println); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/conversation/ListMembers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.conversation; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class ListMembers { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var members = client.getConversationsClient().listMembers(CONV_ID); 35 | members.forEach(System.out::println); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/conversation/ListUserConversations.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.conversation; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class ListUserConversations { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var conversations = client.getConversationsClient().listUserConversations(USER_ID); 35 | conversations.forEach(System.out::println); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/custom/DeleteRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.custom; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class DeleteRequest { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .apiKey(VONAGE_API_KEY) 31 | .apiSecret(VONAGE_API_SECRET) 32 | .build(); 33 | 34 | client.getCustomClient().delete("https://api.nexmo.com/v3/media/:id"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/custom/GetRequestBinary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.custom; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class GetRequestBinary { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .apiKey(VONAGE_API_KEY) 31 | .apiSecret(VONAGE_API_SECRET) 32 | .build(); 33 | 34 | byte[] response = client.getCustomClient().get("https://api.nexmo.com/v3/media/:id"); 35 | System.out.println(response.length); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/custom/GetRequestJsonable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.custom; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.account.BalanceResponse; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class GetRequestJsonable { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .apiKey(VONAGE_API_KEY) 32 | .apiSecret(VONAGE_API_SECRET) 33 | .build(); 34 | 35 | BalanceResponse response = client.getCustomClient().get("https://rest.nexmo.com/account/get-balance"); 36 | System.out.println("€" + response.getValue()); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/custom/GetRequestMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.custom; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | import java.util.Map; 27 | 28 | @SuppressWarnings("unchecked") 29 | public class GetRequestMap { 30 | public static void main(String[] args) throws Exception { 31 | VonageClient client = VonageClient.builder() 32 | .apiKey(VONAGE_API_KEY) 33 | .apiSecret(VONAGE_API_SECRET) 34 | .build(); 35 | 36 | Map response = client.getCustomClient().get("https://rest.nexmo.com/account/get-balance"); 37 | System.out.println("€" + response.get("value")); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/custom/GetRequestString.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.custom; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class GetRequestString { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .apiKey(VONAGE_API_KEY) 31 | .apiSecret(VONAGE_API_SECRET) 32 | .build(); 33 | 34 | String response = client.getCustomClient().get("https://example.com"); 35 | System.out.println(response); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/custom/PostRequestMap.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.custom; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | import java.util.Map; 27 | 28 | @SuppressWarnings("unchecked") 29 | public class PostRequestMap { 30 | public static void main(String[] args) throws Exception { 31 | VonageClient client = VonageClient.builder() 32 | .apiKey(VONAGE_API_KEY) 33 | .apiSecret(VONAGE_API_SECRET) 34 | .build(); 35 | 36 | Map response = client.getCustomClient().post( 37 | "https://api.nexmo.com/beta/chatapp-accounts/messenger/100614398987044/applications", 38 | Map.of("application", VONAGE_APPLICATION_ID) 39 | ); 40 | System.out.println(response); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/initialize/ApplicationAuthWithKeyContents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.initialize; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | /** 28 | * Example of configuring a VonageClient with Application (JWT) authentication credentials. 29 | */ 30 | public class ApplicationAuthWithKeyContents { 31 | public static void main(String[] args) throws Exception { 32 | VonageClient client = VonageClient.builder() 33 | .applicationId(VONAGE_APPLICATION_ID) 34 | .privateKeyContents(VONAGE_PRIVATE_KEY_CONTENTS) 35 | .build(); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/initialize/ApplicationAuthWithKeyPath.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.initialize; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | /** 28 | * Example of configuring a VonageClient with Application (JWT) authentication credentials. 29 | */ 30 | public class ApplicationAuthWithKeyPath { 31 | public static void main(String[] args) throws Exception { 32 | 33 | VonageClient client = VonageClient.builder() 34 | .applicationId(VONAGE_APPLICATION_ID) 35 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 36 | .build(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/initialize/BasicAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.initialize; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | /** 28 | * Example of configuring a VonageClient with an API secret. 29 | */ 30 | public class BasicAuth { 31 | public static void main(String[] args) throws Exception { 32 | VonageClient client = VonageClient.builder().apiKey(VONAGE_API_KEY).apiSecret(VONAGE_API_SECRET).build(); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/initialize/FullAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.initialize; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | /** 28 | * Example of configuring a VonageClient with authentication for 29 | * both API secret and Application (JWT) authentication credentials. 30 | */ 31 | public class FullAuth { 32 | public static void main(String[] args) throws Exception { 33 | VonageClient client = VonageClient.builder() 34 | .apiKey(VONAGE_API_KEY) 35 | .apiSecret(VONAGE_API_SECRET) 36 | .applicationId(VONAGE_APPLICATION_ID) 37 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 38 | .build(); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/insight/AsyncInsightTrigger.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.insight; 23 | 24 | import com.vonage.client.Jsonable; 25 | import com.vonage.client.insight.AdvancedInsightResponse; 26 | import spark.Spark; 27 | 28 | import static spark.Spark.port; 29 | 30 | public class AsyncInsightTrigger { 31 | public static void main(String... args) { 32 | port(3000); 33 | Spark.post("/webhooks/insight", (req, res) -> { 34 | AdvancedInsightResponse response = Jsonable.fromJson(req.body()); 35 | System.out.println("Country: " + response.getCountryName()); 36 | 37 | res.status(204); 38 | return ""; 39 | }); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/jwt/ValidateInboundJwt.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.jwt; 23 | 24 | import com.vonage.jwt.Jwt; 25 | import spark.Route; 26 | import spark.Spark; 27 | import static com.vonage.quickstart.EnvironmentVariables.*; 28 | 29 | public class ValidateInboundJwt { 30 | public static void main(String[] args) throws Exception { 31 | 32 | Route validateJwt = (req, res) -> { 33 | String token = req.headers("Authorization").substring(7); 34 | 35 | if (Jwt.verifySignature(token, VONAGE_SIGNATURE_SECRET)) { 36 | res.status(204); 37 | } 38 | else { 39 | res.status(401); 40 | } 41 | 42 | return ""; 43 | }; 44 | Spark.port(5000); 45 | Spark.post("/webhooks/validatejwt", validateJwt); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/IncomingMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages; 23 | 24 | import com.vonage.client.messages.InboundMessage; 25 | import spark.Route; 26 | import spark.Spark; 27 | 28 | public class IncomingMessage { 29 | public static void main(String[] args) { 30 | 31 | Route inboundRoute = (request, response) -> { 32 | InboundMessage messageDetails = InboundMessage.fromJson(request.body()); 33 | System.out.println( 34 | "Message ID "+messageDetails.getMessageUuid()+" of type " + 35 | messageDetails.getMessageType()+" was sent from " + 36 | messageDetails.getFrom()+" to "+messageDetails.getTo()+" via "+ 37 | messageDetails.getChannel()+" at "+messageDetails.getTimestamp() 38 | ); 39 | return "OK"; 40 | }; 41 | 42 | Spark.port(3000); 43 | Spark.post("/webhooks/inbound-message", inboundRoute); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/mms/SendMmsAudio.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.mms; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.mms.MmsAudioRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendMmsAudio { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | MmsAudioRequest.builder() 37 | .from(MMS_SENDER_ID).to(MESSAGES_TO_NUMBER) 38 | .url(MESSAGES_AUDIO_URL) 39 | .build() 40 | ); 41 | System.out.println("Message sent successfully. ID: "+response.getMessageUuid()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/mms/SendMmsFile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.mms; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.mms.MmsFileRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendMmsFile { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | MmsFileRequest.builder() 37 | .from(MMS_SENDER_ID).to(MESSAGES_TO_NUMBER) 38 | .url(MESSAGES_FILE_URL) 39 | .build() 40 | ); 41 | System.out.println("Message sent successfully. ID: "+response.getMessageUuid()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/mms/SendMmsImage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.mms; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.mms.MmsImageRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendMmsImage { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | MmsImageRequest.builder() 37 | .from(MMS_SENDER_ID).to(MESSAGES_TO_NUMBER) 38 | .url(MESSAGES_IMAGE_URL) 39 | .build() 40 | ); 41 | System.out.println("Message sent successfully. ID: "+response.getMessageUuid()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/mms/SendMmsText.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.mms; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.mms.MmsTextRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendMmsText { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | MmsTextRequest.builder() 37 | .from(MMS_SENDER_ID).to(MESSAGES_TO_NUMBER) 38 | .text("This is an MMS message with text") 39 | .build() 40 | ); 41 | System.out.println("Message sent successfully. ID: "+response.getMessageUuid()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/mms/SendMmsVcard.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.mms; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.mms.MmsVcardRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendMmsVcard { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | MmsVcardRequest.builder() 37 | .from(MMS_SENDER_ID).to(MESSAGES_TO_NUMBER) 38 | .url(MESSAGES_VCARD_URL) 39 | .build() 40 | ); 41 | System.out.println("Message sent successfully. ID: "+response.getMessageUuid()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/mms/SendMmsVideo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.mms; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.mms.MmsVideoRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendMmsVideo { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | MmsVideoRequest.builder() 37 | .from(MMS_SENDER_ID).to(MESSAGES_TO_NUMBER) 38 | .url(MESSAGES_VIDEO_URL) 39 | .build() 40 | ); 41 | System.out.println("Message sent successfully. ID: "+response.getMessageUuid()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/rcs/RevokeMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.rcs; 23 | 24 | import com.vonage.client.ApiRegion; 25 | import com.vonage.client.VonageClient; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class RevokeMessage { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | client.getMessagesClient().revokeOutboundMessage(MESSAGES_MESSAGE_ID, MESSAGES_GEOSPECIFIC_API_HOST); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/rcs/SendRcsFile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.rcs; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.rcs.RcsFileRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendRcsFile { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | RcsFileRequest.builder() 37 | .from(RCS_SENDER_ID).to(MESSAGES_TO_NUMBER) 38 | .url(MESSAGES_FILE_URL) 39 | .build() 40 | ); 41 | System.out.println("Message sent successfully. ID: " + response.getMessageUuid()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/rcs/SendRcsImage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.rcs; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.rcs.RcsImageRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendRcsImage { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | RcsImageRequest.builder() 37 | .from(RCS_SENDER_ID).to(MESSAGES_TO_NUMBER) 38 | .url(MESSAGES_IMAGE_URL) 39 | .build() 40 | ); 41 | System.out.println("Message sent successfully. ID: " + response.getMessageUuid()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/rcs/SendRcsText.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.rcs; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.rcs.RcsTextRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendRcsText { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | RcsTextRequest.builder() 37 | .from(RCS_SENDER_ID).to(MESSAGES_TO_NUMBER) 38 | .text("This is an RCS message sent via the Vonage Messages API") 39 | .build() 40 | ); 41 | System.out.println("Message sent successfully. ID: " + response.getMessageUuid()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/rcs/SendRcsVideo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.rcs; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.rcs.RcsVideoRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendRcsVideo { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | RcsVideoRequest.builder() 37 | .from(RCS_SENDER_ID).to(MESSAGES_TO_NUMBER) 38 | .url(MESSAGES_VIDEO_URL) 39 | .build() 40 | ); 41 | System.out.println("Message sent successfully. ID: " + response.getMessageUuid()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/sms/SendSmsText.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.sms; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.sms.SmsTextRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendSmsText { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | SmsTextRequest.builder() 37 | .from(SMS_SENDER_ID).to(MESSAGES_TO_NUMBER) 38 | .text("This is an SMS text message sent using the Messages API") 39 | .build() 40 | ); 41 | System.out.println("Message sent successfully. ID: " + response.getMessageUuid()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/viber/SendViberFile.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.viber; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.viber.ViberFileRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendViberFile { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | ViberFileRequest.builder() 37 | .from(VIBER_SENDER_ID) 38 | .to(MESSAGES_TO_NUMBER) 39 | .url(MESSAGES_FILE_URL) 40 | .build() 41 | ); 42 | System.out.println("Message sent successfully. ID: "+response.getMessageUuid()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/viber/SendViberImage.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.viber; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.messages.viber.ViberImageRequest; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendViberImage { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getMessagesClient().sendMessage( 36 | ViberImageRequest.builder() 37 | .from(VIBER_SENDER_ID) 38 | .to(MESSAGES_TO_NUMBER) 39 | .url(MESSAGES_IMAGE_URL) 40 | .build() 41 | ); 42 | System.out.println("Message sent successfully. ID: "+response.getMessageUuid()); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/messages/whatsapp/MarkAsRead.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.messages.whatsapp; 23 | 24 | import com.vonage.client.ApiRegion; 25 | import com.vonage.client.VonageClient; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class MarkAsRead { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | client.getMessagesClient().ackInboundMessage(MESSAGES_MESSAGE_ID, ApiRegion.API_EU); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/numbers/BuyNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.numbers; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class BuyNumber { 28 | public static void main(String[] args) { 29 | VonageClient client = VonageClient.builder() 30 | .apiKey(VONAGE_API_KEY) 31 | .apiSecret(VONAGE_API_SECRET) 32 | .build(); 33 | 34 | client.getNumbersClient().buyNumber(NUMBER_COUNTRY_CODE, NUMBER_MSISDN); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/numbers/CancelNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.numbers; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class CancelNumber { 28 | public static void main(String[] args) { 29 | VonageClient client = VonageClient.builder() 30 | .apiKey(VONAGE_API_KEY) 31 | .apiSecret(VONAGE_API_SECRET) 32 | .build(); 33 | 34 | client.getNumbersClient().cancelNumber(NUMBER_COUNTRY_CODE, NUMBER_MSISDN); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/redact/RedactATransaction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.redact; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.redact.Product; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class RedactATransaction { 29 | public static void main(String... args) { 30 | VonageClient client = VonageClient.builder() 31 | .apiKey(VONAGE_API_KEY) 32 | .apiSecret(VONAGE_API_SECRET) 33 | .build(); 34 | 35 | client.getRedactClient().redactTransaction(VONAGE_REDACT_ID, Product.SMS); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/simswap/RetrieveSimSwapDate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.simswap; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | import java.time.Instant; 27 | 28 | public class RetrieveSimSwapDate { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH).build(); 33 | 34 | Instant lastSwapDate = client.getSimSwapClient().retrieveSimSwapDate(SIMSWAP_MSISDN); 35 | System.out.println(lastSwapDate); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/simswap/SimSwapped.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.simswap; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class SimSwapped { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH).build(); 32 | 33 | boolean swapped = client.getSimSwapClient().checkSimSwap(SIMSWAP_MSISDN, SIMSWAP_MAX_AGE); 34 | System.out.println("SIM for "+SIMSWAP_MSISDN + " has " + 35 | (swapped ? "" : "not ") + "been swapped in the past "+SIMSWAP_MAX_AGE+" hours." 36 | ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/subaccounts/CreateSubaccount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.subaccounts; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.subaccounts.Account; 26 | import com.vonage.client.subaccounts.CreateSubaccountRequest; 27 | import static com.vonage.quickstart.EnvironmentVariables.*; 28 | 29 | public class CreateSubaccount { 30 | public static void main(String[] args) throws Exception { 31 | 32 | VonageClient client = VonageClient.builder() 33 | .apiKey(VONAGE_API_KEY) 34 | .apiSecret(VONAGE_API_SECRET) 35 | .build(); 36 | 37 | Account subaccount = client.getSubaccountsClient().createSubaccount( 38 | CreateSubaccountRequest.builder() 39 | .name(SUBACCOUNT_NAME) 40 | .secret(SUBACCOUNT_SECRET) 41 | .build() 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/subaccounts/DeactivateSubaccount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.subaccounts; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.subaccounts.Account; 26 | import com.vonage.client.subaccounts.UpdateSubaccountRequest; 27 | import static com.vonage.quickstart.EnvironmentVariables.*; 28 | 29 | public class DeactivateSubaccount { 30 | public static void main(String[] args) throws Exception { 31 | 32 | VonageClient client = VonageClient.builder() 33 | .apiKey(VONAGE_API_KEY) 34 | .apiSecret(VONAGE_API_SECRET) 35 | .build(); 36 | 37 | Account subaccount = client.getSubaccountsClient().updateSubaccount( 38 | UpdateSubaccountRequest.builder(SUBACCOUNT_KEY).suspended(true).build() 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/subaccounts/GetSubaccount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.subaccounts; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.subaccounts.Account; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class GetSubaccount { 29 | public static void main(String[] args) throws Exception { 30 | 31 | VonageClient client = VonageClient.builder() 32 | .apiKey(VONAGE_API_KEY) 33 | .apiSecret(VONAGE_API_SECRET) 34 | .build(); 35 | 36 | Account subaccount = client.getSubaccountsClient().getSubaccount(SUBACCOUNT_KEY); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/subaccounts/ListBalanceTransfers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.subaccounts; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.subaccounts.ListTransfersFilter; 26 | import com.vonage.client.subaccounts.MoneyTransfer; 27 | import static com.vonage.quickstart.EnvironmentVariables.*; 28 | import java.util.List; 29 | 30 | public class ListBalanceTransfers { 31 | public static void main(String[] args) throws Exception { 32 | VonageClient client = VonageClient.builder() 33 | .apiKey(VONAGE_API_KEY) 34 | .apiSecret(VONAGE_API_SECRET) 35 | .build(); 36 | 37 | List transfers = client.getSubaccountsClient().listBalanceTransfers( 38 | ListTransfersFilter.builder().startDate(SUBACCOUNT_START_DATE).build() 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/subaccounts/ListCreditTransfers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.subaccounts; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.subaccounts.ListTransfersFilter; 26 | import com.vonage.client.subaccounts.MoneyTransfer; 27 | import static com.vonage.quickstart.EnvironmentVariables.*; 28 | import java.util.List; 29 | 30 | public class ListCreditTransfers { 31 | public static void main(String[] args) throws Exception { 32 | VonageClient client = VonageClient.builder() 33 | .apiKey(VONAGE_API_KEY) 34 | .apiSecret(VONAGE_API_SECRET) 35 | .build(); 36 | 37 | List transfers = client.getSubaccountsClient().listCreditTransfers( 38 | ListTransfersFilter.builder().startDate(SUBACCOUNT_START_DATE).build() 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/subaccounts/ListSubaccounts.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.subaccounts; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.subaccounts.ListSubaccountsResponse; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class ListSubaccounts { 29 | public static void main(String[] args) throws Exception { 30 | 31 | VonageClient client = VonageClient.builder() 32 | .apiKey(VONAGE_API_KEY) 33 | .apiSecret(VONAGE_API_SECRET) 34 | .build(); 35 | 36 | ListSubaccountsResponse response = client.getSubaccountsClient().listSubaccounts(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/subaccounts/ReactivateSubaccount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.subaccounts; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.subaccounts.Account; 26 | import com.vonage.client.subaccounts.UpdateSubaccountRequest; 27 | import static com.vonage.quickstart.EnvironmentVariables.*; 28 | 29 | public class ReactivateSubaccount { 30 | public static void main(String[] args) throws Exception { 31 | 32 | VonageClient client = VonageClient.builder() 33 | .apiKey(VONAGE_API_KEY) 34 | .apiSecret(VONAGE_API_SECRET) 35 | .build(); 36 | 37 | Account subaccount = client.getSubaccountsClient().updateSubaccount( 38 | UpdateSubaccountRequest.builder(SUBACCOUNT_KEY).suspended(false).build() 39 | ); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/subaccounts/RenameSubaccount.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.subaccounts; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.subaccounts.Account; 26 | import com.vonage.client.subaccounts.UpdateSubaccountRequest; 27 | import static com.vonage.quickstart.EnvironmentVariables.*; 28 | 29 | public class RenameSubaccount { 30 | public static void main(String[] args) throws Exception { 31 | 32 | VonageClient client = VonageClient.builder() 33 | .apiKey(VONAGE_API_KEY) 34 | .apiSecret(VONAGE_API_SECRET) 35 | .build(); 36 | 37 | Account subaccount = client.getSubaccountsClient().updateSubaccount( 38 | UpdateSubaccountRequest.builder(SUBACCOUNT_KEY) 39 | .name(SUBACCOUNT_NAME).build() 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/subaccounts/TransferBalance.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.subaccounts; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.subaccounts.MoneyTransfer; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class TransferBalance { 29 | public static void main(String[] args) throws Exception { 30 | 31 | VonageClient client = VonageClient.builder() 32 | .apiKey(VONAGE_API_KEY) 33 | .apiSecret(VONAGE_API_SECRET) 34 | .build(); 35 | 36 | MoneyTransfer receipt = client.getSubaccountsClient().transferBalance( 37 | MoneyTransfer.builder() 38 | .from(VONAGE_API_KEY).to(SUBACCOUNT_KEY) 39 | .amount(SUBACCOUNT_BALANCE_AMOUNT).build() 40 | ); 41 | System.out.println("Transfer successful: "+receipt.getId()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/subaccounts/TransferCredit.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.subaccounts; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.subaccounts.MoneyTransfer; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class TransferCredit { 29 | public static void main(String[] args) throws Exception { 30 | 31 | VonageClient client = VonageClient.builder() 32 | .apiKey(VONAGE_API_KEY) 33 | .apiSecret(VONAGE_API_SECRET) 34 | .build(); 35 | 36 | MoneyTransfer receipt = client.getSubaccountsClient().transferCredit( 37 | MoneyTransfer.builder() 38 | .from(VONAGE_API_KEY).to(SUBACCOUNT_KEY) 39 | .amount(SUBACCOUNT_CREDIT_AMOUNT).build() 40 | ); 41 | System.out.println("Transfer successful: "+receipt.getId()); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/subaccounts/TransferNumber.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.subaccounts; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.subaccounts.NumberTransfer; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class TransferNumber { 29 | public static void main(String[] args) throws Exception { 30 | 31 | VonageClient client = VonageClient.builder() 32 | .apiKey(VONAGE_API_KEY) 33 | .apiSecret(VONAGE_API_SECRET) 34 | .build(); 35 | 36 | NumberTransfer transfer = NumberTransfer.builder() 37 | .from(VONAGE_API_KEY).to(SUBACCOUNT_KEY) 38 | .number(NUMBER_MSISDN).country(NUMBER_COUNTRY_CODE) 39 | .build(); 40 | 41 | client.getSubaccountsClient().transferNumber(transfer); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/users/DeleteUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.users; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class DeleteUser { 28 | public static void main(String... args) { 29 | VonageClient client = VonageClient.builder() 30 | .apiKey(VONAGE_API_KEY) 31 | .apiSecret(VONAGE_API_SECRET) 32 | .build(); 33 | 34 | client.getUsersClient().deleteUser(USER_ID); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/users/GetUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.users; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.users.User; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class GetUser { 29 | public static void main(String... args) { 30 | VonageClient client = VonageClient.builder() 31 | .apiKey(VONAGE_API_KEY) 32 | .apiSecret(VONAGE_API_SECRET) 33 | .build(); 34 | 35 | User user = client.getUsersClient().getUser(USER_ID); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/users/ListUsers.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.users; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.users.BaseUser; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | import java.util.List; 28 | 29 | public class ListUsers { 30 | public static void main(String... args) { 31 | VonageClient client = VonageClient.builder() 32 | .apiKey(VONAGE_API_KEY) 33 | .apiSecret(VONAGE_API_SECRET) 34 | .build(); 35 | 36 | List users = client.getUsersClient().listUsers(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/users/UpdateUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.users; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.users.User; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class UpdateUser { 29 | public static void main(String... args) { 30 | VonageClient client = VonageClient.builder() 31 | .apiKey(VONAGE_API_KEY) 32 | .apiSecret(VONAGE_API_SECRET) 33 | .build(); 34 | 35 | User user = client.getUsersClient().updateUser( 36 | USER_ID, User.builder() 37 | .name(USER_NEW_NAME) 38 | .displayName(USER_NEW_DISPLAY_NAME) 39 | .build() 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/CancelRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | import java.util.UUID; 27 | 28 | public class CancelRequest { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | client.getVerify2Client().cancelVerification(VERIFY_REQUEST_UUID); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/SendRequestEmail.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.verify2.*; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendRequestEmail { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | VerificationResponse response = client.getVerify2Client().sendVerification( 36 | VerificationRequest.builder() 37 | .addWorkflow(new EmailWorkflow(VERIFY_TO_EMAIL)) 38 | .brand(VERIFY_BRAND_NAME).build() 39 | ); 40 | System.out.println("Verification sent: " + response.getRequestId()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/SendRequestSilentAuth.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.verify2.*; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendRequestSilentAuth { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | VerificationResponse response = client.getVerify2Client().sendVerification( 36 | VerificationRequest.builder() 37 | .addWorkflow(new SilentAuthWorkflow(VERIFY_NUMBER)) 38 | .brand(VERIFY_BRAND_NAME).build() 39 | ); 40 | System.out.println("Verification sent: " + response.getRequestId()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/SendRequestSms.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.verify2.*; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendRequestSms { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | VerificationResponse response = client.getVerify2Client().sendVerification( 36 | VerificationRequest.builder() 37 | .addWorkflow(new SmsWorkflow(VERIFY_NUMBER)) 38 | .brand(VERIFY_BRAND_NAME).build() 39 | ); 40 | System.out.println("Verification sent: " + response.getRequestId()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/SendRequestWhatsapp.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.verify2.*; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendRequestWhatsapp { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | VerificationResponse response = client.getVerify2Client().sendVerification( 36 | VerificationRequest.builder() 37 | .addWorkflow(new WhatsappWorkflow(VERIFY_NUMBER, VERIFY_WHATSAPP_NUMBER)) 38 | .brand(VERIFY_BRAND_NAME).build() 39 | ); 40 | System.out.println("Verification sent: " + response.getRequestId()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/templates/CreateTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2.templates; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class CreateTemplate { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var template = client.getVerify2Client().createTemplate(VERIFY_TEMPLATE_NAME); 35 | System.out.println(template.getId()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/templates/DeleteTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2.templates; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class DeleteTemplate { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | client.getVerify2Client().deleteTemplate(VERIFY_TEMPLATE_ID); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/templates/DeleteTemplateFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2.templates; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class DeleteTemplateFragment { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | client.getVerify2Client().deleteTemplateFragment(VERIFY_TEMPLATE_ID, VERIFY_TEMPLATE_FRAGMENT_ID); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/templates/GetTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2.templates; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class GetTemplate { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var template = client.getVerify2Client().getTemplate(VERIFY_TEMPLATE_ID); 35 | System.out.println(template); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/templates/GetTemplateFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2.templates; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class GetTemplateFragment { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var fragment = client.getVerify2Client().getTemplateFragment(VERIFY_TEMPLATE_ID, VERIFY_TEMPLATE_FRAGMENT_ID); 35 | System.out.println(fragment); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/templates/ListTemplateFragments.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2.templates; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class ListTemplateFragments { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var fragments = client.getVerify2Client().listTemplateFragments(VERIFY_TEMPLATE_ID); 35 | fragments.forEach(f -> System.out.println(f.getFragmentId())); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/templates/ListTemplates.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2.templates; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class ListTemplates { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var templates = client.getVerify2Client().listTemplates(); 35 | templates.forEach(t -> System.out.println(t.getId())); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/templates/UpdateTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2.templates; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class UpdateTemplate { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var updated = client.getVerify2Client().updateTemplate(VERIFY_TEMPLATE_ID, VERIFY_TEMPLATE_NAME, false); 35 | System.out.println(updated); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/verify2/templates/UpdateTemplateFragment.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.verify2.templates; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class UpdateTemplateFragment { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var updated = client.getVerify2Client().updateTemplateFragment( 35 | VERIFY_TEMPLATE_ID, VERIFY_TEMPLATE_FRAGMENT_ID, 36 | "The authentication code for your ${brand} is: ${code}" 37 | ); 38 | System.out.println(updated); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/AddArchiveStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class AddArchiveStream { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | videoClient.addArchiveStream(VIDEO_ARCHIVE_ID, VIDEO_STREAM_ID); 31 | 32 | System.out.println("Added archive stream"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/AddBroadcastStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class AddBroadcastStream { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | videoClient.addBroadcastStream(VIDEO_BROADCAST_ID, VIDEO_STREAM_ID); 31 | 32 | System.out.println("Added broadcast stream"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/CreateArchive.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class CreateArchive { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | Archive archive = videoClient.createArchive( 31 | Archive.builder(VIDEO_SESSION_ID) 32 | .streamMode(StreamMode.AUTO) 33 | .hasVideo(true) 34 | .hasAudio(true) 35 | .resolution(Resolution.HD_LANDSCAPE) 36 | .outputMode(OutputMode.COMPOSED).name("My recording") 37 | .build() 38 | ); 39 | 40 | System.out.println("Started archive: " + archive.toJson()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/CreateBroadcast.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | import java.time.Duration; 22 | 23 | public class CreateBroadcast { 24 | public static void main(String[] args) throws Exception { 25 | 26 | VideoClient videoClient = VonageClient.builder() 27 | .applicationId(VONAGE_APPLICATION_ID) 28 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 29 | .build().getVideoClient(); 30 | 31 | Broadcast broadcast = videoClient.createBroadcast( 32 | Broadcast.builder(VIDEO_SESSION_ID) 33 | .hls(Hls.builder().lowLatency(true).build()) 34 | .resolution(Resolution.HD_LANDSCAPE) 35 | .streamMode(StreamMode.AUTO) 36 | .maxDuration(Duration.ofMinutes(45)) 37 | .build() 38 | ); 39 | 40 | System.out.println("Started broadcast: " + broadcast.toJson()); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/CreateSession.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class CreateSession { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | CreateSessionResponse session = videoClient.createSession( 31 | CreateSessionRequest.builder() 32 | .mediaMode(MediaMode.ROUTED) 33 | .archiveMode(ArchiveMode.MANUAL) 34 | .build() 35 | ); 36 | 37 | System.out.println("Created session: " + session.toJson()); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/DeleteArchive.java: -------------------------------------------------------------------------------- 1 | package com.vonage.quickstart.video; 2 | 3 | import com.vonage.client.VonageClient; 4 | import com.vonage.client.video.*; 5 | import static com.vonage.quickstart.EnvironmentVariables.*; 6 | 7 | public class DeleteArchive { 8 | public static void main(String[] args) throws Exception { 9 | 10 | VideoClient videoClient = VonageClient.builder() 11 | .applicationId(VONAGE_APPLICATION_ID) 12 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 13 | .build().getVideoClient(); 14 | 15 | videoClient.deleteArchive(VIDEO_ARCHIVE_ID); 16 | 17 | System.out.println("Deleted archive"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/ForceDisconnect.java: -------------------------------------------------------------------------------- 1 | package com.vonage.quickstart.video; 2 | 3 | import com.vonage.client.VonageClient; 4 | import com.vonage.client.video.*; 5 | import static com.vonage.quickstart.EnvironmentVariables.*; 6 | 7 | public class ForceDisconnect { 8 | public static void main(String[] args) throws Exception { 9 | 10 | VideoClient videoClient = VonageClient.builder() 11 | .applicationId(VONAGE_APPLICATION_ID) 12 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 13 | .build().getVideoClient(); 14 | 15 | videoClient.forceDisconnect(VIDEO_SESSION_ID, VIDEO_CONNECTION_ID); 16 | 17 | System.out.println("Force disconnected"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/ForceMute.java: -------------------------------------------------------------------------------- 1 | package com.vonage.quickstart.video; 2 | 3 | import com.vonage.client.VonageClient; 4 | import com.vonage.client.video.*; 5 | import static com.vonage.quickstart.EnvironmentVariables.*; 6 | 7 | public class ForceMute { 8 | public static void main(String[] args) throws Exception { 9 | 10 | VideoClient videoClient = VonageClient.builder() 11 | .applicationId(VONAGE_APPLICATION_ID) 12 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 13 | .build().getVideoClient(); 14 | 15 | videoClient.muteStream(VIDEO_SESSION_ID, VIDEO_STREAM_ID); 16 | 17 | System.out.println("Force muted"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/GenerateToken.java: -------------------------------------------------------------------------------- 1 | package com.vonage.quickstart.video; 2 | 3 | import com.vonage.client.VonageClient; 4 | import com.vonage.client.video.*; 5 | import static com.vonage.quickstart.EnvironmentVariables.*; 6 | 7 | import java.time.Duration; 8 | 9 | public class GenerateToken { 10 | public static void main(String[] args) throws Exception { 11 | 12 | VideoClient videoClient = VonageClient.builder() 13 | .applicationId(VONAGE_APPLICATION_ID) 14 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 15 | .build().getVideoClient(); 16 | 17 | TokenOptions tokenOptions = TokenOptions.builder() 18 | .role(Role.MODERATOR) 19 | .expiryLength(Duration.ofHours(6)) 20 | .data("name=John,id=123") 21 | .build(); 22 | 23 | String jwt = videoClient.generateToken(VIDEO_SESSION_ID, tokenOptions); 24 | 25 | System.out.println("Generated token: " + jwt); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/GetArchive.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class GetArchive { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | Archive archive = videoClient.getArchive(VIDEO_ARCHIVE_ID); 31 | 32 | System.out.println("Retrieved archive: " + archive.toJson()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/GetBroadcast.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class GetBroadcast { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | Broadcast broadcast = videoClient.getBroadcast(VIDEO_BROADCAST_ID); 31 | 32 | System.out.println("Retrieved broadcast: " + broadcast.toJson()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/GetStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class GetStream { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | GetStreamResponse stream = videoClient.getStream(VIDEO_SESSION_ID, VIDEO_STREAM_ID); 31 | 32 | System.out.println("Retrieved stream: " + stream.toJson()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/ListArchives.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | import java.util.List; 22 | 23 | public class ListArchives { 24 | public static void main(String[] args) throws Exception { 25 | 26 | VideoClient videoClient = VonageClient.builder() 27 | .applicationId(VONAGE_APPLICATION_ID) 28 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 29 | .build().getVideoClient(); 30 | 31 | List archives = videoClient.listArchives(); 32 | 33 | System.out.println("Retrieved list of archives: " + archives); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/ListBroadcasts.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | import java.util.List; 22 | 23 | public class ListBroadcasts { 24 | public static void main(String[] args) throws Exception { 25 | 26 | VideoClient videoClient = VonageClient.builder() 27 | .applicationId(VONAGE_APPLICATION_ID) 28 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 29 | .build().getVideoClient(); 30 | 31 | List broadcasts = videoClient.listBroadcasts(); 32 | 33 | System.out.println("Retrieved list of broadcasts: " + broadcasts); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/ListStreams.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | import java.util.List; 23 | 24 | public class ListStreams { 25 | public static void main(String[] args) throws Exception { 26 | 27 | VideoClient videoClient = VonageClient.builder() 28 | .applicationId(VONAGE_APPLICATION_ID) 29 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 30 | .build().getVideoClient(); 31 | 32 | List streams = videoClient.listStreams(VIDEO_SESSION_ID); 33 | 34 | System.out.println("Retrieved list of streams: " + streams); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/RemoveArchiveStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class RemoveArchiveStream { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | videoClient.removeArchiveStream(VIDEO_ARCHIVE_ID, VIDEO_STREAM_ID); 31 | 32 | System.out.println("Removed archive stream"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/RemoveBroadcastStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class RemoveBroadcastStream { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | videoClient.removeBroadcastStream(VIDEO_BROADCAST_ID, VIDEO_STREAM_ID); 31 | 32 | System.out.println("Removed broadcast stream"); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/SendSignal.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class SendSignal { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | SignalRequest signal = SignalRequest.builder() 31 | .type("chat") 32 | .data("Hello, World!") 33 | .build(); 34 | 35 | videoClient.signalAll(VIDEO_SESSION_ID, signal); 36 | 37 | System.out.println("Sent signal to all participants"); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/SetStreamLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class SetStreamLayout { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | SessionStream stream = SessionStream.builder(VIDEO_STREAM_ID) 31 | .layoutClassList("full", "focus").build(); 32 | 33 | videoClient.setStreamLayout(VIDEO_SESSION_ID, stream); 34 | 35 | System.out.println("Set session stream layout"); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/SipDial.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | import java.net.URI; 23 | 24 | public class SipDial { 25 | public static void main(String[] args) throws Exception { 26 | 27 | VideoClient videoClient = VonageClient.builder() 28 | .applicationId(VONAGE_APPLICATION_ID) 29 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 30 | .build().getVideoClient(); 31 | 32 | SipDialRequest request = SipDialRequest.builder() 33 | .uri(URI.create("sip:user@sip.partner.com"), false) 34 | .sessionId(VIDEO_SESSION_ID).token(VIDEO_TOKEN).build(); 35 | 36 | SipDialResponse parsed = videoClient.sipDial(request); 37 | 38 | System.out.println("Initiated SIP connection: " + parsed.toJson()); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/StopArchive.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class StopArchive { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | Archive archive = videoClient.stopArchive(VIDEO_ARCHIVE_ID); 31 | 32 | System.out.println("Stopped archive: " + archive.getId()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/StopBroadcast.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class StopBroadcast { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | Broadcast broadcast = videoClient.stopBroadcast(VIDEO_BROADCAST_ID); 31 | 32 | System.out.println("Stopped broadcast: " + broadcast.getId()); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/UpdateArchiveLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class UpdateArchiveLayout { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | StreamCompositionLayout layout = StreamCompositionLayout.standardLayout(ScreenLayoutType.VERTICAL); 31 | videoClient.updateArchiveLayout(VIDEO_ARCHIVE_ID, layout); 32 | 33 | System.out.println("Updated archive layout"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/video/UpdateBroadcastLayout.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.vonage.quickstart.video; 17 | 18 | import com.vonage.client.VonageClient; 19 | import com.vonage.client.video.*; 20 | import static com.vonage.quickstart.EnvironmentVariables.*; 21 | 22 | public class UpdateBroadcastLayout { 23 | public static void main(String[] args) throws Exception { 24 | 25 | VideoClient videoClient = VonageClient.builder() 26 | .applicationId(VONAGE_APPLICATION_ID) 27 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 28 | .build().getVideoClient(); 29 | 30 | StreamCompositionLayout layout = StreamCompositionLayout.standardLayout(ScreenLayoutType.VERTICAL); 31 | videoClient.updateBroadcastLayout(VIDEO_BROADCAST_ID, layout); 32 | 33 | System.out.println("Updated broadcast layout"); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/EarmuffCall.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class EarmuffCall { 28 | public static void main(String... args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | client.getVoiceClient().earmuffCall(VOICE_CALL_ID); 35 | Thread.sleep(3000); 36 | client.getVoiceClient().unearmuffCall(VOICE_CALL_ID); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/EndCall.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package com.vonage.quickstart.voice; 24 | 25 | import com.vonage.client.VonageClient; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class EndCall { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | client.getVoiceClient().terminateCall(VOICE_CALL_ID); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/MuteCall.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class MuteCall { 28 | public static void main(String... args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | client.getVoiceClient().muteCall(VOICE_CALL_ID); 35 | Thread.sleep(3000); 36 | client.getVoiceClient().unmuteCall(VOICE_CALL_ID); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/OutboundTextToSpeech.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.voice.Call; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class OutboundTextToSpeech { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | client.getVoiceClient().createCall(new Call(VOICE_TO_NUMBER, VONAGE_VIRTUAL_NUMBER, VOICE_ANSWER_URL)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/RetrieveCallInfo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.voice.CallInfo; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class RetrieveCallInfo { 29 | public static void main(String... args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | CallInfo details = client.getVoiceClient().getCallDetails(VOICE_CALL_ID); 36 | System.out.println(details); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/SendDtmfToCall.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | 23 | package com.vonage.quickstart.voice; 24 | 25 | import com.vonage.client.VonageClient; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendDtmfToCall { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var response = client.getVoiceClient().sendDtmf(VOICE_CALL_ID, VOICE_DTMF_DIGITS); 36 | System.out.println(response); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/SendTalkToCall.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.voice.TalkPayload; 26 | import static com.vonage.quickstart.EnvironmentVariables.*; 27 | 28 | public class SendTalkToCall { 29 | public static void main(String[] args) throws Exception { 30 | VonageClient client = VonageClient.builder() 31 | .applicationId(VONAGE_APPLICATION_ID) 32 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 33 | .build(); 34 | 35 | var payload = TalkPayload.builder(VOICE_TEXT).language(VOICE_LANGUAGE).build(); 36 | client.getVoiceClient().startTalk(VOICE_CALL_ID, payload); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/StopAudioStream.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class StopAudioStream { 28 | public static void main(String... args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var response = client.getVoiceClient().stopStream(VOICE_CALL_ID); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/StopTextToSpeech.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class StopTextToSpeech { 28 | public static void main(String... args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var response = client.getVoiceClient().stopTalk(VOICE_CALL_ID); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/StreamAudioToCall.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class StreamAudioToCall { 28 | public static void main(String[] args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | var response = client.getVoiceClient().startStream(VOICE_CALL_ID, VOICE_STREAM_URL, 0); 35 | Thread.sleep(5000); 36 | response = client.getVoiceClient().stopStream(VOICE_CALL_ID); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/SubscribeToDtmfEvents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class SubscribeToDtmfEvents { 28 | public static void main(String... args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | client.getVoiceClient().addDtmfListener(VOICE_CALL_ID, VOICE_EVENT_URL); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/TransferCall.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class TransferCall { 28 | public static void main(String... args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | client.getVoiceClient().transferCall(VOICE_CALL_ID, VOICE_NCCO_URL); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/TransferCallNCCO.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import com.vonage.client.voice.ncco.Ncco; 26 | import com.vonage.client.voice.ncco.TalkAction; 27 | import static com.vonage.quickstart.EnvironmentVariables.*; 28 | 29 | public class TransferCallNCCO { 30 | public static void main(String... args) throws Exception { 31 | VonageClient client = VonageClient.builder() 32 | .applicationId(VONAGE_APPLICATION_ID) 33 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 34 | .build(); 35 | 36 | TalkAction talkAction = TalkAction.builder("This is a transfer action using an inline NCCO.").build(); 37 | client.getVoiceClient().transferCall(VOICE_CALL_ID, new Ncco(talkAction)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /src/main/java/com/vonage/quickstart/voice/UnsubscribeFromDtmfEvents.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2025 Vonage 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * The above copyright notice and this permission notice shall be included in 12 | * all copies or substantial portions of the Software. 13 | * 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 20 | * THE SOFTWARE. 21 | */ 22 | package com.vonage.quickstart.voice; 23 | 24 | import com.vonage.client.VonageClient; 25 | import static com.vonage.quickstart.EnvironmentVariables.*; 26 | 27 | public class UnsubscribeFromDtmfEvents { 28 | public static void main(String... args) throws Exception { 29 | VonageClient client = VonageClient.builder() 30 | .applicationId(VONAGE_APPLICATION_ID) 31 | .privateKeyPath(VONAGE_PRIVATE_KEY_PATH) 32 | .build(); 33 | 34 | client.getVoiceClient().removeDtmfListener(VOICE_CALL_ID); 35 | } 36 | } 37 | --------------------------------------------------------------------------------