Class: Sentdm::Resources::Profiles
- Inherits:
-
Object
- Object
- Sentdm::Resources::Profiles
- Defined in:
- lib/sentdm/resources/profiles.rb
Overview
Manage organization profiles
Instance Method Summary collapse
-
#complete(profile_id, web_hook_url:, test_mode: nil, idempotency_key: nil, request_options: {}) ⇒ Object
Some parameter documentations has been truncated, see Models::ProfileCompleteParams for more details.
-
#create(allow_contact_sharing: nil, allow_template_sharing: nil, billing_model: nil, description: nil, icon: nil, inherit_contacts: nil, inherit_tcr_brand: nil, inherit_tcr_campaign: nil, inherit_templates: nil, name: nil, short_name: nil, test_mode: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfProfileDetail
Some parameter documentations has been truncated, see Models::ProfileCreateParams for more details.
-
#delete(path_profile_id, body_profile_id: nil, test_mode: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::ProfileDeleteParams for more details.
-
#initialize(client:) ⇒ Profiles
constructor
private
A new instance of Profiles.
-
#list(request_options: {}) ⇒ Sentdm::Models::ProfileListResponse
Retrieves all sender profiles within an organization.
-
#retrieve(profile_id, request_options: {}) ⇒ Sentdm::Models::APIResponseOfProfileDetail
Retrieves detailed information about a specific sender profile within an organization.
-
#update(path_profile_id, allow_contact_sharing: nil, allow_number_change_during_onboarding: nil, allow_template_sharing: nil, billing_model: nil, description: nil, icon: nil, inherit_contacts: nil, inherit_tcr_brand: nil, inherit_tcr_campaign: nil, inherit_templates: nil, name: nil, body_profile_id: nil, sending_phone_number: nil, sending_phone_number_profile_id: nil, sending_whatsapp_number_profile_id: nil, short_name: nil, test_mode: nil, whatsapp_phone_number: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfProfileDetail
Some parameter documentations has been truncated, see Models::ProfileUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Profiles
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 Profiles.
250 251 252 |
# File 'lib/sentdm/resources/profiles.rb', line 250 def initialize(client:) @client = client end |
Instance Method Details
#complete(profile_id, web_hook_url:, test_mode: nil, idempotency_key: nil, request_options: {}) ⇒ Object
Some parameter documentations has been truncated, see Models::ProfileCompleteParams for more details.
Final step in profile compliance workflow. Validates all prerequisites (general data, brand, campaigns), connects profile to Telnyx/WhatsApp, and sets status based on configuration. The process runs in the background and calls the provided webhook URL when finished.
Prerequisites:
- Profile must be completed
- If inheritTcrBrand=false: Profile must have existing brand
- If inheritTcrBrand=true: Parent must have existing brand
- If TCR application: Must have at least one campaign (own or inherited)
- If inheritTcrCampaign=false: Profile should have campaigns
- If inheritTcrCampaign=true: Parent must have campaigns
Status Logic:
- If both SMS and WhatsApp channels are missing → SUBMITTED
- If TCR application and not inheriting brand/campaigns → SUBMITTED
- If non-TCR with destination country (IsMain=true) → SUBMITTED
- Otherwise → COMPLETED
234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/sentdm/resources/profiles.rb', line 234 def complete(profile_id, params) parsed, = Sentdm::ProfileCompleteParams.dump_request(params) header_params = {idempotency_key: "idempotency-key"} @client.request( method: :post, path: ["v3/profiles/%1$s/complete", profile_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::Internal::Type::Unknown, options: ) end |
#create(allow_contact_sharing: nil, allow_template_sharing: nil, billing_model: nil, description: nil, icon: nil, inherit_contacts: nil, inherit_tcr_brand: nil, inherit_tcr_campaign: nil, inherit_templates: nil, name: nil, short_name: nil, test_mode: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfProfileDetail
Some parameter documentations has been truncated, see Models::ProfileCreateParams for more details.
Creates a new sender profile within an organization. Profiles represent different brands, departments, or use cases, each with their own messaging configuration and settings. Requires admin role in the organization.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/sentdm/resources/profiles.rb', line 47 def create(params = {}) parsed, = Sentdm::ProfileCreateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key"} @client.request( method: :post, path: "v3/profiles", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::APIResponseOfProfileDetail, options: ) end |
#delete(path_profile_id, body_profile_id: nil, test_mode: nil, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::ProfileDeleteParams for more details.
Soft deletes a sender profile. The profile will be marked as deleted but data is retained. Requires admin role in the organization.
185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/sentdm/resources/profiles.rb', line 185 def delete(path_profile_id, params = {}) parsed, = Sentdm::ProfileDeleteParams.dump_request(params) @client.request( method: :delete, path: ["v3/profiles/%1$s", path_profile_id], headers: {"content-type" => "*/*"}, body: parsed, model: NilClass, options: ) end |
#list(request_options: {}) ⇒ Sentdm::Models::ProfileListResponse
Retrieves all sender profiles within an organization. Profiles represent different brands, departments, or use cases within an organization, each with their own messaging configuration.
157 158 159 160 161 162 163 164 |
# File 'lib/sentdm/resources/profiles.rb', line 157 def list(params = {}) @client.request( method: :get, path: "v3/profiles", model: Sentdm::Models::ProfileListResponse, options: params[:request_options] ) end |
#retrieve(profile_id, request_options: {}) ⇒ Sentdm::Models::APIResponseOfProfileDetail
Retrieves detailed information about a specific sender profile within an organization.
71 72 73 74 75 76 77 78 |
# File 'lib/sentdm/resources/profiles.rb', line 71 def retrieve(profile_id, params = {}) @client.request( method: :get, path: ["v3/profiles/%1$s", profile_id], model: Sentdm::APIResponseOfProfileDetail, options: params[:request_options] ) end |
#update(path_profile_id, allow_contact_sharing: nil, allow_number_change_during_onboarding: nil, allow_template_sharing: nil, billing_model: nil, description: nil, icon: nil, inherit_contacts: nil, inherit_tcr_brand: nil, inherit_tcr_campaign: nil, inherit_templates: nil, name: nil, body_profile_id: nil, sending_phone_number: nil, sending_phone_number_profile_id: nil, sending_whatsapp_number_profile_id: nil, short_name: nil, test_mode: nil, whatsapp_phone_number: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfProfileDetail
Some parameter documentations has been truncated, see Models::ProfileUpdateParams for more details.
Updates a profile’s configuration and settings. Requires admin role in the organization. Only provided fields will be updated (partial update).
133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/sentdm/resources/profiles.rb', line 133 def update(path_profile_id, params = {}) parsed, = Sentdm::ProfileUpdateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key"} @client.request( method: :patch, path: ["v3/profiles/%1$s", path_profile_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::APIResponseOfProfileDetail, options: ) end |