{"id":26451008,"url":"https://github.com/syniverse/messaging-java","last_synced_at":"2026-01-18T08:33:02.596Z","repository":{"id":25405187,"uuid":"71072824","full_name":"Syniverse/Messaging-Java","owner":"Syniverse","description":"Java SDK for SCG Messaging APIs","archived":false,"fork":false,"pushed_at":"2022-11-16T05:53:55.000Z","size":67,"stargazers_count":0,"open_issues_count":6,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T11:04:31.664Z","etag":null,"topics":["java","java-sdk","mms","push-notifications","senderid","sms","voice"],"latest_commit_sha":null,"homepage":"https://developer.syniverse.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Syniverse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-16T19:39:18.000Z","updated_at":"2018-09-27T01:33:16.000Z","dependencies_parsed_at":"2023-01-14T02:41:10.259Z","dependency_job_id":null,"html_url":"https://github.com/Syniverse/Messaging-Java","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Syniverse/Messaging-Java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syniverse%2FMessaging-Java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syniverse%2FMessaging-Java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syniverse%2FMessaging-Java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syniverse%2FMessaging-Java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Syniverse","download_url":"https://codeload.github.com/Syniverse/Messaging-Java/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Syniverse%2FMessaging-Java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28534148,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-18T00:39:45.795Z","status":"online","status_checked_at":"2026-01-18T02:00:07.578Z","response_time":98,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["java","java-sdk","mms","push-notifications","senderid","sms","voice"],"created_at":"2025-03-18T16:07:19.964Z","updated_at":"2026-01-18T08:33:02.575Z","avatar_url":"https://github.com/Syniverse.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# SCG Java SDK\nThis is the Java version of the SCG API.\nWe have prepared simple to use Java classes, representing the\ndifferent REST API interfaces.\n\nThe Java API hides some of the REST API's constraints, like\nlists being returned in logical pages of \u003ci\u003en\u003c/i\u003e records. With the\nJava SDK, the list() method returns a iterator that returns\nitems, until there are no more.\n\nPlease register for a free account at https://developer.syniverse.com to get your API keys.\n\n## How to use the SDK\nAll the data objects follow a common pattern.\n\nYou get a handle to a resource (like Contact or SenderId) by getting\nan instance of \u003cObject\u003e.Resource(session).\n\nThe session object is obtained from Scg.connect(), and gives you\nsequential (blocking) access to the REST API. If you want to\nprocess many requests in parallel, you need many session objects.\n\nThe resource object you get from  \u003cObject\u003e.Resource(session)\ntypically has \u003cb\u003elist()\u003c/b\u003e and \u003cb\u003ecreate()\u003c/b\u003e methods (depending\non the actual REST API methods available for that data type).\n\nTo list the data objects for a resource, like your Contacts,\nyou can call list() without any arguments to get all the contacts,\nor list(Map\u003cString, String\u003e) to filter the result-set. list()\nreturns an iterator that let's you iterate over the data-set.\n\nYou can create an object by calling create() with an object (template)\nof the data type you aim to create, with the relevant members assigned\nvalid values.\n\n```java\n    // Create from object\n    Contact template = new Contact();\n    template.setFirstName(\"John\");\n    template.setLastName(\"Doe\");\n    template.setPrimaryMdn(\"123456789\");\n\n    Contact.Resource res = new Contact.Resource(session);\n    String id = res.create(template);\n```\n\nAll objects that can be updated or deleted has \u003cb\u003eupdate()\u003c/b\u003e and/or\n\u003cb\u003edelete()\u003c/b\u003e methods. The resource of an object also have \u003cb\u003edelete()\u003c/b\u003e\nmethods, so if you need to delete an object you just know by it's id,\nthere is no need to instatiate it. You just call:\n\n```java\n    res.delete(id)\n```\n\nSome objects has methods that let you add/query or delete\nother objects or references it holds to other objects. For\nexample, when you create a message-request to a group of\ncontacts, you may generate a large number of message objects.\nThese can be iterated over from MessageRequest.listMessages()\n\n```java\n    MessageRequest.Resource mrqRes = new MessageRequest.Resource(session);\n    MessageRequest request = mrqRes.get(\"qteDxVrAhlMlmTwDrMAvN3\");\n    for(Message msg: request.listMessages(null)) {\n        // Do something with msg\n    }\n```\n\n## Error handling\nErrors are reported trough exceptions.\n\n# Some examples\n\n## Listing Sender Id's\nIf you want to list available Sender Id's, it can be done as easy as:\n\n```java\n    // Construct an instance of the authentication object\n    // with authentication data from auth.json\n    AuthInfo auth = new AuthInfo(new File(\"auth.json\"));\n\n    // Prepare a session to the server.\n    Scg scg = new Scg();\n    Session session = scg.connect(\"https://api.syniverse.com\", auth);\n\n    // Request the complete list of sender id's from the server,\n    // where the class_id is COMMECRIAL and state is ACTIVE, and iterate\n    // over them one by one.\n\n    Map\u003cString, String\u003e filter = new HashMap\u003c\u003e();\n    filter.put(\"class_id\", \"COMMERCIAL\");\n    filter.put(\"state\", \"ACTIVE\");\n\n    SenderId.Resource res = new  SenderId.Resource(session);\n    for (SenderId sid : res.list(filter)) {\n        System.out.println(\"Sender id \" + sid.getId()\n            + \" has capabilities \" +  sid.getCapabilities().toString());\n    }\n\n```\n\nThis should produce output like:\n```text\nSender id oX1iQToXaWAXY6u3yLhja4 has capabilities [WECHAT]\nSender id m2sb4eA3mlEConWJzsfYq6 has capabilities [FACEBOOK]\nSender id ln9sk9JF6insXcJ5nUzKK3 has capabilities [SMS]\nSender id AE0vtyghu8dIrrpXesXPK1 has capabilities [MMS, SMS]\nSender id 3hTOgeTWYlflMB2zmYNoP has capabilities [SMS]\nSender id dY2GycQpj6OE1x2mH1Ezc6 has capabilities [VOICE]\nSender id KdNRN6dl5IkwIH5B829XJ2 has capabilities [MMS, SMS]\nSender id tcS8h40LXgvJsGMQI93WK4 has capabilities [MMS, SMS]\n```\n\n## Adding and updating a Contact\n```java\n\n    // Construct an instance of the authentication object\n    // with authentication data from auth.json\n    AuthInfo auth = new AuthInfo(new File(\"auth.json\"));\n\n    // Prepare a session to the server.\n    Scg scg = new Scg();\n    Session session = scg.connect(\"https://api.syniverse.com\", auth);\n\n    // Get a handle to the Contacts resource\n    Contact.Resource res = new Contact.Resource(session);\n\n    // Create a contact. Note that we get a contact id (string), not a Contact\n    // instance from Create.\n\n    Contact template = new Contact();\n    template.setFirstName(\"John\");\n    template.setLastName(\"Doe\");\n    template.setPrimaryMdn(\"123456789\");\n\n    String id = res.create(template);\n\n    // Get an instance of the contact\n    Contact contact = res.get(id);\n\n    // Let's add some information\n\n    contact.setExternalId(\"Test Extid 12345\");\n\n    //Update the contact on the server\n    contact.update();\n\n    // Verify that the server has the updated Contact\n    Contact vcontact = res.get(id);\n\n\n    System.out.println(\"Contact id \" + vcontact.getId()\n        + \", \" + vcontact.getFirstName() \"\n        + \" \" + vcontact.getLastName()\n        + \" has external id \\\"\" + vcontact.getExternalId() + \"\\\"\");\n\n    // Delete the contact on the server\n    contact.delete();\n```\n\nThis should produce output similar to:\n```text\nContact id xzrw4ukXaINXzgwu5XLnb1, John Doe has external id \"Test Extid 12345\"\n```\n\n## Sending a SMS to a GSM number\n```java\n    // Construct an instance of the authentication object\n    // with authentication data from auth.json\n    AuthInfo auth = new AuthInfo(new File(\"auth.json\"));\n\n    // Prepare a session to the server.\n    Scg scg = new Scg();\n    Session session = scg.connect(\"https://api.syniverse.com\", auth);\n\n    // Send SMS message\n    MessageRequest.Resource res = new MessageRequest.Resource(session);\n    MessageRequest mrq = new MessageRequest();\n    mrq.setFrom(\"sender_id:\" + \"tcS8h40LXgvJsGMQI93WK4\");\n    mrq.setTo(\"123456789\");\n    mrq.setBody(\"Hello World\");\n\n    String reqId = res.create(mrq);\n\n    System.out.println(\"Sent message request \" + reqId);\n```\n\nwhere the settings are changed to a real SenderId and GSM number.\n\nThis should produce output similar to:\n```text\nSent message request aQWY9PeMCO01TEH9bk1ek5\n```\n\n## Sending a Message to a Contact\n\nThis works as above, except for the to field in create()\n```java\n    String contactId = \"\u003cId of an existing contact\u003e\";\n    ...\n    mrq.setTo(\"contact:\" + contactId);\n    ...\n```\n\n## Sending a Message to a Group\n```java\n    // Construct an instance of the authentication object\n    // with authentication data from auth.json\n    AuthInfo auth = new AuthInfo(new File(\"auth.json\"));\n\n    // Prepare a session to the server.\n    Scg scg = new Scg();\n    Session session = scg.connect(\"https://api.syniverse.com\", auth);\n    Contact.Resource contactRes = new Contact.Resource(session);\n\n    // Create some contacts\n    Contact template = new Contact();\n    template.setFirstName(\"Bob\")\n    template.setPrimaryMdn(\"123456789\")\n    Srtring bobId = contactRes.create(template);\n\n    template.setFirstName(\"Alice\")\n    template.setPrimaryMdn(\"123456788\")\n    Srtring aliceId = contactRes.create(template);\n\n    // Create a group\n    ContactGroup.Resource groupRes = new ContactGroup.Resource(session);\n    ContactGroup groupTemplate = new ContactGroup();\n    groupTemplate.setName(\"Our Friends\");\n    String groupId = groupRes.create(groupTemplate);\n    ContactGroup friends = groupRes.get(groupId);\n\n\n    // add our new friends to the group\n    friends.AddContact(bobId);\n    friends.AddContact(aliceId);\n\n    // Send a message to our new friends\n    MessageRequest.Resource res = new MessageRequest.Resource(session);\n    MessageRequest mrq = new MessageRequest();\n    mrq.setFrom(\"sender_id:\" + \"tcS8h40LXgvJsGMQI93WK4\");\n    mrq.setTo(\"group:\" + friends.getId());\n    mrq.setBody(\"Hello World\");\n\n    String reqId = res.create(mrq);\n    System.out.println(\"Sent message request \" + reqId);\n```\n\n## Sending a MMS with an attachment\n\n```java\n    // Construct an instance of the authentication object\n    // with authentication data from auth.json\n    AuthInfo auth = new AuthInfo(new File(\"auth.json\"));\n\n    // Prepare a session to the server.\n    Scg scg = new Scg();\n    Session session = scg.connect(\"https://api.syniverse.com\", auth);\n\n    // Upload an attachment\n    Attachment attachmentTemplate = new Attachment();\n    attachmentTemplate.setName(\"test_upload\");\n    attachmentTemplate.setType(\"image/jpeg\");\n    attachmentTemplate.setFilename(\"cute-cat.jpg\");\n\n    Attachment.Resource attachmentRes = new Attachment.Resource(session);\n    String attId = attachmentRes.create(attachmentTemplate);\n    Attachment att = attachmentRes.get(attId);\n\n    att.uploadContent(\"/images/cats/cute.jpg\");\n    System.out.println(\"Uploaded attachment \" + att.getId());\n\n    // Send MMS message\n    MessageRequest.Resource mrqRes = new MessageRequest.Resource(session);\n    MessageRequest mrq = new MessageRequest();\n    mrq.setFrom(\"sender_id:\" + \"tcS8h40LXgvJsGMQI93WK4\");\n    mrq.setTo(\"123456789\");\n    mrq.setBody(\"Hello World\");\n    mrq.addAttachment(att.getId());\n    String reqId = mrqRes.create(mrq);\n\n    System.out.println(\"Sent message request \" + reqId);\n```\n\nThis should produce output similar to:\n```text\nUploaded attachment wMjURamVl9ITSXRJSkMoR4\nSent message request 9NeqCbNXBYvRO73jC2rbc5\n```\n\n## Checking the state of a Message Request\n```java\n    // Construct an instance of the authentication object\n    // with authentication data from auth.json\n    AuthInfo auth = new AuthInfo(new File(\"auth.json\"));\n\n    // Prepare a session to the server.\n    Scg scg = new Scg();\n    Session session = scg.connect(\"https://api.syniverse.com\", auth);\n\n    MessageRequest.Resource mrqRes = new MessageRequest.Resource(session);\n    MessageRequest mrq = mrqRes.get(\"qteDxVrAhlMlmTwDrMAvMM\");\n\n    System.out.println(\"Message Request \" + mrq.getId()\n        + \" is in state \" + mrq.getState()\n        + \" with \" + mrq.getDeliveredCount().toString()\n        + \" delivered and \" + mrq.getFailedCount().toString()\n        + \"failed messages\");\n\n    for(Message msg : mrq.listMessages()) {\n        System.out.println(\" - Message \" + msg.getId()\n            + \" is in state \" + msg.getState()\n            + \", error code: \" + msg.getFailureCode()\n            + \", error reason: \" + msg.getFailureDetails());\n    }\n```\n\nThis should produce output similar to:\n```text\nMessage Request qteDxVrAhlMlmTwDrMAvMM is in state COMPLETED with 2 delivered and 0 failed messages\n - Message HCHDrmhOX3rXvi3av1mXY6 is in state DELIVERED, error code: null, error reason: null\n - Message FDLoHMUmLjjYK51J531Xo5 is in state DELIVERED, error code: null, error reason: null\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyniverse%2Fmessaging-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyniverse%2Fmessaging-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyniverse%2Fmessaging-java/lists"}