Skip to content
This repository was archived by the owner on Jan 8, 2024. It is now read-only.
 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Freshdesk API (Go, golang)

Basic API submitting a ticket to Freshdesk.com

How to use

import (
	"fmt"
	"os"

	"github.com/leebenson/conform"
	"github.com/smallpdf/freshdesk"
)

func main() {
	client, err := freshdesk.NewClient("your-domain", "your-api-key")
	if err != nil {
		fmt.Printf("Could not create client: %s\n", err)
		os.Exit(1)
	}

	ticket := &Ticket{
		Email:       "email@example.com",
		Name:        "your name",
		Subject:     "this is a test",
		Type:        freshdesk.Question,
		Description: "the content of the ticket would go here",
		Status:      freshdesk.Open,
		Priority:    freshdesk.Medium,
		Source:      freshdesk.Portal,
	}

	// optionally check the ticket with conform
	conform.Strings(ticket)

	if _, err := client.CreateTicket(ticket); err != nil {
		fmt.Printf("failed to create ticket: %s", err)
		os.Exit(1)
	}
}

Conform library compatibility

Ticket struct fields work with the optional conform library.

About

Basic Freskdesk.com ticket creation API (Go, golang)

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages