Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pramithamj/slack-sdk-go
A lightweight and modular SDK for building Slack bots and apps in Go. With this SDK, you can easily send messages, manage users, and extend functionality to integrate with the Slack API seamlessly.
https://github.com/pramithamj/slack-sdk-go
go sdk slack
Last synced: 27 days ago
JSON representation
A lightweight and modular SDK for building Slack bots and apps in Go. With this SDK, you can easily send messages, manage users, and extend functionality to integrate with the Slack API seamlessly.
- Host: GitHub
- URL: https://github.com/pramithamj/slack-sdk-go
- Owner: PramithaMJ
- License: mit
- Created: 2024-12-28T19:38:22.000Z (30 days ago)
- Default Branch: main
- Last Pushed: 2024-12-29T21:14:38.000Z (29 days ago)
- Last Synced: 2024-12-29T22:19:30.614Z (29 days ago)
- Topics: go, sdk, slack
- Language: Go
- Homepage: https://pkg.go.dev/github.com/pramithamj/[email protected]#section-readme
- Size: 16.6 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# π Slack SDK for Go
A **lightweight** and **modular** SDK for building Slack bots and apps in **Go**. With this SDK, you can easily send messages, manage users, and extend functionality to integrate with the Slack API seamlessly.
---
### π Features
- π¨ **Send messages** to Slack channels
- π€ **Fetch user information**
- β‘οΈ **Extendable** for additional Slack APIs
- 𧩠**Lightweight** and modular design
- π― **Easy integration** into Go projects---
### π Getting Started
#### β Prerequisites
- **Go** 1.18 or later
- A **Slack Bot Token** with the required permissions.
> [Create a Slack App](https://api.slack.com/apps) to generate your token.#### π¦ Installation
Add the SDK to your project using:
```sh
go get github.com/pramithamj/slack-sdk-go/pkg/slack
```
β¨ Example UsageHereβs a quick example to send a message using the SDK:
```go
package mainimport (
"fmt"
"log""github.com/pramithamj/slack-sdk-go/pkg/slack"
)func main() {
// Replace with your actual Slack Bot Token
token := "xoxb-your-slack-bot-token"
sdk := slack.NewSlackSDK(token)channel := "C123456789" // Slack channel ID
message := "Hello, Slack from Go SDK!"response, err := sdk.SendMessage(channel, message)
if err != nil {
log.Fatalf("Error sending message: %v", err)
}fmt.Printf("Message sent successfully: %v\n", response)
}
```
#### π API Methods1οΈβ£ SendMessage
Send a message to a Slack channel.
π₯ Parameters:
β’ channel (string): The channel ID where the message will be sent.
β’ text (string): The message text.π€ Example:
```go
response, err := sdk.SendMessage("C123456789", "Hello, Slack!")
if err != nil {
log.Fatalf("Error: %v", err)
}
fmt.Println(response)
```
2οΈβ£ GetUserInfoFetch details about a Slack user.
π₯ Parameters:
β’ userID (string): The ID of the user.π€ Example:
```go
response, err := sdk.GetUserInfo("U123456789")
if err != nil {
log.Fatalf("Error: %v", err)
}
fmt.Println(response)
```
#### π TestingRun all tests using:
go test ./tests/...
#### π€ Contributing
We welcome contributions! To contribute:
1. Fork the repository
2. Create a new branch: git checkout -b feature-name
3. Commit your changes: git commit -m 'Add feature'
4. Push the branch: git push origin feature-name
5. Open a Pull Request#### π License
This project is licensed under the MIT License. See the LICENSE file for more details.
π€ Author
PramithaMJ
β’ π» [PramithaMJ]](https://github.com/pramithamj)
β’ π§ [email protected]Enjoy coding with the Slack SDK for Go! π§βπ»