# Golang Bot SDK

This Bot SDK enables developers to create chatbots for managing chat groups. You can develop a bot capable of managing group chats using various standards, such as token-gated chats which can be useful for managing exclusive or private groups.&#x20;

Create custom chatbots tailored to your needs and add them seamlessly to the existing chat groups. This can save time and effort, as well as improve the efficiency and effectiveness of chat group management.

### Install

```bash
go get github.com/sending-network/sendingnetwork-bot
```

### Usage

#### Prepare a configuration file

{% hint style="info" %}
Please contact <developer@sending.network> for a test P2P node URL.
{% endhint %}

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

```yaml
endpoint: ""
wallet_address: ""
private_key: ""
```

You can use an existing wallet account, or generate a new account by running:

```bash
go run tools/generate_wallet_account.go
```

#### Create an instance of `Client`

After reading the configuration file, create an instance of `Client`

```go
package main
​
import (
  "os"
  
  sdnclient "github.com/sending-network/sendingnetwork-bot"
  "gopkg.in/yaml.v3"
)
​
func main() {
    configData, _ := os.ReadFile("config.yaml")
    config := sdnclient.Config{}
    _ = yaml.Unmarshal(configData, &config)
    cli, _ := sdnclient.NewClient(&config)
}
```

#### Call API functions

```go
// create new room
respCreateRoom, _ := cli.CreateRoom(&sdnclient.ReqCreateRoom{
  Name:   "TestRoom",
})
​
// invite user to the room
respInviteUser, _ := cli.InviteUser(respCreateRoom.RoomID, &sdnclient.ReqInviteUser{
    UserID: userID,
})
​
// logout to invalidate access token
respLogout, _ := cli.Logout()
```

### Examples

You can see more use cases in the `examples` directory.

### License

Apache 2.0


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sending-network.gitbook.io/sending.network/sdk-documentation/bot-sdks/golang-bot-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
