Created
August 1, 2025 08:13
-
-
Save yolkmonday/74786fda624e1947427d65775414723d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.io.OutputStream; | |
| import java.net.HttpURLConnection; | |
| import java.net.URL; | |
| public class KirimiMediaMessage { | |
| public static void main(String[] args) { | |
| try { | |
| URL url = new URL("https://api.kirimi.id/v1/send-message"); | |
| HttpURLConnection conn = (HttpURLConnection) url.openConnection(); | |
| conn.setRequestMethod("POST"); | |
| conn.setRequestProperty("Content-Type", "application/json"); | |
| conn.setDoOutput(true); | |
| String jsonInputString = """ | |
| { | |
| "user_code": "YOUR-USER-CODE", | |
| "device_id": "YOUR-DEVICE-ID", | |
| "receiver": "6281234567890", | |
| "message": "Lihat gambar ini!", | |
| "media_url": "https://example.com/image.jpg", | |
| "secret": "YOUR-SECRET-KEY" | |
| } | |
| """; | |
| try (OutputStream os = conn.getOutputStream()) { | |
| byte[] input = jsonInputString.getBytes("utf-8"); | |
| os.write(input, 0, input.length); | |
| } | |
| int responseCode = conn.getResponseCode(); | |
| System.out.println("Response Code: " + responseCode); | |
| conn.getInputStream().transferTo(System.out); | |
| } catch (Exception e) { | |
| e.printStackTrace(); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment