Cosium / matrix-communication-client

A java client for the Matrix protocol.

Home Page:https://matrix.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Status Maven Central

Matrix Communication Client

A Matrix java client.

Example

public class Example {

  public static void main(String[] args) {
    MatrixResources matrix =
        MatrixResources.factory()
            .builder()
            .https()
            .hostname("matrix.example.org")
            .defaultPort()
            .usernamePassword("jdoe", "secret")
            .build();

    RoomResource room = matrix
        .rooms()
        .create(
            CreateRoomInput.builder()
                .name("Science")
                .roomAliasName("science")
                .topic("Anything about science")
                .build());
	
    room.sendMessage(Message.builder().body("Hello !").formattedBody("<b>Hello !</b>").build());
  }
}

Another example with existing room:

public class Example {

  public static void main(String[] args) {
    MatrixResources matrix =
        MatrixResources.factory()
            .builder()
            .https()
            .hostname("matrix.example.org")
            .defaultPort()
            .usernamePassword("jdoe", "secret")
            .build();

    RoomResource room = matrix
        .rooms()
        .byId("!PVvauSmjcHLwoAJkyT:matrix.example.org");
	
    room.sendMessage(Message.builder().body("Hello !").formattedBody("<b>Hello !</b>").build());
  }
}

Dependency

<dependency>
  <groupId>com.cosium.matrix_communication_client</groupId>
  <artifactId>matrix-communication-client</artifactId>
  <version>${matrix-communication-client.version}</version>
</dependency>

About

A java client for the Matrix protocol.

https://matrix.org/

License:MIT License


Languages

Language:Java 99.8%Language:Shell 0.2%