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

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:



319
320
321
322
323
# File 'lib/telnyx/resources/messaging_profiles.rb', line 319

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.

Create a messaging profile

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:



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

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

Delete a messaging profile

Parameters:

  • messaging_profile_id (String)

    The id of the messaging profile to retrieve

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

Returns:

See Also:



197
198
199
200
201
202
203
204
# File 'lib/telnyx/resources/messaging_profiles.rb', line 197

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>

List messaging profiles

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:



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# File 'lib/telnyx/resources/messaging_profiles.rb', line 168

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_size (Integer)
  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/telnyx/resources/messaging_profiles.rb', line 221

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>

List phone numbers associated with a 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:



249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/telnyx/resources/messaging_profiles.rb', line 249

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>

List short codes associated with a 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:



277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/telnyx/resources/messaging_profiles.rb', line 277

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

Retrieve a messaging profile

Parameters:

  • messaging_profile_id (String)

    The id of the messaging profile to retrieve

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

Returns:

See Also:



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

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:



304
305
306
307
308
309
310
311
312
313
314
# File 'lib/telnyx/resources/messaging_profiles.rb', line 304

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

Update a messaging profile

Parameters:

  • messaging_profile_id (String)

    The id of the messaging profile to retrieve

  • 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:



138
139
140
141
142
143
144
145
146
147
# File 'lib/telnyx/resources/messaging_profiles.rb', line 138

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