Skip to content

Latest commit

 

History

History
130 lines (108 loc) · 3.41 KB

README.md

File metadata and controls

130 lines (108 loc) · 3.41 KB

HelpScoutNet

HelpScoutNet is a .NET class library that provides an easy-to-use interface for the helpscout.net web api

##Methods Implemented

###Help Desk API

  • Conversation
    • List Conversations
    • Get Conversations
    • Get Attachment Data
    • Create Conversation
    • Update Conversation
    • Create Thread
  • Customers
    • List Customers
    • List Mailbox Customers
    • Get Customer
    • Create Customer
    • Update Customer
  • Mailboxes
    • List Mailboxes
    • Get Mailbox
    • Get Folders
  • Search
    • Conversations
    • Customers
  • Tags
    • List Tags
  • Users
    • List Users
    • Get User
    • List Users ny Mailbox
  • Workflows
    • List Workflows

###Docs API

Nothing done yet

##Examples

###Initialization of the client

var client = new HelpScoutClient(ApiKey);

###Search customers

var client = new HelpScoutClient(ApiKey);
var customersSearch = client.SearchCustomers(new SearchRequest{ Query = "(customer:\"[email protected]\")"});
foreach (var searchresult in customersSearch.Items)
{
    Console.WriteLine(searchresult.FirstName + searchresult.LastName);   
}

###List Mailboxes

var mailboxes = client.ListMailboxes();
foreach (var mailboxStub in mailboxes.Items)
{    
    Console.WriteLine(mailboxStub.Id);
}
  

###Create conversation

var newConv = client.CreateConversation(new Conversation
                {
                    Type = ConversationType.email,
                    Subject = "Testing the Helpscout API Mathieu",
                    Mailbox = new MailboxRef
                    {
                        Id = 38556
                    },
                    Status = ConversationStatus.active,
                    Customer = new Person
                    {
                        Email = "[email protected]",
                    },

                    Threads = new List<Thread>{
                        new Thread
                        {
                            Type = ThreadType.message,
                            Body = "This is the body of the email \n something else" + Environment.NewLine + "and again",
                            Status = ThreadStatus.active,
                            CreatedBy = new Person
                            {    
                                Id = 60895,
                                Type = PersonType.user,
                                Email = "[email protected]"
                            } 
                        }
                     }

                });

###Add a note, create thread

var thread = client.CreateThread(newconv.Id, new Thread
                {
                    CreatedBy = new Person
                    {
                        Id = 60895,
                        Type = PersonType.user,
                        Email = "[email protected]"
                    },
                    Type = ThreadType.note,
                    Body = "This is a note from API",
                    Status = ThreadStatus.active
                });

###Field Selectors

Each endpoint returns a default set of fields based upon the given request. However, you can override this behavior by supplying one or more field selectors to explicitly request the data you need.

Instead of returning a complete customer object, you could return just the ID and lastname.

client.GetCustomer(123, new CustomerRequest {Fields = new[] {"id", "lastName"}});