项目作者: fwuensche

项目描述 :
:small_red_triangle_down: Ruby Client for Crisp chat API
高级语言: Ruby
项目地址: git://github.com/fwuensche/crisp_client.git
创建时间: 2017-05-11T22:19:10Z
项目社区:https://github.com/fwuensche/crisp_client

开源协议:MIT License

下载


CrispClient

:small_red_triangle_down: Ruby Client for Crisp API

Usage

  1. cc = CrispClient::Base.new(email: ENV['CRISP_EMAIL'], password: ENV['CRISP_PASSWORD'])
  2. cc.authenticate
  3. #=> {"Authorization"=>"Basic MmjjiyAjSLuMmjjiyAjSLuMmjjiyAjSLuMmjjiyAjSLuMmjjiyAiaiIyMGUyYTdjYzA="}
  4. website_id = cc.find_website_id_by_name(website_name: "Touts")
  5. #=> "8sajk18272-4aab-kjhh-bkjh-8e3chjk5609"
  6. cc.get_people_statistics(website_id: website_id)
  7. #=> {"total"=>3523}
  8. person_id = cc.add_new_people_profile(website_id: website_id, nickname: "Flavio Wuensche", email: "flavio@touts.com.br")
  9. #=> "cd71e876-62e4-17hs-b6c2-570f44b3d83b"
  10. cc.add_new_people_profile(website_id: website_id, nickname: "Flavio Wuensche", email: "flavio@touts.com.br")
  11. #=> RuntimeError: people_exists
  12. cc.remove_people_profile(website_id: website_id, people_id: person_id)
  13. #=> "deleted"
  14. cc.remove_people_profile(website_id: website_id, people_id: person_id)
  15. #=> "people_not_found"
  16. cc.list_people_profiles(website_id: website_id)
  17. #=> will return the first 20 users by default
  18. cc.list_people_profiles(website_id: website_id, page_number: 2, search_filter: "test@email.com")
  19. #=> will return the next 20 users
  20. # Other parameters you can use include: sort_field, sort_order, search_operator, search_filter
  21. # The search_filter parameter is to be used exactly as in the dashboard, as in: "&search_filter="parameter"
  22. cc.update_conversation_metas website_id: website_id, session_id: session_id,
  23. meta: { nickname: "test nickname", email: "test@email.com", phone: "9999-9999",
  24. address: "rua teste 99t", segments: ["segmento 1", "segmento 2"],
  25. data: { teste_data: "data_teste_3", valorArbitrario: "teste arbitrário 3" } }
  26. # Updates the metadata from a specific conversation, given a session_id
  27. # Remember that conversation metadata is not equal to profile metadata. Each conversation has their own parameters.
  28. cc.update_people_profile website_id: website_id, people_id: people_id,
  29. profile_data: { person: { phone: "9999-9999", nickname: "test nickname 2",
  30. address: "rua teste 99t", website: "http://teste.com"},
  31. segments: ["segmento 4", "segmento 3"],
  32. company: { name: "Empresa teste" },
  33. geolocation: { city: "Cidade teste" } }
  34. # Updates a user's profile data. This is what you see when you click in a specific profile.

Installation

Add this line to your application’s Gemfile:

  1. gem 'crisp_client'

And then execute:

  1. $ bundle

Or install it yourself as:

  1. $ gem install crisp_client

Development

After checking out the repo, run bin/setup to install dependencies. 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. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/fwuensche/crisp_client

License

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