Getting Started


Quick Start Guide

Get started with Togo MQ in just a few minutes. This guide will walk you through creating an account, generating an API token, and sending your first message.

Step 1: Create an Account

  1. Visit togomq.io and click "Try Togo MQ today"
  2. Sign up with your email and password, or use Google authentication for quick access
  3. Verify your email address (if required)
  4. You'll be redirected to your dashboard

{info} Already have an account? Simply log in to access your dashboard.

Step 2: Generate API Token

To use Togo MQ, you need an API authentication token:

  1. Navigate to your Dashboard
  2. Go to the API Tokens section
  3. Click "Create New Token"
  4. Give your token a descriptive name (e.g., "Production App", "Development")
  5. Copy and securely store your token - you won't be able to see it again!

{danger} Keep your tokens secure! Never commit API tokens to version control or share them publicly. Treat them like passwords.

Step 3: Install SDK

Currently, we provide an official SDK for Go with more languages coming soon.

Go SDK Installation

go get github.com/TogoMQ/togomq-sdk-go

Requirements:

  • Go 1.24 or higher
  • Valid TogoMQ authentication token

Step 4: Start Publishing

Here's a simple example to publish your first message:

package main

import (
    "context"
    "log"

    "github.com/TogoMQ/togomq-sdk-go"
)

func main() {
    // Create client with your token
    config := togomq.NewConfig(
        togomq.WithToken("your-token-here"),
    )

    client, err := togomq.NewClient(config)
    if err != nil {
        log.Fatal(err)
    }
    defer client.Close()

    // Create a message
    msg := togomq.NewMessage("my-first-topic", []byte("Hello, Togo MQ!"))

    // Publish the message
    resp, err := client.PubBatch(context.Background(), []*togomq.Message{msg})
    if err != nil {
        log.Fatal(err)
    }

    log.Printf("Published %d messages successfully!\n", resp.MessagesReceived)
}

Subscribe to Messages

Here's how to subscribe and receive messages:

package main

import (
    "context"
    "log"

    "github.com/TogoMQ/togomq-sdk-go"
)

func main() {
    // Create client
    config := togomq.NewConfig(togomq.WithToken("your-token-here"))
    client, err := togomq.NewClient(config)
    if err != nil {
        log.Fatal(err)
    }
    defer client.Close()

    // Subscribe to your topic
    opts := togomq.NewSubscribeOptions("my-first-topic")
    msgChan, errChan, err := client.Sub(context.Background(), opts)
    if err != nil {
        log.Fatal(err)
    }

    // Process incoming messages
    for {
        select {
        case msg := <-msgChan:
            if msg == nil {
                return
            }
            log.Printf("Received: %s\n", string(msg.Body))

        case err := <-errChan:
            log.Printf("Error: %v\n", err)
            return
        }
    }
}

Next Steps

Congratulations! You've sent your first message with Togo MQ. Here's what to explore next:


{success} Need help? Contact our support team at support@togomq.io