SendingNetwork
  • OVERVIEW
    • Getting Started
    • FAQs
  • Network Instructional Articles
    • Basics
      • Introducing the Edge, WatchDog, and Guardian Nodes
      • Overview
      • Messaging Solution
      • Privacy Solution
      • Rich Communication Solution
      • Multi-Platform Solution
      • Decentralized Identity
      • Multiple Chat Modes
      • How It Works
      • Token Utility
      • The Team
    • Key Concepts
      • Decentralized Identity
      • Social Graphs
      • Edge Node
  • SDK Documentation
    • Glossary
    • JavaScript client SDK
      • DID
      • User
      • Message
      • Room
      • Contact
      • Social Graph
    • iOS client SDK
      • Push
      • DID
      • User
      • Message
      • Room
      • Contact
    • Android client SDK
      • User
      • Room
    • Java SDK
      • DID
      • Room
      • Message
    • Node.js SDK
      • DID
      • Room
      • Message
    • Unreal SDK
      • DID
      • User
      • Message
      • Room
    • Unity SDK
      • DID
      • Room
      • Message
    • Website chat widget SDK
      • Customization
      • DID
      • User
      • Room
      • Message
      • Other
    • Bot SDKs
      • Golang Bot SDK
        • DID
        • User
        • Room
        • Message
    • Extensible Message Interface
    • Push Notifications
    • Flutter SDK
      • DID
      • User
      • Message
      • Room
    • PHP SDK
      • DID
      • Room
      • User
    • Developer Key
  • Acquisition Kit
    • Social Boost Development Instructions
  • WatchDog Agent
    • WatchDog Agent Guide
    • WatchDog Agent Deployment Tutorial
      • Linux Deployment Tutorial
    • One-Click Deployment
  • Edge Node
    • Edge Node Deployment Tutorial
    • VPS Setup Guide
      • Google Cloud Platform (GCP)
      • Amazon Web Services (AWS)
      • Contabo
    • Check Node Stats with Auto-Reply Bot in SendingMe App
    • Alpha-3 Testnet FAQs
  • delegation node
    • Delegation Node Deployment Tutorial
  • Private Delegation Node
  • Use Cases
    • Wallet-to-Wallet Messaging
    • Dapp Notifications
    • Identity Verification
    • Gamer Acquisition
    • Cross-platform Trading
Powered by GitBook
On this page
  • Install
  • Add dependency
  • Prepare a configuration file
  • Create Client Instance
  • Call API functions
  1. SDK Documentation

Java SDK

Version 0.1.3

The Java Bot SDK empowers developers with the capability to manage chats and send/receive messages.

Install

Add dependency

repositories {
    maven {
        url 'https://s01.oss.sonatype.org/content/repositories/releases/'
    }
}

dependencies {
    implementation 'io.github.sending-network:sdn-sdk-java:0.1.0'
}

Prepare a configuration file

Use https://portal0101.sending.network/ as the public endpoint.

Provide P2P node endpoint, wallet address, and private key in config.yaml:

endpoint: ""
wallet_address: ""
private_key: ""

Create Client Instance

Once the configuration file has been read, create a Client instance, register the event listener, and initiate the syncing process.

import org.yaml.snakeyaml.Yaml;
import com.sending.sdk.Client;

Map<String, Object> config = new Yaml().load(new BufferedReader(new FileReader(configFile)));
Client client = new Client((String)config.get("endpoint"));
client.loginDID((String)config.get("wallet_address"), (String)config.get("private_key"));

client.registerRoomEventListener(roomEvents -> {
    // process room events
    roomEvents.forEach(System.out::println);
});
client.startSync();

Call API functions

// create new room
String roomId = client.createRoom(roomName, "", null, System.out::println);

// invite user to the room
String userId = ""
client.inviteUser(roomId, userId, null);

// send room message
String eventId = client.sendMessage(roomId, "hello");

// logout to invalidate access token
client.logout()
PreviousRoomNextDID

Last updated 1 year ago