Class: Knockapi::Resources::Users::Guides

Inherits:
Object
  • Object
show all
Defined in:
lib/knockapi/resources/users/guides.rb,
sig/knockapi/resources/users/guides.rbs

Overview

A user is an individual from your system, represented in Knock. They are most commonly a recipient of a notification.

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Guides

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 Guides.

Parameters:



209
210
211
# File 'lib/knockapi/resources/users/guides.rb', line 209

def initialize(client:)
  @client = client
end

Instance Method Details

#get_channel(user_id, channel_id, data: nil, tenant: nil, type: nil, request_options: {}) ⇒ Knockapi::Models::Users::GuideGetChannelResponse

Returns a list of eligible in-app guides for a specific user and channel.

Parameters:

  • user_id (String) —

    The unique identifier of the user.

  • channel_id (String) —

    The unique identifier for the channel.

  • data (String) —

    The data (JSON encoded object) to use for targeting and rendering guides.

  • tenant (String) —

    The tenant ID to use for targeting and rendering guides.

  • type (String) —

    The type of guides to filter by.

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

Returns:

See Also:



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/knockapi/resources/users/guides.rb', line 28

def get_channel(user_id, channel_id, params = {})
  parsed, options = Knockapi::Users::GuideGetChannelParams.dump_request(params)
  query = Knockapi::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["v1/users/%1$s/guides/%2$s", user_id, channel_id],
    query: query,
    model: Knockapi::Models::Users::GuideGetChannelResponse,
    options: options
  )
end

#mark_message_as_archived(user_id, channel_id:, guide_id:, guide_key:, guide_step_ref:, is_final: nil, tenant: nil, unthrottled: nil, request_options: {}) ⇒ Knockapi::Models::Users::GuideActionResponse

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

Records that a guide has been archived by a user, triggering any associated archived events.

Parameters:

  • user_id (String) —

    The unique identifier of the user.

  • channel_id (String) —

    The unique identifier for the channel.

  • guide_id (String) —

    The unique identifier for the guide.

  • guide_key (String) —

    The key of the guide.

  • guide_step_ref (String) —

    The step reference of the guide.

  • is_final (Boolean) —

    Whether the guide is final.

  • tenant (String) —

    The tenant ID of the guide.

  • unthrottled (Boolean) —

    Whether the guide bypasses its guide group's throttle settings. When true, archi

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

Returns:

See Also:



69
70
71
72
73
74
75
76
77
78
# File 'lib/knockapi/resources/users/guides.rb', line 69

def mark_message_as_archived(user_id, params)
  parsed, options = Knockapi::Users::GuideMarkMessageAsArchivedParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["v1/users/%1$s/guides/messages/archived", user_id],
    body: parsed,
    model: Knockapi::Users::GuideActionResponse,
    options: options
  )
end

#mark_message_as_interacted(user_id, channel_id:, guide_id:, guide_key:, guide_step_ref:, metadata: nil, tenant: nil, request_options: {}) ⇒ Knockapi::Models::Users::GuideActionResponse

Records that a user has interacted with a guide, triggering any associated interacted events.

Parameters:

  • user_id (String) —

    The unique identifier of the user.

  • channel_id (String) —

    The unique identifier for the channel.

  • guide_id (String) —

    The unique identifier for the guide.

  • guide_key (String) —

    The key of the guide.

  • guide_step_ref (String) —

    The step reference of the guide.

  • metadata (Hash{Symbol=>Object}) —

    Metadata about the interaction.

  • tenant (String) —

    The tenant ID of the guide.

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

Returns:

See Also:



104
105
106
107
108
109
110
111
112
113
# File 'lib/knockapi/resources/users/guides.rb', line 104

def mark_message_as_interacted(user_id, params)
  parsed, options = Knockapi::Users::GuideMarkMessageAsInteractedParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["v1/users/%1$s/guides/messages/interacted", user_id],
    body: parsed,
    model: Knockapi::Users::GuideActionResponse,
    options: options
  )
end

#mark_message_as_seen(user_id, channel_id:, content:, guide_id:, guide_key:, guide_step_ref:, data: nil, tenant: nil, request_options: {}) ⇒ Knockapi::Models::Users::GuideActionResponse

Records that a guide has been seen by a user, triggering any associated seen events.

Parameters:

  • user_id (String) —

    The unique identifier of the user.

  • channel_id (String) —

    The unique identifier for the channel.

  • content (Hash{Symbol=>Object}) —

    The content of the guide.

  • guide_id (String) —

    The unique identifier for the guide.

  • guide_key (String) —

    The key of the guide.

  • guide_step_ref (String) —

    The step reference of the guide.

  • data (Hash{Symbol=>Object}) —

    The data of the guide.

  • tenant (String) —

    The tenant ID of the guide.

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

Returns:

See Also:



141
142
143
144
145
146
147
148
149
150
# File 'lib/knockapi/resources/users/guides.rb', line 141

def mark_message_as_seen(user_id, params)
  parsed, options = Knockapi::Users::GuideMarkMessageAsSeenParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["v1/users/%1$s/guides/messages/seen", user_id],
    body: parsed,
    model: Knockapi::Users::GuideActionResponse,
    options: options
  )
end

#reset_guide_engagements(user_id, guide_key:, tenant: nil, request_options: {}) ⇒ Knockapi::Models::Users::GuideActionResponse

Resets the engagement state of a guide for a user, removing the guide's engagement log entry so the next interaction creates a fresh engagement.

Parameters:

  • user_id (String) —

    The unique identifier of the user.

  • guide_key (String) —

    The key of the guide.

  • tenant (String) —

    The tenant ID of the guide.

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

Returns:

See Also:



168
169
170
171
172
173
174
175
176
177
# File 'lib/knockapi/resources/users/guides.rb', line 168

def reset_guide_engagements(user_id, params)
  parsed, options = Knockapi::Users::GuideResetGuideEngagementsParams.dump_request(params)
  @client.request(
    method: :put,
    path: ["v1/users/%1$s/guides/engagements/reset", user_id],
    body: parsed,
    model: Knockapi::Users::GuideActionResponse,
    options: options
  )
end

#unarchive_guide_message(user_id, guide_key:, tenant: nil, request_options: {}) ⇒ Knockapi::Models::Users::GuideActionResponse

Records that a guide has been unarchived, triggering any associated unarchived events.

Parameters:

  • user_id (String) —

    The unique identifier of the user.

  • guide_key (String) —

    The key of the guide.

  • tenant (String) —

    The tenant ID of the guide.

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

Returns:

See Also:



195
196
197
198
199
200
201
202
203
204
# File 'lib/knockapi/resources/users/guides.rb', line 195

def unarchive_guide_message(user_id, params)
  parsed, options = Knockapi::Users::GuideUnarchiveGuideMessageParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["v1/users/%1$s/guides/messages/archived", user_id],
    body: parsed,
    model: Knockapi::Users::GuideActionResponse,
    options: options
  )
end