GithubHelp home page GithubHelp logo

isabella232 / sinch-java-sms Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sinch/sinch-java-sms

0.0 0.0 0.0 1.38 MB

Sinch Java SMS helper library, moved from https://github.com/clxcommunications/sdk-xms-java

License: MIT License

Java 100.00%

sinch-java-sms's Introduction

REST API SDK for SMS

This is the Java SDK for the Sinch REST SMS API for sending and receiving single or batch SMS messages. It also supports scheduled sends, organizing your frequent recipients into groups, and customizing your message for each recipient using parameterization. It offers an asynchronous Java API that provides convenient access to all the features of the SMS REST API.

The library is compatible with Java 8 and later.

Using

To use this SDK, you can install them as follow

With Maven

<dependency>
    <groupId>com.sinch</groupId>
    <artifactId>sdk-sms</artifactId>
    <version>1.0.7</version>
</dependency>

With Gradle

implementation 'com.sinch:sdk-sms:1.0.7'

Building and installing

This project uses the Maven build tool, and the typical Maven goals are supported. To install the package to your local Maven repository it therefore is sufficient to execute.

git clone https://github.com/sinch/sinch-java-sms.git
cd sinch-java-sms    
mvn clean install

Build .jar file

$ mvn package

It will give you sdk-sms-1.0.7-jar-with-dependencies.jar

To skip local test

$ mvn package -Dmaven.test.skip=true

in your terminal. The project will then be compiled and tested before finally being installed in your local repository.

Developing in Eclipse

To import the project into Eclipse it is necessary to install the m2e plugin and the m2e-apt connector. Both are available at the Eclipse Marketplace. Before importing the project ensure that automatic configuration of JDT APT is enabled. The Immutables website has good instructions with screenshots.

After this initial setup development in Eclipse should be reasonably straight forward.

Quick Start

Set up Api Client

String SERVICE_PLAN_ID = "SERVICE_PLAN_ID";
String TOKEN = "SERVICE_TOKEN";
ApiConnection conn =
        ApiConnection.builder()
            .servicePlanId(SERVICE_PLAN_ID)
            .token(TOKEN)
            .start()

Sending Text Message

String SENDER = "SENDER"; // Optional
String [] RECIPIENTS = {"1232323131", "3213123"}  ;
MtBatchTextSmsResult batch =
          conn.createBatch(
              SinchSMSApi.batchTextSms()
                  .sender(SENDER)
                  .addRecipient(RECIPIENTS)
                  .body("Something good")
                  .build()

Sending Group Message

      // Creating simple Group
      GroupResult group = conn.createGroup(SinchSMSApi.groupCreate().name("Subscriber").build());

      // Adding members (numbers) into the group
      conn.updateGroup(
          group.id(), SinchSMSApi.groupUpdate().addMemberInsertion("15418888", "323232").build());

      // Sending a message to the group
      MtBatchTextSmsResult batch = conn.createBatch(
          SinchSMSApi.batchTextSms()
              .addRecipient(group.id().toString())
              .body("Something good")
              .build());

      System.out.println("Successfully sent batch " + batch.id());

License

This project is licensed under the Apache License Version 2.0. See the LICENSE.txt file for the license text.

sinch-java-sms's People

Contributors

rycee avatar gsvensk avatar thomasf147 avatar thongtran715 avatar sunsee18 avatar spacedsweden avatar jay-91 avatar jcaose avatar vishal-beep136 avatar dependabot[bot] avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.