Skip to content

Commit ea9eedb

Browse files
committed
feat: Add MMS text / file / content types
1 parent 463079a commit ea9eedb

File tree

9 files changed

+172
-12
lines changed

9 files changed

+172
-12
lines changed

.env-example

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ MESSAGES_GEOSPECIFIC_API_URL="https://api-eu.nexmo.com/v1/messages"
2323
MESSAGES_GEOSPECIFIC_API_HOST="api-eu"
2424
MESSAGES_SANDBOX_URL="https://messages-sandbox.nexmo.com/v1/messages"
2525
MESSAGES_MESSAGE_ID="00000000-0000-4000-8000-000000000000"
26-
MESSAGES_IMAGE_URL="https://example.org/image.jpg"
27-
MESSAGES_AUDIO_URL="https://example.org/audio.mp3"
28-
MESSAGES_VIDEO_URL="https://example.org/video.mp4"
29-
MESSAGES_FILE_URL="https://example.org/file.pdf"
30-
MESSAGES_VCARD_URL="https://example.org/vcard.vcf"
26+
MESSAGES_IMAGE_URL="https://file-examples.com/storage/fe435d6a5467c753ca23df4/2017/10/file_example_JPG_100kB.jpg"
27+
MESSAGES_AUDIO_URL="https://file-examples.com/wp-content/storage/2017/11/file_example_MP3_700KB.mp3"
28+
MESSAGES_VIDEO_URL="https://file-examples.com/wp-content/storage/2017/04/file_example_MP4_480_1_5MG.mp4"
29+
MESSAGES_FILE_URL="https://file-examples.com/wp-content/storage/2017/02/file-sample_100kB.doc"
30+
MESSAGES_VCARD_URL="https://raw.githubusercontent.com/nuovo/vCard-parser/refs/heads/master/Example.vcf"
3131
MESSAGES_EMOJI="🐱"
3232
MESSAGES_CAPTION="Additional text to accompany the message"
3333

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ jobs:
2828
distribution: 'temurin'
2929
java-version: ${{ matrix.java }}
3030
- name: Setup Gradle
31-
uses: gradle/actions/setup-gradle@94baf225fe0a508e581a564467443d0e2379123b
31+
uses: gradle/actions/setup-gradle@245c8a24de79c0dbeabaf19ebcbbd3b2c36f278d
3232
- name: Build with Gradle
3333
run: ./gradlew build

.github/workflows/codeql.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ jobs:
2929
- name: Checkout repository
3030
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
3131
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a
32+
uses: github/codeql-action/init@1bb15d06a6fbb5d9d9ffd228746bf8ee208caec8
3333
with:
3434
languages: ${{ matrix.language }}
3535
build-mode: ${{ matrix.build-mode }}
3636
- name: Perform CodeQL Analysis
37-
uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a
37+
uses: github/codeql-action/analyze@1bb15d06a6fbb5d9d9ffd228746bf8ee208caec8
3838
with:
3939
category: "/language:${{matrix.language}}"

SNIPPETS.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ This file was generated by running [AggregateSnippets.kt](src/main/kotlin/Aggreg
1111
- [**Numbers**](#numbers)
1212
- [**SMS**](#sms)
1313
- [**Verify**](#verify)
14-
- [**Number Verification**](#number-verification)
1514
- [**Redact**](#redact)
1615
- [**SIM Swap**](#sim-swap)
1716
- [**Voice**](#voice)
@@ -560,6 +559,29 @@ val messageId = client.messages.send(
560559
```
561560

562561
### MMS
562+
#### Send MMS Text
563+
```kotlin
564+
val messageId = client.messages.send(
565+
mmsText {
566+
to(MESSAGES_TO_NUMBER)
567+
from(MMS_SENDER_ID)
568+
text("This is an MMS text message sent using the Messages API")
569+
}
570+
)
571+
```
572+
573+
#### Send MMS File
574+
```kotlin
575+
val messageId = client.messages.send(
576+
mmsFile {
577+
to(MESSAGES_TO_NUMBER)
578+
from(MMS_SENDER_ID)
579+
url(MESSAGES_FILE_URL)
580+
caption(MESSAGES_CAPTION)
581+
}
582+
)
583+
```
584+
563585
#### Send MMS Video
564586
```kotlin
565587
val messageId = client.messages.send(
@@ -572,7 +594,7 @@ val messageId = client.messages.send(
572594
)
573595
```
574596

575-
#### Send MMS Vcard
597+
#### Send MMS vCard
576598
```kotlin
577599
val messageId = client.messages.send(
578600
mmsVcard {
@@ -608,6 +630,21 @@ val messageId = client.messages.send(
608630
)
609631
```
610632

633+
#### Send MMS Content
634+
```kotlin
635+
val messageId = client.messages.send(
636+
mmsContent {
637+
to(MESSAGES_TO_NUMBER)
638+
from(MMS_SENDER_ID)
639+
addAudio(MESSAGES_AUDIO_URL)
640+
addImage(MESSAGES_IMAGE_URL)
641+
addVideo(MESSAGES_VIDEO_URL)
642+
addFile(MESSAGES_FILE_URL)
643+
addVcard(MESSAGES_VCARD_URL)
644+
}
645+
)
646+
```
647+
611648
### Messenger
612649
#### Send Messenger Audio
613650
```kotlin
@@ -1701,7 +1738,6 @@ val response = client.verify.sendVerification(VERIFY_BRAND_NAME) {
17011738
println("Verification sent: ${response.requestId}")
17021739
```
17031740

1704-
## Number Verification
17051741
## Redact
17061742
### Redact Insight
17071743
```kotlin

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/main/kotlin/AggregateSnippets.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ fun String.toHeadingTitle(): String {
6262
.replace("numberverification", "Number Verification", true)
6363
.replace("simswap", "SIM Swap", true)
6464
.replace("whatsapp", "WhatsApp", true)
65+
.replace("vcard", "vCard", true)
66+
.replace("callncco", "Call NCCO", true)
6567

6668
val acronyms = arrayOf(
6769
"jwt", "id", "uuid", "url", "sim",
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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.kt.messages.mms
23+
24+
import com.vonage.client.kt.*
25+
import com.vonage.quickstart.kt.*
26+
27+
fun main() {
28+
val client = Vonage {
29+
applicationId(VONAGE_APPLICATION_ID)
30+
privateKeyPath(VONAGE_PRIVATE_KEY_PATH)
31+
}
32+
33+
val messageId = client.messages.send(
34+
mmsContent {
35+
to(MESSAGES_TO_NUMBER)
36+
from(MMS_SENDER_ID)
37+
addImage(MESSAGES_IMAGE_URL)
38+
addFile(MESSAGES_FILE_URL)
39+
}
40+
)
41+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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.kt.messages.mms
23+
24+
import com.vonage.client.kt.*
25+
import com.vonage.quickstart.kt.*
26+
27+
fun main() {
28+
val client = Vonage {
29+
applicationId(VONAGE_APPLICATION_ID)
30+
privateKeyPath(VONAGE_PRIVATE_KEY_PATH)
31+
}
32+
33+
val messageId = client.messages.send(
34+
mmsFile {
35+
to(MESSAGES_TO_NUMBER)
36+
from(MMS_SENDER_ID)
37+
url(MESSAGES_FILE_URL)
38+
caption(MESSAGES_CAPTION)
39+
}
40+
)
41+
}
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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.kt.messages.mms
23+
24+
import com.vonage.client.kt.*
25+
import com.vonage.quickstart.kt.*
26+
27+
fun main() {
28+
val client = Vonage {
29+
applicationId(VONAGE_APPLICATION_ID)
30+
privateKeyPath(VONAGE_PRIVATE_KEY_PATH)
31+
}
32+
33+
val messageId = client.messages.send(
34+
mmsText {
35+
to(MESSAGES_TO_NUMBER)
36+
from(MMS_SENDER_ID)
37+
text("This is an MMS text message sent using the Messages API")
38+
}
39+
)
40+
}

0 commit comments

Comments
 (0)