Class: WhopSDK::Resources::SupportChannels

Inherits:
Object
  • Object
show all
Defined in:
lib/whop_sdk/resources/support_channels.rb

Overview

Support channels

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ SupportChannels

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of SupportChannels.

Parameters:



114
115
116
# File 'lib/whop_sdk/resources/support_channels.rb', line 114

def initialize(client:)
  @client = client
end

Instance Method Details

#create(company_id:, user_id:, custom_name: nil, request_options: {}) ⇒ WhopSDK::Models::SupportChannel

Some parameter documentations has been truncated, see Models::SupportChannelCreateParams for more details.

Open a new support channel between a company team member and a customer. Returns the existing channel if one already exists for that user.

Required permissions:

  • ‘support_chat:create`

Parameters:

  • company_id (String)

    The unique identifier of the company to create the support channel in.

  • user_id (String)

    The user ID (e.g. ‘user_xxxxx’) or username of the customer to open a support ch

  • custom_name (String, nil)

    Optional custom display name for the support channel.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
# File 'lib/whop_sdk/resources/support_channels.rb', line 30

def create(params)
  parsed, options = WhopSDK::SupportChannelCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "support_channels",
    body: parsed,
    model: WhopSDK::SupportChannel,
    options: options
  )
end

#list(company_id:, after: nil, before: nil, direction: nil, first: nil, last: nil, open_: nil, order: nil, request_options: {}) ⇒ WhopSDK::Internal::CursorPage<WhopSDK::Models::SupportChannelListResponse>

Some parameter documentations has been truncated, see Models::SupportChannelListParams for more details.

Returns a paginated list of support channels for a specific company, with optional filtering by resolution status and custom sorting.

Required permissions:

  • ‘support_chat:read`

Parameters:

  • company_id (String)

    The unique identifier of the company to list support channels for.

  • after (String, nil)

    Returns the elements in the list that come after the specified cursor.

  • before (String, nil)

    Returns the elements in the list that come before the specified cursor.

  • direction (Symbol, WhopSDK::Models::Direction, nil)

    The direction of the sort.

  • first (Integer, nil)

    Returns the first n elements from the list.

  • last (Integer, nil)

    Returns the last n elements from the list.

  • open_ (Boolean, nil)

    Whether to filter by open or resolved support channels. Set to true to only retu

  • order (Symbol, WhopSDK::Models::SupportChannelListParams::Order, nil)

    Sort options for message channels

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/whop_sdk/resources/support_channels.rb', line 98

def list(params)
  parsed, options = WhopSDK::SupportChannelListParams.dump_request(params)
  query = WhopSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "support_channels",
    query: query.transform_keys(open_: "open"),
    page: WhopSDK::Internal::CursorPage,
    model: WhopSDK::Models::SupportChannelListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ WhopSDK::Models::SupportChannel

Retrieves the details of an existing support channel.

Required permissions:

  • ‘support_chat:read`

Parameters:

  • id (String)

    The unique identifier of the support channel to retrieve.

  • request_options (WhopSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



56
57
58
59
60
61
62
63
# File 'lib/whop_sdk/resources/support_channels.rb', line 56

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["support_channels/%1$s", id],
    model: WhopSDK::SupportChannel,
    options: params[:request_options]
  )
end