freshgo

module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: MIT

README

freshgo

Freshworks Golang APIs

To do

  • Freshchat
    • User
    • Agent
    • Conversation
  • Freshdesk

Install

go get github.com/toanppp/freshgo

Example

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/toanppp/freshgo/freshchat"
)

func main() {
	f := freshchat.New("url", "accessToken")

	resp, err := f.CreateConversation(context.Background(), freshchat.Conversation{
		Status: freshchat.ConversationStatusNew,
		Messages: []freshchat.Message{
			{
				MessageParts: []freshchat.MessagePart{
					{
						Text: freshchat.Text{
							Content: "Hello World",
						},
					},
				},
				ActorType: freshchat.ActorTypeUser,
				ActorID:   "userID",
			},
		},
		ChannelID: "channelID",
		Users: []freshchat.User{
			{
				ID: "userID",
			},
		},
	})
	if err != nil {
		log.Fatalf("an error occurred: %v", err)
	}

	fmt.Printf("%+v\n", resp)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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