Code Monkey home page Code Monkey logo

help_scout-sdk's Introduction

Help Scout API Wrapper

Build Status Gem Version

This gem is a wrapper around the Help Scout API. The current version is targeting the Mailbox 2.0 API.

Installation

Add this line to your application's Gemfile:

gem "help_scout-sdk"

And then execute:

$ bundle

Progress

Models List Get Create Update Delete
Attachment
Conversations
Conversation::Threads
Customers
Notes
Mailboxes
Mailbox::Folders
Mailbox::Workflows
Tags
Teams
Team::Members
Users
Workflows
Endpoint Supported
Reports
Search
Webhooks

Usage

Configuration

HelpScout.configure do |config|
  config.app_id = ENV["HELP_SCOUT_APP_ID"]
  config.app_secret = ENV["HELP_SCOUT_APP_SECRET"]
end

Conversations

Documentation Link

HelpScout::Conversation.list
location = HelpScout::Conversation.create(...)
conversation = HelpScout::Conversation.get(location.split("/").last)
conversation.update("replace", "/subject", "New Subject")

Customers

Documentation Link

HelpScout::Customer.list
HelpScout::Customer.get(id)

Mailboxes

Documentation Link

HelpScout::Mailbox.list
mailbox = HelpScout::Mailbox.get(id)
mailbox.fields
mailbox.folders

Threads

Documentation Link

conversation = HelpScout::Conversation.list.first
new_thread = HelpScout::Thread.create(conversation.id, "notes", { text: 'Hello, world!' })
threads = HelpScout::Thread.list(conversation.id)
latest_thread = threads.first
latest_thread.update("replace", "/text", "Updating a threads text.")
modified_thread = HelpScout::Thread.get(conversation.id, latest_thread.id)

Users

Documentation Link

HelpScout::User.list
user = HelpScout::User.get(id)

Caching Access Tokens

Since short-lived access tokens aren't likely to be embedded into environment variables, it can be difficult to share them across processes. To work around this, you can configure a token_cache (and optional token_cache_key) to be used to store and retrieve the token until expiry. In general any object that conforms to the ActiveSupport::Cache::Store API should work. For example, using an application's Rails cache:

HelpScout.configuration.token_cache = Rails.cache
HelpScout.configuration.token_cache_key
# => 'help_scout_token_cache'
HelpScout.configuration.token_cache_key = 'my-own-key'

With caching configured, whenever the gem attempts to create an access token, it will first attempt to read a value from the cache using the configured cache key. If it's a hit, the cached values will be used to create a new AccessToken. If it's a miss, then the gem will make a request to the Help Scout API to retrieve a new token, writing the token's details to the cache before returning the new token.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/taxjar/help_scout-sdk. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the H2 project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

help_scout-sdk's People

Contributors

prsimp avatar andremleblanc avatar jjustinwhite avatar

Watchers

James Cloos 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.