Skip to content

feat: Add MMS text / file / content types #7

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .env-example
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ MESSAGES_GEOSPECIFIC_API_URL="https://api-eu.nexmo.com/v1/messages"
MESSAGES_GEOSPECIFIC_API_HOST="api-eu"
MESSAGES_SANDBOX_URL="https://messages-sandbox.nexmo.com/v1/messages"
MESSAGES_MESSAGE_ID="00000000-0000-4000-8000-000000000000"
MESSAGES_IMAGE_URL="https://example.org/image.jpg"
MESSAGES_AUDIO_URL="https://example.org/audio.mp3"
MESSAGES_VIDEO_URL="https://example.org/video.mp4"
MESSAGES_FILE_URL="https://example.org/file.pdf"
MESSAGES_VCARD_URL="https://example.org/vcard.vcf"
MESSAGES_IMAGE_URL="https://file-examples.com/storage/fe435d6a5467c753ca23df4/2017/10/file_example_JPG_100kB.jpg"
MESSAGES_AUDIO_URL="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_700KB.mp3"
MESSAGES_VIDEO_URL="https://file-examples.com/wp-content/storage/2017/04/file_example_MP4_480_1_5MG.mp4"
MESSAGES_FILE_URL="https://file-examples.com/wp-content/storage/2017/02/file-sample_100kB.doc"
MESSAGES_VCARD_URL="https://raw.githubusercontent.com/nuovo/vCard-parser/refs/heads/master/Example.vcf"
MESSAGES_EMOJI="🐱"
MESSAGES_CAPTION="Additional text to accompany the message"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ jobs:
distribution: 'temurin'
java-version: ${{ matrix.java }}
- name: Setup Gradle
uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b
uses: gradle/actions/setup-gradle@245c8a24de79c0dbeabaf19ebcbbd3b2c36f278d
- name: Build with Gradle
run: ./gradlew build
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Initialize CodeQL
uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a
uses: github/codeql-action/init@1bb15d06a6fbb5d9d9ffd228746bf8ee208caec8
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a
uses: github/codeql-action/analyze@1bb15d06a6fbb5d9d9ffd228746bf8ee208caec8
with:
category: "/language:${{matrix.language}}"
39 changes: 36 additions & 3 deletions SNIPPETS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ This file was generated by running [AggregateSnippets.kt](src/main/kotlin/Aggreg
- [**Numbers**](#numbers)
- [**SMS**](#sms)
- [**Verify**](#verify)
- [**Number Verification**](#number-verification)
- [**Redact**](#redact)
- [**SIM Swap**](#sim-swap)
- [**Voice**](#voice)
Expand Down Expand Up @@ -560,6 +559,29 @@ val messageId = client.messages.send(
```

### MMS
#### Send MMS Text
```kotlin
val messageId = client.messages.send(
mmsText {
to(MESSAGES_TO_NUMBER)
from(MMS_SENDER_ID)
text("This is an MMS text message sent using the Messages API")
}
)
```

#### Send MMS File
```kotlin
val messageId = client.messages.send(
mmsFile {
to(MESSAGES_TO_NUMBER)
from(MMS_SENDER_ID)
url(MESSAGES_FILE_URL)
caption(MESSAGES_CAPTION)
}
)
```

#### Send MMS Video
```kotlin
val messageId = client.messages.send(
Expand All @@ -572,7 +594,7 @@ val messageId = client.messages.send(
)
```

#### Send MMS Vcard
#### Send MMS vCard
```kotlin
val messageId = client.messages.send(
mmsVcard {
Expand Down Expand Up @@ -608,6 +630,18 @@ val messageId = client.messages.send(
)
```

#### Send MMS Content
```kotlin
val messageId = client.messages.send(
mmsContent {
to(MESSAGES_TO_NUMBER)
from(MMS_SENDER_ID)
addImage(MESSAGES_IMAGE_URL)
addFile(MESSAGES_FILE_URL)
}
)
```

### Messenger
#### Send Messenger Audio
```kotlin
Expand Down Expand Up @@ -1701,7 +1735,6 @@ val response = client.verify.sendVerification(VERIFY_BRAND_NAME) {
println("Verification sent: ${response.requestId}")
```

## Number Verification
## Redact
### Redact Insight
```kotlin
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/AggregateSnippets.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ fun String.toHeadingTitle(): String {
.replace("numberverification", "Number Verification", true)
.replace("simswap", "SIM Swap", true)
.replace("whatsapp", "WhatsApp", true)
.replace("vcard", "vCard", true)
.replace("callncco", "Call NCCO", true)

val acronyms = arrayOf(
"jwt", "id", "uuid", "url", "sim",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2025 Vonage
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.vonage.quickstart.kt.messages.mms

import com.vonage.client.kt.*
import com.vonage.quickstart.kt.*

fun main() {
val client = Vonage {
applicationId(VONAGE_APPLICATION_ID)
privateKeyPath(VONAGE_PRIVATE_KEY_PATH)
}

val messageId = client.messages.send(
mmsContent {
to(MESSAGES_TO_NUMBER)
from(MMS_SENDER_ID)
addImage(MESSAGES_IMAGE_URL)
addFile(MESSAGES_FILE_URL)
}
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2025 Vonage
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.vonage.quickstart.kt.messages.mms

import com.vonage.client.kt.*
import com.vonage.quickstart.kt.*

fun main() {
val client = Vonage {
applicationId(VONAGE_APPLICATION_ID)
privateKeyPath(VONAGE_PRIVATE_KEY_PATH)
}

val messageId = client.messages.send(
mmsFile {
to(MESSAGES_TO_NUMBER)
from(MMS_SENDER_ID)
url(MESSAGES_FILE_URL)
caption(MESSAGES_CAPTION)
}
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2025 Vonage
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package com.vonage.quickstart.kt.messages.mms

import com.vonage.client.kt.*
import com.vonage.quickstart.kt.*

fun main() {
val client = Vonage {
applicationId(VONAGE_APPLICATION_ID)
privateKeyPath(VONAGE_PRIVATE_KEY_PATH)
}

val messageId = client.messages.send(
mmsText {
to(MESSAGES_TO_NUMBER)
from(MMS_SENDER_ID)
text("This is an MMS text message sent using the Messages API")
}
)
}
Loading