Joseph Jude

Integrating Betaout With A Golang Application

2015.09.07 / golang / wisecrowd /

Betaout is a comprehensive e-marketing suite. In this post, I show how to integrate Betaout with a Golang App using their REST API.

Betaout, is a comprehensive e-marketing suite. You can connect your SAAS app with Betaout and send user events to it, from signup to purchase. Once these events are sent to Betaout, you can measure every metrics for the marketing and sales funnel. You can segment your users (or customers), through variety of filters and email them from within the app. It is a valuable tool for any SAAS owner.

I wanted to integrate Betaout with WiseCrowd. Wisecrowd is an audience engagement tool, I developed, to crowd-source questions from the audience at events. Event organizers can create events and pass the event id to participants. Then participants can login, join the event and ask questions. They can also up vote and down vote questions, so that the best questions are answered at events.

You can send event data using Javascript, which is the usual way. Thankfully, Betaout has a REST API and I used that rather than their Javascript version. Why? Two reasons.

Betaout integration

To integrate with Betaout you need API key and project id. After creating an account and logging in, go grab these keys from API Keys page.

Here is a method to send user events to Betaout.

package base

import (

const (
    betaoutAPI = "xxxxxxxxxxxxxxxxx"
    betaoutURL = ""

func SendToBetaout(event string, email string) {

    betaParams := []byte(`{"event":"` + event + `", "apiKey":"` + betaoutAPI + `","email":"` + email + `"}`)
    betaParamsInBytes := bytes.NewBuffer(betaParams)

    req, _ := http.NewRequest("POST", betaoutURL, betaParamsInBytes)
    req.Header.Set("Content-Type", "application/json")

    client := &http.Client{}
    resp, err := client.Do(req)

    if err != nil {

    defer resp.Body.Close()
    body, _ := ioutil.ReadAll(resp.Body)

Last three lines are probably needed while you develop and when you move to production, you should comment them out. You should also include a mechanism to log errors or send to a SAAS service like LogEntries.

Now this method can be invoked from different methods in your application. As an example, whenever a new users signs up, invoke go SendToBetaout("signup", email) to send signup event to Betaout. Or invoke go SendToBetaout(fmt.Sprintf("up_voted_on: %d", entry.Id), user.Email) to register vote event.

If you run a SAAS app, you should definitely checkout Betaout. It is a great tool.

Share this post on

Twitter | | |
Sign up for my weekly newsletter

I will send blog updates to this email. You can unsubscribe at any time using the link in those emails.