Class: Telnyx::Resources::Messaging10dlc::PhoneNumberAssignmentByProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/messaging_10dlc/phone_number_assignment_by_profile.rb,
sig/telnyx/resources/messaging_10dlc/phone_number_assignment_by_profile.rbs

Overview

Phone number campaign bulk assignment

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ PhoneNumberAssignmentByProfile

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

Parameters:



126
127
128
# File 'lib/telnyx/resources/messaging_10dlc/phone_number_assignment_by_profile.rb', line 126

def initialize(client:)
  @client = client
end

Instance Method Details

#assign(messaging_profile_id:, campaign_id: nil, tcr_campaign_id: nil, request_options: {}) ⇒ Telnyx::Models::Messaging10dlc::PhoneNumberAssignmentByProfileAssignResponse

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

This endpoint allows you to link all phone numbers associated with a Messaging Profile to a campaign. Please note: if you want to assign phone numbers to a campaign that you did not create with Telnyx 10DLC services, this endpoint allows that provided that you've shared the campaign with Telnyx. In this case, only provide the parameter, tcrCampaignId, and not campaignId. In all other cases (where the campaign you're assigning was created with Telnyx 10DLC services), only provide campaignId, not tcrCampaignId.

Parameters:

  • messaging_profile_id (String)

    The ID of the messaging profile that you want to link to the specified campaign.

  • campaign_id (String)

    The ID of the campaign you want to link to the specified messaging profile. If y

  • tcr_campaign_id (String)

    The TCR ID of the shared campaign you want to link to the specified messaging pr

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

Returns:

See Also:



33
34
35
36
37
38
39
40
41
42
# File 'lib/telnyx/resources/messaging_10dlc/phone_number_assignment_by_profile.rb', line 33

def assign(params)
  parsed, options = Telnyx::Messaging10dlc::PhoneNumberAssignmentByProfileAssignParams.dump_request(params)
  @client.request(
    method: :post,
    path: "10dlc/phoneNumberAssignmentByProfile",
    body: parsed,
    model: Telnyx::Models::Messaging10dlc::PhoneNumberAssignmentByProfileAssignResponse,
    options: options
  )
end

#list_phone_number_status(task_id, page: nil, records_per_page: nil, request_options: {}) ⇒ Telnyx::Models::Messaging10dlc::PhoneNumberAssignmentByProfileListPhoneNumberStatusResponse

Check the status of the individual phone number/campaign assignments associated with the supplied taskId.

Parameters:

  • task_id (String)

    Unique identifier of the task.

  • page (Integer)

    Page number to retrieve (1-based).

  • records_per_page (Integer)

    Number of records to return per page.

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

Returns:

See Also:



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

def list_phone_number_status(task_id, params = {})
  parsed, options =
    Telnyx::Messaging10dlc::PhoneNumberAssignmentByProfileListPhoneNumberStatusParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["10dlc/phoneNumberAssignmentByProfile/%1$s/phoneNumbers", task_id],
    query: query.transform_keys(records_per_page: "recordsPerPage"),
    model: Telnyx::Models::Messaging10dlc::PhoneNumberAssignmentByProfileListPhoneNumberStatusResponse,
    options: options
  )
end

#retrieve_phone_number_status(task_id, page: nil, records_per_page: nil, request_options: {}) ⇒ Telnyx::Models::Messaging10dlc::PhoneNumberAssignmentByProfileRetrievePhoneNumberStatusResponse

Check the status of the individual phone number/campaign assignments associated with the supplied taskId.

Parameters:

  • task_id (String)

    Unique identifier of the task.

  • page (Integer)

    Page number to retrieve (1-based).

  • records_per_page (Integer)

    Number of records to return per page.

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

Returns:

See Also:



89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/telnyx/resources/messaging_10dlc/phone_number_assignment_by_profile.rb', line 89

def retrieve_phone_number_status(task_id, params = {})
  parsed, options =
    Telnyx::Messaging10dlc::PhoneNumberAssignmentByProfileRetrievePhoneNumberStatusParams.dump_request(params)
  query = Telnyx::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["10dlc/phoneNumberAssignmentByProfile/%1$s/phoneNumbers", task_id],
    query: query.transform_keys(records_per_page: "recordsPerPage"),
    model: Telnyx::Models::Messaging10dlc::PhoneNumberAssignmentByProfileRetrievePhoneNumberStatusResponse,
    options: options
  )
end

#retrieve_status(task_id, request_options: {}) ⇒ Telnyx::Models::Messaging10dlc::PhoneNumberAssignmentByProfileRetrieveStatusResponse

Check the status of the task associated with assigning all phone numbers on a messaging profile to a campaign by taskId.

Parameters:

  • task_id (String)

    Unique identifier of the task.

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

Returns:

See Also:



114
115
116
117
118
119
120
121
# File 'lib/telnyx/resources/messaging_10dlc/phone_number_assignment_by_profile.rb', line 114

def retrieve_status(task_id, params = {})
  @client.request(
    method: :get,
    path: ["10dlc/phoneNumberAssignmentByProfile/%1$s", task_id],
    model: Telnyx::Models::Messaging10dlc::PhoneNumberAssignmentByProfileRetrieveStatusResponse,
    options: params[:request_options]
  )
end