intercom-go

module
v0.0.0-...-1f0e7e2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 2, 2015 License: MIT

README

intercom-go

Go bindings for the Intercom API (https://api.intercom.io).

API Documentation

This is an unofficial library that is not affiliated with Intercom. Official libraries are available at github.com/intercom.

Build Status

Example usage

package intercom_test

import (
    "fmt"
    "github.com/xzyfer/intercom-go/intercom"
    "net/http"
    "os"
)

func Example() {
    apiKey := os.Getenv("INTERCOM_API_KEY")
    appId := os.Getenv("INTERCOM_APP_ID")
    if appId == "" {
        log.Fatal("Error: you must set your Intercom App ID in the INTERCOM_APP_ID environment variable.")
    }
    if apiKey == "" {
        log.Fatal("Error: you must set your Intercom API key in the INTERCOM_API_KEY environment variable.")
    }
    authClient := &http.Client{
        Transport: &intercom.APIKeyAuthTransport{APIKey: apiKey, AppID: appId},
    }
    apiclient = intercom.NewAPIClient(authClient)

    tags, err := apiclient.ListTags()
    if err != nil {
        fmt.Printf("Error listing tags: %s\n", err)
        os.Exit(1)
    }
    fmt.Printf("Found %d tags.\n", len(tags))
    for _, tag := range tags {
        fmt.Printf(" - %s (ID: [%d-char ID])\n", tag.Name, len(tag.ID))
    }
}

Running the tests

To run the tests:

go test ./intercom

Setup

You'll need to configure the INTERCOM_API_KEY and INTERCOM_APP_ID environment variables to you're Intercom.io api_key and app_id respectively. This information can be found in your Intercom account's App Settings > API Keys menu.

INTERCOM_API_KEY=your-api0key INTERCOM_APP_ID=your-app-id ./intercom list-tags

Implemented APIs

Currently only a small subset of API endpoints are implemented. Please open an issue if you required additional API endpoints.

Acknowledgements

The library's architecture and testing code are adapted from go-github, created by Will Norris.

Directories

Path Synopsis
cmd
intercom command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL