Class: PreludeSDK::Resources::Notify
- Inherits:
-
Object
- Object
- PreludeSDK::Resources::Notify
- Defined in:
- lib/prelude_sdk/resources/notify.rb
Overview
Send transactional and marketing messages with compliance enforcement.
Instance Method Summary collapse
-
#get_subscription_config(config_id, request_options: {}) ⇒ PreludeSDK::Models::NotifyGetSubscriptionConfigResponse
Retrieve a specific subscription management configuration by its ID.
-
#get_subscription_phone_number(phone_number, config_id:, request_options: {}) ⇒ PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse
Retrieve the current subscription status for a specific phone number within a subscription configuration.
-
#initialize(client:) ⇒ Notify
constructor
private
A new instance of Notify.
-
#list_subscription_configs(cursor: nil, limit: nil, request_options: {}) ⇒ PreludeSDK::Models::NotifyListSubscriptionConfigsResponse
Retrieve a paginated list of subscription management configurations for your account.
-
#list_subscription_phone_number_events(phone_number, config_id:, cursor: nil, limit: nil, request_options: {}) ⇒ PreludeSDK::Models::NotifyListSubscriptionPhoneNumberEventsResponse
Retrieve a paginated list of subscription events (status changes) for a specific phone number within a subscription configuration.
-
#list_subscription_phone_numbers(config_id, cursor: nil, limit: nil, state: nil, request_options: {}) ⇒ PreludeSDK::Models::NotifyListSubscriptionPhoneNumbersResponse
Retrieve a paginated list of phone numbers and their subscription statuses for a specific subscription configuration.
-
#send_(template_id:, to:, callback_url: nil, context: nil, correlation_id: nil, document: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, schedule_at: nil, text: nil, variables: nil, request_options: {}) ⇒ PreludeSDK::Models::NotifySendResponse
Some parameter documentations has been truncated, see Models::NotifySendParams for more details.
-
#send_batch(template_id:, to:, callback_url: nil, correlation_id: nil, document: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, schedule_at: nil, variables: nil, request_options: {}) ⇒ PreludeSDK::Models::NotifySendBatchResponse
Some parameter documentations has been truncated, see Models::NotifySendBatchParams for more details.
Constructor Details
#initialize(client:) ⇒ Notify
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 Notify.
254 255 256 |
# File 'lib/prelude_sdk/resources/notify.rb', line 254 def initialize(client:) @client = client end |
Instance Method Details
#get_subscription_config(config_id, request_options: {}) ⇒ PreludeSDK::Models::NotifyGetSubscriptionConfigResponse
Retrieve a specific subscription management configuration by its ID.
18 19 20 21 22 23 24 25 |
# File 'lib/prelude_sdk/resources/notify.rb', line 18 def get_subscription_config(config_id, params = {}) @client.request( method: :get, path: ["v2/notify/management/subscriptions/%1$s", config_id], model: PreludeSDK::Models::NotifyGetSubscriptionConfigResponse, options: params[:request_options] ) end |
#get_subscription_phone_number(phone_number, config_id:, request_options: {}) ⇒ PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse
Retrieve the current subscription status for a specific phone number within a subscription configuration.
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/prelude_sdk/resources/notify.rb', line 41 def get_subscription_phone_number(phone_number, params) parsed, = PreludeSDK::NotifyGetSubscriptionPhoneNumberParams.dump_request(params) config_id = parsed.delete(:config_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["v2/notify/management/subscriptions/%1$s/phone_numbers/%2$s", config_id, phone_number], model: PreludeSDK::Models::NotifyGetSubscriptionPhoneNumberResponse, options: ) end |
#list_subscription_configs(cursor: nil, limit: nil, request_options: {}) ⇒ PreludeSDK::Models::NotifyListSubscriptionConfigsResponse
Retrieve a paginated list of subscription management configurations for your account.
Each configuration represents a subscription management setup with phone numbers for receiving opt-out/opt-in requests and a callback URL for webhook events.
72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/prelude_sdk/resources/notify.rb', line 72 def list_subscription_configs(params = {}) parsed, = PreludeSDK::NotifyListSubscriptionConfigsParams.dump_request(params) query = PreludeSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v2/notify/management/subscriptions", query: query, model: PreludeSDK::Models::NotifyListSubscriptionConfigsResponse, options: ) end |
#list_subscription_phone_number_events(phone_number, config_id:, cursor: nil, limit: nil, request_options: {}) ⇒ PreludeSDK::Models::NotifyListSubscriptionPhoneNumberEventsResponse
Retrieve a paginated list of subscription events (status changes) for a specific phone number within a subscription configuration.
Events are ordered by timestamp in descending order (most recent first).
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/prelude_sdk/resources/notify.rb', line 104 def list_subscription_phone_number_events(phone_number, params) parsed, = PreludeSDK::NotifyListSubscriptionPhoneNumberEventsParams.dump_request(params) query = PreludeSDK::Internal::Util.encode_query_params(parsed) config_id = parsed.delete(:config_id) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: [ "v2/notify/management/subscriptions/%1$s/phone_numbers/%2$s/events", config_id, phone_number ], query: query, model: PreludeSDK::Models::NotifyListSubscriptionPhoneNumberEventsResponse, options: ) end |
#list_subscription_phone_numbers(config_id, cursor: nil, limit: nil, state: nil, request_options: {}) ⇒ PreludeSDK::Models::NotifyListSubscriptionPhoneNumbersResponse
Retrieve a paginated list of phone numbers and their subscription statuses for a specific subscription configuration.
You can optionally filter by subscription state (SUB or UNSUB).
144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/prelude_sdk/resources/notify.rb', line 144 def list_subscription_phone_numbers(config_id, params = {}) parsed, = PreludeSDK::NotifyListSubscriptionPhoneNumbersParams.dump_request(params) query = PreludeSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["v2/notify/management/subscriptions/%1$s/phone_numbers", config_id], query: query, model: PreludeSDK::Models::NotifyListSubscriptionPhoneNumbersResponse, options: ) end |
#send_(template_id:, to:, callback_url: nil, context: nil, correlation_id: nil, document: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, schedule_at: nil, text: nil, variables: nil, request_options: {}) ⇒ PreludeSDK::Models::NotifySendResponse
Some parameter documentations has been truncated, see Models::NotifySendParams for more details.
Send transactional and marketing messages to your users via SMS, RCS and WhatsApp with automatic compliance enforcement.
195 196 197 198 199 200 201 202 203 204 |
# File 'lib/prelude_sdk/resources/notify.rb', line 195 def send_(params) parsed, = PreludeSDK::NotifySendParams.dump_request(params) @client.request( method: :post, path: "v2/notify", body: parsed, model: PreludeSDK::Models::NotifySendResponse, options: ) end |
#send_batch(template_id:, to:, callback_url: nil, correlation_id: nil, document: nil, expires_at: nil, from: nil, locale: nil, preferred_channel: nil, schedule_at: nil, variables: nil, request_options: {}) ⇒ PreludeSDK::Models::NotifySendBatchResponse
Some parameter documentations has been truncated, see Models::NotifySendBatchParams for more details.
Send the same message to multiple recipients in a single request.
240 241 242 243 244 245 246 247 248 249 |
# File 'lib/prelude_sdk/resources/notify.rb', line 240 def send_batch(params) parsed, = PreludeSDK::NotifySendBatchParams.dump_request(params) @client.request( method: :post, path: "v2/notify/batch", body: parsed, model: PreludeSDK::Models::NotifySendBatchResponse, options: ) end |