Coder Social home page Coder Social logo

robinbetts / helpscoutnet Goto Github PK

View Code? Open in Web Editor NEW

This project forked from soulfire86/helpscoutnet

0.0 0.0 0.0 146 KB

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

License: MIT License

Smalltalk 0.01% C# 92.87% PowerShell 7.13%

helpscoutnet's Introduction

Build status

HelpScoutNet

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

Endpoints Implemented

Help Desk API

  • Conversation
  • Customers
  • Mailboxes
  • Tags
  • Users
  • Workflows

Docs API

Nothing done yet

Examples

Initialization of the client

var client=new HelpScoutApiClient("clientId","clientSecret");
//initialize token from the given credentials
await client.GetToken(true);

Customer Endpoints

List Customer

//search customer by their first name, pass null to list 
var searchQuery = new CustomerSearchQuery(){FirstName = "Otis" };
var pagedCustomer = await client.Customers.List(searchQuery);
foreach (var customer in pagedCustomer.Items)
{
    Console.WriteLine("First Name :{0}, Last Name: {1}",customer.FirstName,customer.LastName);
}

Get Customer Detail

//search customer by their first name, pass null to list 
var customerDetail= await client.Customers.Get(id);
Console.WriteLine($"First Name:{customerDetail.FirstName}");
foreach (var email in customerDetail.Embedded.Emails)
{
    Console.WriteLine($"Email:{email.Value}, Type:{email.Type}");
           
}

List Mailboxes

  var mailBoxList = await client.Mailboxes.List();
  foreach (var mailBox in mailBoxList.Items)
  {
    Console.WriteLine($"{mailBox.Name}");
  }

Create conversation

 var req = new ConversationCreateRequest
       {
                MailboxId = 177024,
                Type = ConversationType.Email,
                Subject = "Hey there!",
                Tags = new List<string> { "high-priority" },
                Status = ConversationStatus.Pending,
                Customer = new Customer
                {
                    Email = "[email protected]"
                },
                Threads = new List<ThreadCreateRequest>
                {
                   //add a note to this conversation
                    new ThreadCreateRequest
                    {
                        Type = ThreadType.Note,
                        Text = "Can you please resolve this issue asap.",
                    },
                    new ThreadCreateRequest
                    {
                        Type = ThreadType.Customer,
                        Text = "This issue keeps happening.",
                        Customer = new CreateConservationThreadCustomer
                        {
                            Email = "[email protected]"
                        }
                    }
                }
            };
 var conversationId = await client.Conversations.Create(req);
 Console.WriteLine($"Created Conversation Id: {conversationId}");

Get conversation detail

  var conversationDetail = await client.Conversations.Get(conversationId);
  Console.WriteLine($"Subject: {conversationDetail.Subject}");

Delete a conversation

await client.Conversations.Delete(conversationId);

Creating Threads

var threadEndpoint = client.Conversations.Endpoints.Threads(conversationId);
var customerThread = new CreateThreadRequest()
{
 Text = "This is a customer thread"
};
await threadEndpoint.CreateCustomerThread(customerThread,customerId);
//Similarly, Chat, Phone, Reply threads can be created
 

 var noteThread = new CreateThreadRequest()
{
 Text = "This is a note thread"
 
 Attachments=new List<Attachment>{
     new Attachment{
         FileName="Some attachment name",
         MimeType="image/png",
         Data=Convert.ToBase64String(File.ReadAllBytes("C:\\some-attachment.png"))
     }
 }
};
//note thread does not require customerId 
 await threadEndpoint.CreateNoteThread(noteThread);

  

helpscoutnet's People

Contributors

mathieukempe avatar douglasg14b avatar krynium avatar dwainbunker avatar dalmirog avatar luiscreates avatar marklubi avatar tothegills avatar soulfire86 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.