All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.telesign.MessagingClient Maven / Gradle / Ivy

Go to download

The TeleSign Java SDK is a Java library that provides an interface to TeleSign Web Services. TeleSign Web Services conform to the REST Web Service Design Model. Services are exposed as URI-addressable resources through the set of RESTful procedures in our TeleSign REST API.

The newest version!
package com.telesign;

import java.io.IOException;
import java.net.Proxy;
import java.security.GeneralSecurityException;
import java.util.HashMap;
import java.util.Map;

/**
 * TeleSign's Messaging API allows you to easily send SMS messages. You can send alerts, reminders, and notifications,
 * or you can send verification messages containing one-time passcodes (OTP).
 */
public class MessagingClient extends RestClient {

    private static final String MESSAGING_RESOURCE = "/v1/messaging";
    private static final String MESSAGING_STATUS_RESOURCE = "/v1/messaging/%s";

    public MessagingClient(String customerId, String apiKey) {
        super(customerId, apiKey);
    }

    public MessagingClient(String customerId, String apiKey, String restEndpoint) {
        super(customerId, apiKey, restEndpoint);
    }

    public MessagingClient(String customerId,
                           String apiKey,
                           String restEndpoint,
                           Integer connectTimeout,
                           Integer readTimeout,
                           Integer writeTimeout,
                           Proxy proxy,
                           final String proxyUsername,
                           final String proxyPassword) {
        super(customerId, apiKey, restEndpoint, connectTimeout, readTimeout, writeTimeout, proxy, proxyUsername, proxyPassword);
    }

    /**
     * Send a message to the target phone_number.
     * 

* See https://developer.telesign.com/docs/messaging-api for detailed API documentation. */ public TelesignResponse message(String phoneNumber, String message, String messageType, Map params) throws IOException, GeneralSecurityException { if (params == null) { params = new HashMap<>(); } params.put("phone_number", phoneNumber); params.put("message", message); params.put("message_type", messageType); return this.post(MESSAGING_RESOURCE, params); } /** * Retrieves the current status of the message. *

* See https://developer.telesign.com/docs/messaging-api for detailed API documentation. */ public TelesignResponse status(String referenceId, Map params) throws IOException, GeneralSecurityException { return this.get(String.format(MESSAGING_STATUS_RESOURCE, referenceId), params); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy