Skip to content

equalsgibson/five9-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Five9Go website
Easily integrate your Go application with the Five9 REST and WebSocket API

  • Easy to use: Get up and running with the library in minutes
  • Intuitive: Access your Five9 Domains data using only a few functions
  • Actively developed: Ideas and contributions welcomed!

Go Code Coverage Go Reference Go Report Card

Getting Started

For a full API reference, see the official Five9 REST API documentation

Prerequisites

Download and install Go, version 1.21+, from the official Go website.

Install

go get github.com/equalsgibson/five9-go

Quickstart

To see more detailed examples, checkout the example directory. This will demonstrate how to use the library to make REST requests, or connect to the WebSocket and access the in-memory cache.

Lookup all the users within your Five9 Domain

Below is a short example showing how to list all the users within your Five9 Domain using the library.

Note
Make sure to go get the library, and set the required ENV variables (FIVE9PASSWORD and FIVE9USERNAME) before running the below example.

package main

import (
	"context"
	"log"
	"net/http"
	"os"

	"github.com/equalsgibson/five9-go/five9"
	"github.com/equalsgibson/five9-go/five9/five9types"
)

func main() {
	// Set up a new Five9 service
	ctx := context.Background()
	c := five9.NewService(
		five9types.PasswordCredentials{
			Username: os.Getenv("FIVE9USERNAME"),
			Password: os.Getenv("FIVE9PASSWORD"),
		},
		five9.AddRequestPreprocessor(func(r *http.Request) error {
			log.Printf("five9 Rest API Call: [%s] %s", r.Method, r.URL.String())

			return nil
		}),
	)

	domainUsers, err := c.Supervisor().GetAllDomainUsers(ctx)
	if err != nil {
		log.Fatal(err)
	}

	// Print a count of the users within your Five9 Domain
	log.Printf("You have %d users within your Five9 Domain.\n", len(domainUsers))
}

Contributing

Contributions are what make the open source community such an amazing place to learn, get inspired, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE.txt for more information.

Contact

Chris Gibson (@equalsgibson)

Project Link: https://github.com/equalsgibson/five9-go

Acknowledgments

  • Huge thanks to @aaronellington for the continued assistance
  • Thanks to Five9 for providing documentation for their API.