README.md in qismo-0.17.4 vs README.md in qismo-0.17.5

- old
+ new

@@ -11,73 +11,46 @@ ``` ## Usage ```ruby -# config/initializers/qismo.rb +client = Qismo::Client.new(app_id: "QISCUS_APP_ID", secret_key: "QISCUS_SECRET_KEY") -Qismo.configure do |client| - client.app_id = ENV["QISCUS_APP_ID"] - client.secret_key = ENV["QISCUS_SECRET_KEY"] -end -``` - -Then, start requesting to available endpoint - -```ruby params = { channel: { channel_id: 12345, source: "wa" }, status: "unresolved", serve_status: "served", is_handled_by_bot: true, } -# List rooms -rooms = Qismo.rooms(params) +rooms = client.rooms(params) puts rooms # [ -# #<Qismo::SingleObject -# channel_id=6171, -# contact_id=71716, -# id=181917, -# is_handled_by_bot=true, -# is_resolved=false, -# is_waiting=false, -# last_comment_sender="admin@qismo.com", -# last_comment_sender_type="system", -# last_comment_text="Agent joined this conversation", -# last_comment_timestamp="2022-12-09T04:25:55Z", -# last_customer_comment_text=nil, -# last_customer_timestamp="2022-11-28T09:03:08Z", -# name="Customer - Yogyakarta", -# room_badge="https://multichannel.qiscus.com/img/whatsapp_badge.svg", -# room_id="8191816171", -# room_type="individual", -# source="wa", -# user_avatar_url="https://multichannel.qiscus.com/img/default_avatar.svg", -# user_id="628155555711" -# > +# #<Qismo::Objects::CustomerRoom +# channel_id=126392 +# contact_id=21608346 +# id=68303333 +# is_handled_by_bot=true +# is_resolved=false +# is_waiting=false +# last_comment_sender="karm-gzu41e4e4dv9fu3f_admin@qismo.com" +# last_comment_sender_type="system" +# last_comment_text="bayu joined this conversation" +# last_comment_timestamp="2022-12-22T06:37:58Z" +# last_customer_comment_text=nil +# last_customer_timestamp="2022-12-19T13:32:51Z" +# name="Oyis" +# room_badge="https://d1edrlpyc25xu0.cloudfront.net/ods-cc6rmwouax2thbow3/image/upload/5sYxRCGJl_/qiscus_badge.svg" +# room_id=103513607 +# room_type="individual" +# source="qiscus" +# user_avatar_url="https://d1edrlpyc25xu0.cloudfront.net/kiwari-prod/image/upload/wMWsDZP6ta/1516689726-ic_qiscus_client.png" +# user_id="nurcholisart@gmail.com"> # ] ``` -## Multiple app id client initialization - -```ruby -client = Qismo::Client.new(app_id: "QISCUS_APP_ID", secret_key: "QISCUS_SECRET_KEY") - -params = { - channel: { channel_id: 12345, source: "wa" }, - status: "unresolved", - serve_status: "served", - is_handled_by_bot: true, -} - -# This will produce same result as explained before -client.rooms(params) -``` - ## Client optional configuration Qismo ruby also provide some optional configuration that you can pass, they are: **url** @@ -180,13 +153,13 @@ Qiscus Omnichannel provide webhooks that triggered from various action on your account. Qismo ruby gem provide convenient way to handle the request. ```ruby class QiscusWebhooksController < ApplicationController skip_before_action :verify_authenticity_token - + def handle_agent_allocation_webhook webhook = Qismo::WebhookRequests::OnAgentAllocationNeeded.new(JSON.parse(request.raw_body)) - + # Do any action you want using payload that has been objectified if webhook.candidate_agent.present? Qismo.assign_agent( webhook.room_id, webhook.candidate_agent.id