All Projects → GetStream → stream-chat-go

GetStream / stream-chat-go

Licence: BSD-3-Clause License
Stream Chat official Golang API Client

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to stream-chat-go

talkjs-examples
TalkJS (https://talkjs.com) examples
Stars: ✭ 60 (+27.66%)
Mutual labels:  chat-api
stream-chat-php
Stream Chat official PHP API Client
Stars: ✭ 17 (-63.83%)
Mutual labels:  chat-api
stream-chat-ruby
Stream Chat official Ruby API Client
Stars: ✭ 25 (-46.81%)
Mutual labels:  chat-api
stream-chat-net
Stream Chat official .NET API Client
Stars: ✭ 35 (-25.53%)
Mutual labels:  chat-api
android-chat-tutorial
Sample apps for the Stream Chat Android SDK's official tutorial
Stars: ✭ 44 (-6.38%)
Mutual labels:  chat-api

Official Go SDK for Stream Chat

build godoc

Official Go API client for Stream Chat, a service for building chat applications.
Explore the docs »

Report Bug · Request Feature

📝 About Stream

You can sign up for a Stream account at our Get Started page.

You can use this library to access chat API endpoints server-side.

For the client-side integrations (web and mobile) have a look at the JavaScript, iOS and Android SDK libraries (docs).

⚙️ Installation

go get github.com/GetStream/stream-chat-go/v5

Getting started

package main

import (
	"os"

	stream "github.com/GetStream/stream-chat-go/v5"
)

var APIKey = os.Getenv("STREAM_KEY")
var APISecret = os.Getenv("STREAM_SECRET")
var userID = "" // your server user id

func main() {
	// Initialize client
	client, err := stream.NewClient(APIKey, APISecret)
	
	// Or with a specific timeout
	client, err := stream.NewClient(APIKey, APISecret, WithTimeout(3 * time.Second))

	// Or using only environmental variables: (required) STREAM_KEY, (required) STREAM_SECRET,
	// (optional) STREAM_CHAT_TIMEOUT
	client, err := stream.NewClientFromEnvVars()

	// handle error

	// use client methods

	// create channel with users
	users := []string{"id1", "id2", "id3"}
	channel, err := client.CreateChannelWithMembers("messaging", "channel-id", userID, users...)

	// use channel methods
	msg, err := channel.SendMessage(&stream.Message{Text: "hello"}, userID)
}

✍️ Contributing

We welcome code changes that improve this library or fix a problem, please make sure to follow all best practices and add tests if applicable before submitting a Pull Request on Github. We are very happy to merge your code in the official repository. Make sure to sign our Contributor License Agreement (CLA) first. See our license file for more details.

Head over to CONTRIBUTING.md for some development tips.

🧑‍💻 We are hiring!

We've recently closed a $38 million Series B funding round and we keep actively growing. Our APIs are used by more than a billion end-users, and you'll have a chance to make a huge impact on the product within a team of the strongest engineers all over the world.

Check out our current openings and apply via Stream's website.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].