Node.js SDK
A Node.js Bot SDK for SendingNetwork.
1. Add Dependency
Start by installing the SDK as a dependency in your Node.js project:
npm i sendingnetwork-bot-sdk2. Prepare a Configuration File
Create a file named bot.creds.json and provide the following information:
{
"nodeUrl": "NODE_URL",
"walletAddress": "YOUR_WALLET_ADDRESS",
"privateKey": "YOUR_PRIVATE_KEY",
"developerKey": "YOUR_DEV_KEY"
}You can configure the NODE_URL with https://portal0101.sending.network to connect to a public Edge Node.
Make sure to replace YOUR_WALLET_ADDRESS , YOUR_PRIVATE_KEY and YOUR_DEV_KEY with the actual value.
3. Create an Instance of SDNClient
SDNClientAfter setting up the configuration file, you can create an instance of the SDNClient class. This will allow you to interact with the SendingNetwork API.
You will need a developer key to access the Edge Network. For further insight into the mechanism and to request a developer key, please consult the provided guide here.
4. Interact with the SDK
Once you have created an instance of SDNClient and started syncing with the SendingNetwork server, you can use the SDK to perform various actions. Here are a few examples:
Create a new room
Invite a user to a room
Send a message
Examples
For more examples and detailed use cases, you can refer to the examples directory in the SDK repository.
Last updated