Skip to content

Commit aa7ffcf

Browse files
committed
feat: Add MMS text/file/content messages
1 parent 63580a5 commit aa7ffcf

File tree

4 files changed

+170
-0
lines changed

4 files changed

+170
-0
lines changed

SNIPPETS.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,17 @@ var response = client.getMessagesClient().sendMessage(
806806
System.out.println("Message sent successfully. ID: " + response.getMessageUuid());
807807
```
808808
### MMS
809+
#### Send MMS Text
810+
811+
```java
812+
var response = client.getMessagesClient().sendMessage(
813+
MmsTextRequest.builder()
814+
.from(MMS_SENDER_ID).to(MESSAGES_TO_NUMBER)
815+
.text("This is an MMS message with text")
816+
.build()
817+
);
818+
System.out.println("Message sent successfully. ID: "+response.getMessageUuid());
819+
```
809820
#### Send MMS Video
810821

811822
```java
@@ -828,6 +839,32 @@ var response = client.getMessagesClient().sendMessage(
828839
);
829840
System.out.println("Message sent successfully. ID: "+response.getMessageUuid());
830841
```
842+
#### Send MMS Content
843+
844+
```java
845+
var response = client.getMessagesClient().sendMessage(
846+
MmsContentRequest.builder()
847+
.from(MMS_SENDER_ID).to(MESSAGES_TO_NUMBER)
848+
.addAudio(MESSAGES_AUDIO_URL)
849+
.addImage(MESSAGES_IMAGE_URL)
850+
.addVideo(MESSAGES_VIDEO_URL)
851+
.addFile(MESSAGES_FILE_URL)
852+
.addVcard(MESSAGES_VCARD_URL)
853+
.build()
854+
);
855+
System.out.println("Message sent successfully. ID: "+response.getMessageUuid());
856+
```
857+
#### Send MMS File
858+
859+
```java
860+
var response = client.getMessagesClient().sendMessage(
861+
MmsFileRequest.builder()
862+
.from(MMS_SENDER_ID).to(MESSAGES_TO_NUMBER)
863+
.url(MESSAGES_FILE_URL)
864+
.build()
865+
);
866+
System.out.println("Message sent successfully. ID: "+response.getMessageUuid());
867+
```
831868
#### Send MMS Image
832869

833870
```java
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
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.MmsContentRequest;
26+
import static com.vonage.quickstart.EnvironmentVariables.*;
27+
28+
public class SendMmsContent {
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+
MmsContentRequest.builder()
37+
.from(MMS_SENDER_ID).to(MESSAGES_TO_NUMBER)
38+
.addAudio(MESSAGES_AUDIO_URL)
39+
.addImage(MESSAGES_IMAGE_URL)
40+
.addVideo(MESSAGES_VIDEO_URL)
41+
.addFile(MESSAGES_FILE_URL)
42+
.addVcard(MESSAGES_VCARD_URL)
43+
.build()
44+
);
45+
System.out.println("Message sent successfully. ID: "+response.getMessageUuid());
46+
}
47+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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+
}

0 commit comments

Comments
 (0)