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
  • Create a chat room
  • Query DM room by User ID
  • Join a chat room
  • Leave the chat room
  • Invite user to the room
  • Revoke invitation
  • Remove user from a room
  • Ban user from a room
  • Modify the user's own nickname in a room
  • Modify room name
  • Delete room
  1. SDK Documentation
  2. JavaScript client SDK

Room

JavaScript Room APIs

Create a chat room

Name
Parameters Description
Response

createRoom(options,callback,)

Please refer to the table below.

N/A

Name
Type
Description

creation_content

CreationContent

Extra keys, such as m.federate, to be added to the content of the m.room.create event. The server will overwrite the following keys: creator, room_version. Future versions of the specification may allow the server to overwrite other keys.

initial_state

StateEvent: Please refer to the table below

A list of state events to set in the new room. This allows the user to override the default state events set in the new room. The expected format of the state events are an object with type, state_key and content keys set.

Takes precedence over events set by preset, but gets overridden by name and topic keys.

invite

string

A list of user IDs to invite to the room. This will tell the server to invite everyone in the list to the newly created room.

name

string

If this is included, an m.room.name event will be sent into the room to indicate the name of the room. See Room Events for more information on m.room.name.

preset

enum

Convenience parameter for setting various default state events based on a preset.

If unspecified, the server should use the visibility to determine which preset to use. A visbility of public equates to a preset of public_chat and private visibility equates to a preset of private_chat.

One of: [private_chat, public_chat, trusted_private_chat].

room_alias_name

string

The desired room alias local part. If this is included, a room alias will be created and mapped to the newly created room. The alias will belong to the same node which created the room. For example, if this was set to “foo” and sent to the node “example.com” the complete room alias would be #foo:example.com.

The complete room alias will become the canonical alias for the room and an m.room.canonical_alias event will be sent into the room.

topic

string

If this is included, an m.room.topic event will be sent into the room to indicate the topic for the room. See Room Events for more information on m.room.topic.

visibility

enum

A public visibility indicates that the room will be shown in the published room list. A private visibility will hide the room from the published room list. Rooms default to private visibility if this key is not included. NB: This should not be confused with join_rules which also uses the word public.

One of: [public, private].

Name
Type
Description

content

object

The content of the event.

state_key

string

The state_key of the state event. Defaults to an empty string.

type

string

The type of event to send.

Query DM room by User ID

Name
Parameters Description
Response

findDMRoomByUserId

userId: user Id

dm_rooms: room Id array

Join a chat room

Name
Parameters Description
Response

joinRoom(roomIdOrAlias, opts, callbackCallback)

roomIdOrAlias: The room identifier or alias to join.

N/A

Leave the chat room

Name
Parameters Description
Response

leave(roomId,callback)

roomId: room id

callback (optional):

N/A

Invite user to the room

Name
Parameters Description
Response

invite(roomId,userId,callback)

roomId: room id

userId: user id

callback (optional):

N/A

Revoke invitation

Name
Parameters Description
Response

revoke(roomId, userId, reason, callback)

roomId: room ID;

userId: user id;reason(optional): string;

callback(optional): function

N/A

Remove user from a room

Remove the user from the room.

Name
Parameters Description
Response

kick(roomId,userId,reason,callback)

roomId: room id

userId: user id

reason: reason string

callback (optional):

N/A

Ban user from a room

As the room owner, you can ban users, effectively removing them from the room and preventing their re-entry.

Name
Parameters Description
Response

ban(roomId,userId,reason,callback)

roomId: room id

userId: user id

reason: reason string

callback (optional):

N/A

Modify the user's own nickname in a room

Name
Parameters Description
Response

setNickName(roomId,userId,membershipValue,nickName)

roomId: room id

userId: user id

membershipValue:

nickName: new nickname

N/A

Modify room name

Name
Parameters Description
Response

setRoomName(roomId, name,callback)

roomId: room id

name: new room name

callback (optional):

event_id

Delete room

Name
Parameters Description
Response

deleteRoom

roomId: room ID

N/A

PreviousMessageNextContact

Last updated 1 year ago