Skip to content

GetStream/stream-chat-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

229fc14 · Apr 8, 2025
Feb 24, 2025
Feb 16, 2022
Jan 14, 2022
Oct 28, 2019
Apr 12, 2022
May 23, 2024
Feb 3, 2022
Apr 7, 2025
Feb 16, 2022
Aug 20, 2020
May 23, 2024
Jul 30, 2019
Sep 10, 2024
May 25, 2023
May 23, 2024
May 23, 2024
Feb 24, 2025
Feb 24, 2025
Apr 11, 2022
May 23, 2024
Jan 25, 2022
Feb 10, 2025
Apr 8, 2025
Oct 28, 2024
Aug 23, 2024
Feb 10, 2025
Apr 11, 2022
May 23, 2024
Mar 31, 2022
May 23, 2024
Feb 1, 2022
May 23, 2024
Mar 28, 2022
Feb 15, 2022
Apr 8, 2025
Aug 31, 2022
May 23, 2024
Feb 24, 2025
Feb 24, 2025
Feb 1, 2022
Feb 15, 2022
Mar 21, 2022
Mar 17, 2022
Feb 1, 2022
May 23, 2024
Apr 8, 2025
Apr 8, 2025
Oct 28, 2024
Feb 10, 2025
Feb 1, 2022
Aug 1, 2022
Apr 7, 2025
Sep 10, 2024
Feb 1, 2022
Feb 15, 2022
Apr 1, 2022
Apr 1, 2022
Feb 27, 2024
May 23, 2024
Apr 7, 2025
Apr 7, 2025
Apr 8, 2025
Apr 7, 2025

Repository files navigation

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/v7

✨ Getting started

package main

import (
	"os"

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

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

	// Define a context
	ctx := context.Background()

	// use client methods

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

	// use channel methods
	msg, err := channel.SendMessage(ctx, &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.