Skip to main content

Sending an event

1

Creating an account

First things first, get signed in and create your team.
2

Creating an app

In Sailhouse, apps are the logical separators for your topics. This could be environments, projects or both!
3

Create a token

To send an event to an application, we need a token to pass into our SDK.Go to your new app > Settings > Create
4

Start sending events

First, adding the SDK package
Adding the package
go get -u github.com/sailhouse/sdk-go/sailhouse
Then, a basic example which reads the token from an environment variable SAILHOUSE_TOKEN.
main.go
package main

import (
    "github.com/sailhouse/go-sdk/sailhouse"
)

func main() {
  client := sailhouse.NewSailhouseClient(os.Getenv("SAILHOUSE_TOKEN"))

  client.Publish("awesome-example", map[string]string{
    "message": "Hello World!",
  })
}

Next steps

Install the CLI

Do everything you need from your terminal with the Sailhouse CLI

Learn how to handle push events

You’ve sent an event, now see how you can handle them.