Class: Telnyx::Resources::MessagingProfiles

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/messaging_profiles.rb,
lib/telnyx/resources/messaging_profiles/actions.rb,
lib/telnyx/resources/messaging_profiles/autoresp_configs.rb,
sig/telnyx/resources/messaging_profiles.rbs,
sig/telnyx/resources/messaging_profiles/actions.rbs,
sig/telnyx/resources/messaging_profiles/autoresp_configs.rbs

Defined Under Namespace

Classes: Actions, AutorespConfigs

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ MessagingProfiles

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

Parameters:



328
329
330
331
332
# File 'lib/telnyx/resources/messaging_profiles.rb', line 328

def initialize(client:)
  @client = client
  @autoresp_configs = Telnyx::Resources::MessagingProfiles::AutorespConfigs.new(client: client)
  @actions = Telnyx::Resources::MessagingProfiles::Actions.new(client: client)
end

Instance Attribute Details

#actionsTelnyx::Resources::MessagingProfiles::Actions (readonly)



11
12
13
# File 'lib/telnyx/resources/messaging_profiles.rb', line 11

def actions
  @actions
end

#autoresp_configsTelnyx::Resources::MessagingProfiles::AutorespConfigs (readonly)

Opt-Out Management



8
9
10
# File 'lib/telnyx/resources/messaging_profiles.rb', line 8

def autoresp_configs
  @autoresp_configs
end

Instance Method Details

#create(name:, whitelisted_destinations:, ai_assistant_id: nil, alpha_sender: nil, daily_spend_limit: nil, daily_spend_limit_enabled: nil, enabled: nil, health_webhook_url: nil, mms_fall_back_to_sms: nil, mms_transcoding: nil, mobile_only: nil, number_pool_settings: nil, resource_group_id: nil, smart_encoding: nil, url_shortener_settings: nil, webhook_api_version: nil, webhook_failover_url: nil, webhook_url: nil, request_options: {}) ⇒ Telnyx::Models::MessagingProfileCreateResponse

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

Creates a messaging profile that controls outbound sender selection, webhook delivery, and inbound message handling for associated numbers and short codes.

Parameters:

  • name (String)

    A user friendly name for the messaging profile.

  • whitelisted_destinations (Array<String>)

    Destinations to which the messaging profile is allowed to send. The elements in

  • ai_assistant_id (String, nil)

    The AI assistant ID to associate with this messaging profile.

  • alpha_sender (String, nil)

    The alphanumeric sender ID to use when sending to destinations that require an a

  • daily_spend_limit (String)

    The maximum amount of money (in USD) that can be spent by this profile before mi

  • daily_spend_limit_enabled (Boolean)

    Whether to enforce the value configured by daily_spend_limit.

  • enabled (Boolean)

    Specifies whether the messaging profile is enabled or not.

  • health_webhook_url (String, nil)

    A URL to receive health check webhooks for numbers in this profile.

  • mms_fall_back_to_sms (Boolean)

    enables SMS fallback for MMS messages.

  • mms_transcoding (Boolean)

    enables automated resizing of MMS media.

  • mobile_only (Boolean)

    Send messages only to mobile phone numbers.

  • number_pool_settings (Telnyx::Models::NumberPoolSettings, nil)

    Number Pool allows you to send messages from a pool of numbers of different type

  • resource_group_id (String, nil)

    The resource group ID to associate with this messaging profile.

  • smart_encoding (Boolean)

    Enables automatic character encoding optimization for SMS messages. When enabled

  • url_shortener_settings (Telnyx::Models::URLShortenerSettings, nil)

    The URL shortener feature allows automatic replacement of URLs that were generat

  • webhook_api_version (Symbol, Telnyx::Models::MessagingProfileCreateParams::WebhookAPIVersion)

    Determines which webhook format will be used, Telnyx API v1, v2, or a legacy 201

  • webhook_failover_url (String, nil)

    The failover URL where webhooks related to this messaging profile will be sent i

  • webhook_url (String, nil)

    The URL where webhooks related to this messaging profile will be sent.

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

Returns:

See Also:



62
63
64
65
66
67
68
69
70
71
# File 'lib/telnyx/resources/messaging_profiles.rb', line 62

def create(params)
  parsed, options = Telnyx::MessagingProfileCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "messaging_profiles",
    body: parsed,
    model: Telnyx::Models::MessagingProfileCreateResponse,
    options: options
  )
end

#delete(messaging_profile_id, request_options: {}) ⇒ Telnyx::Models::MessagingProfileDeleteResponse

Deletes the specified messaging profile and returns the profile's final configuration.

Parameters:

  • messaging_profile_id (String)

    The id of the messaging profile to retrieve

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

Returns:

See Also:



204
205
206
207
208
209
210
211
# File 'lib/telnyx/resources/messaging_profiles.rb', line 204

def delete(messaging_profile_id, params = {})
  @client.request(
    method: :delete,
    path: ["messaging_profiles/%1$s", messaging_profile_id],
    model: Telnyx::Models::MessagingProfileDeleteResponse,
    options: params[:request_options]
  )
end

#list(filter: nil, filter_name_contains: nil, filter_name_eq: nil, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::MessagingProfile>

Returns messaging profiles owned by the authenticated account. Apply the documented filters and pagination parameters to narrow the result set.

Parameters:

  • filter (Telnyx::Models::MessagingProfileListParams::Filter)

    Consolidated filter parameter (deepObject style). Originally: filter

  • filter_name_contains (String)

    Filter profiles by name containing the given string.

  • filter_name_eq (String)

    Filter profiles by exact name match.

  • page_number (Integer)
  • page_size (Integer)
  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/telnyx/resources/messaging_profiles.rb', line 174

def list(params = {})
  parsed, options = Telnyx::MessagingProfileListParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "messaging_profiles",
    query: query.transform_keys(
      filter_name_contains: "filter[name][contains]",
      filter_name_eq: "filter[name][eq]",
      page_number: "page[number]",
      page_size: "page[size]"
    ),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::MessagingProfile,
    options: options
  )
end

#list_alphanumeric_sender_ids(id, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::AlphanumericSenderID>

List all alphanumeric sender IDs associated with a specific messaging profile.

Parameters:

  • id (String)

    The identifier of the messaging profile.

  • page_number (Integer)

    Page number to retrieve (1-based).

  • page_size (Integer)

    Number of items to return per page.

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

Returns:

See Also:



228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/telnyx/resources/messaging_profiles.rb', line 228

def list_alphanumeric_sender_ids(id, params = {})
  parsed, options = Telnyx::MessagingProfileListAlphanumericSenderIDsParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["messaging_profiles/%1$s/alphanumeric_sender_ids", id],
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::AlphanumericSenderID,
    options: options
  )
end

#list_phone_numbers(messaging_profile_id, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::PhoneNumberWithMessagingSettings>

Returns the phone numbers currently associated with the specified messaging profile.

Parameters:

  • messaging_profile_id (String)

    The id of the messaging profile to retrieve

  • page_number (Integer)
  • page_size (Integer)
  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



257
258
259
260
261
262
263
264
265
266
267
268
# File 'lib/telnyx/resources/messaging_profiles.rb', line 257

def list_phone_numbers(messaging_profile_id, params = {})
  parsed, options = Telnyx::MessagingProfileListPhoneNumbersParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["messaging_profiles/%1$s/phone_numbers", messaging_profile_id],
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::PhoneNumberWithMessagingSettings,
    options: options
  )
end

#list_short_codes(messaging_profile_id, page_number: nil, page_size: nil, request_options: {}) ⇒ Telnyx::Internal::DefaultFlatPagination<Telnyx::Models::ShortCode>

Returns the short codes currently associated with the specified messaging profile.

Parameters:

  • messaging_profile_id (String)

    The id of the messaging profile to retrieve

  • page_number (Integer)
  • page_size (Integer)
  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/telnyx/resources/messaging_profiles.rb', line 286

def list_short_codes(messaging_profile_id, params = {})
  parsed, options = Telnyx::MessagingProfileListShortCodesParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["messaging_profiles/%1$s/short_codes", messaging_profile_id],
    query: query.transform_keys(page_number: "page[number]", page_size: "page[size]"),
    page: Telnyx::Internal::DefaultFlatPagination,
    model: Telnyx::ShortCode,
    options: options
  )
end

#retrieve(messaging_profile_id, request_options: {}) ⇒ Telnyx::Models::MessagingProfileRetrieveResponse

Returns the complete configuration of the specified messaging profile, including webhook and sender-selection settings.

Parameters:

  • messaging_profile_id (String)

    The id of the messaging profile to retrieve

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

Returns:

See Also:



85
86
87
88
89
90
91
92
# File 'lib/telnyx/resources/messaging_profiles.rb', line 85

def retrieve(messaging_profile_id, params = {})
  @client.request(
    method: :get,
    path: ["messaging_profiles/%1$s", messaging_profile_id],
    model: Telnyx::Models::MessagingProfileRetrieveResponse,
    options: params[:request_options]
  )
end

#retrieve_metrics(id, time_frame: nil, request_options: {}) ⇒ Telnyx::Models::MessagingProfileRetrieveMetricsResponse

Get detailed metrics for a specific messaging profile, broken down by time interval.

Parameters:

Returns:

See Also:



313
314
315
316
317
318
319
320
321
322
323
# File 'lib/telnyx/resources/messaging_profiles.rb', line 313

def retrieve_metrics(id, params = {})
  parsed, options = Telnyx::MessagingProfileRetrieveMetricsParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["messaging_profiles/%1$s/metrics", id],
    query: query,
    model: Telnyx::Models::MessagingProfileRetrieveMetricsResponse,
    options: options
  )
end

#update(messaging_profile_id, ai_assistant_id: nil, alpha_sender: nil, daily_spend_limit: nil, daily_spend_limit_enabled: nil, enabled: nil, mms_fall_back_to_sms: nil, mms_transcoding: nil, mobile_only: nil, name: nil, number_pool_settings: nil, smart_encoding: nil, url_shortener_settings: nil, v1_secret: nil, webhook_api_version: nil, webhook_failover_url: nil, webhook_url: nil, whitelisted_destinations: nil, request_options: {}) ⇒ Telnyx::Models::MessagingProfileUpdateResponse

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

Updates the supplied settings on the specified messaging profile. Settings omitted from the request remain unchanged.

Parameters:

  • messaging_profile_id (String)

    The id of the messaging profile to retrieve

  • ai_assistant_id (String, nil)

    The ID of the AI assistant associated with this messaging profile.

  • alpha_sender (String, nil)

    The alphanumeric sender ID to use when sending to destinations that require an a

  • daily_spend_limit (String)

    The maximum amount of money (in USD) that can be spent by this profile before mi

  • daily_spend_limit_enabled (Boolean)

    Whether to enforce the value configured by daily_spend_limit.

  • enabled (Boolean)

    Specifies whether the messaging profile is enabled or not.

  • mms_fall_back_to_sms (Boolean)

    enables SMS fallback for MMS messages.

  • mms_transcoding (Boolean)

    enables automated resizing of MMS media.

  • mobile_only (Boolean)

    Send messages only to mobile phone numbers.

  • name (String)

    A user friendly name for the messaging profile.

  • number_pool_settings (Telnyx::Models::NumberPoolSettings, nil)

    Number Pool allows you to send messages from a pool of numbers of different type

  • smart_encoding (Boolean)

    Enables automatic character encoding optimization for SMS messages. When enabled

  • url_shortener_settings (Telnyx::Models::URLShortenerSettings, nil)

    The URL shortener feature allows automatic replacement of URLs that were generat

  • v1_secret (String)

    Secret used to authenticate with v1 endpoints.

  • webhook_api_version (Symbol, Telnyx::Models::MessagingProfileUpdateParams::WebhookAPIVersion)

    Determines which webhook format will be used, Telnyx API v1, v2, or a legacy 201

  • webhook_failover_url (String, nil)

    The failover URL where webhooks related to this messaging profile will be sent i

  • webhook_url (String, nil)

    The URL where webhooks related to this messaging profile will be sent.

  • whitelisted_destinations (Array<String>)

    Destinations to which the messaging profile is allowed to send. The elements in

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

Returns:

See Also:



143
144
145
146
147
148
149
150
151
152
# File 'lib/telnyx/resources/messaging_profiles.rb', line 143

def update(messaging_profile_id, params = {})
  parsed, options = Telnyx::MessagingProfileUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["messaging_profiles/%1$s", messaging_profile_id],
    body: parsed,
    model: Telnyx::Models::MessagingProfileUpdateResponse,
    options: options
  )
end