Help Scout API Wrapper
This gem is a wrapper around the Help Scout API. The current version is targeting the Mailbox 2.0 API.
Add this line to your application's Gemfile:
And then execute:
HelpScout.configure do |config| config.app_id = ENV["HELP_SCOUT_APP_ID"] config.app_secret = ENV["HELP_SCOUT_APP_SECRET"] config.access_token = HelpScout::API::AccessToken.create end
HelpScout::Conversation.list location = HelpScout::Conversation.create(...) conversation = HelpScout::Conversation.get(location.split("/").last) conversation.update("replace", "/subject", "New Subject")
HelpScout::Mailbox.list mailbox = HelpScout::Mailbox.get(id) mailbox.fields mailbox.folders
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.
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.
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.
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.