Class: Sentdm::Resources::Profiles
- Inherits:
-
Object
- Object
- Sentdm::Resources::Profiles
- Defined in:
- lib/sentdm/resources/profiles.rb,
lib/sentdm/resources/profiles/campaigns.rb,
sig/sentdm/resources/profiles.rbs,
sig/sentdm/resources/profiles/campaigns.rbs
Overview
Manage organization profiles
Defined Under Namespace
Classes: Campaigns
Instance Attribute Summary collapse
-
#campaigns ⇒ Sentdm::Resources::Profiles::Campaigns
readonly
Manage organization profiles.
Instance Method Summary collapse
-
#complete(profile_id, web_hook_url:, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::ProfileCompleteResponse
Some parameter documentations has been truncated, see Models::ProfileCompleteParams for more details.
-
#create(allow_contact_sharing: nil, allow_template_sharing: nil, billing_contact: nil, billing_model: nil, brand: nil, description: nil, icon: nil, inherit_contacts: nil, inherit_tcr_brand: nil, inherit_tcr_campaign: nil, inherit_templates: nil, name: nil, payment_details: nil, sandbox: nil, short_name: nil, whatsapp_business_account: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfProfileDetail
Some parameter documentations has been truncated, see Models::ProfileCreateParams for more details.
-
#delete(profile_id, sandbox: nil, x_profile_id: 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(x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::ProfileListResponse
Some parameter documentations has been truncated, see Models::ProfileListParams for more details.
-
#retrieve(profile_id, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfProfileDetail
Some parameter documentations has been truncated, see Models::ProfileRetrieveParams for more details.
-
#update(profile_id, allow_contact_sharing: nil, allow_number_change_during_onboarding: nil, allow_template_sharing: nil, billing_contact: nil, billing_model: nil, brand: nil, description: nil, icon: nil, inherit_contacts: nil, inherit_tcr_brand: nil, inherit_tcr_campaign: nil, inherit_templates: nil, name: nil, payment_details: nil, sandbox: nil, sending_phone_number: nil, sending_phone_number_profile_id: nil, sending_whatsapp_number_profile_id: nil, short_name: nil, whatsapp_phone_number: nil, idempotency_key: nil, x_profile_id: 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.
351 352 353 354 |
# File 'lib/sentdm/resources/profiles.rb', line 351 def initialize(client:) @client = client @campaigns = Sentdm::Resources::Profiles::Campaigns.new(client: client) end |
Instance Attribute Details
#campaigns ⇒ Sentdm::Resources::Profiles::Campaigns (readonly)
Manage organization profiles
9 10 11 |
# File 'lib/sentdm/resources/profiles.rb', line 9 def campaigns @campaigns end |
Instance Method Details
#complete(profile_id, web_hook_url:, sandbox: nil, idempotency_key: nil, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::ProfileCompleteResponse
Some parameter documentations has been truncated, see Models::ProfileCompleteParams for more details.
Final step in the profile compliance workflow. Validates all prerequisites (KYC, brand, campaigns, required documents), connects the profile to the SMS and WhatsApp channels, and sets its status based on configuration. Prerequisites are always validated first: if any fail the call returns 400. If they pass and the profile is already completed, the call returns 200 and does nothing. Otherwise it returns 202 and calls the provided webhook URL when background processing finishes.
Prerequisites:
- Profile must have a name, short name, and description (short name max 50 characters, description max 5000)
- webHookUrl must be supplied on the request
- A KYC form submission is required
- A brand is required, either on the profile or inherited from the parent organization
- TCR applications must have at least one campaign, own or inherited
- Destination countries marked as main must have their required compliance documents uploaded
Resulting status:
- If either the SMS or WhatsApp channel is unconfigured, the profile is SUBMITTED
- For a TCR application that inherits both its brand and its campaigns, the profile is COMPLETED
- For a TCR application that owns either its brand or its campaigns, the profile is COMPLETED once both have been submitted to TCR, and SUBMITTED until then
- For a non-TCR application, the profile is SUBMITTED when a main destination country is set, and COMPLETED otherwise
335 336 337 338 339 340 341 342 343 344 345 346 |
# File 'lib/sentdm/resources/profiles.rb', line 335 def complete(profile_id, params) parsed, = Sentdm::ProfileCompleteParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"} @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::Models::ProfileCompleteResponse, options: ) end |
#create(allow_contact_sharing: nil, allow_template_sharing: nil, billing_contact: nil, billing_model: nil, brand: nil, description: nil, icon: nil, inherit_contacts: nil, inherit_tcr_brand: nil, inherit_tcr_campaign: nil, inherit_templates: nil, name: nil, payment_details: nil, sandbox: nil, short_name: nil, whatsapp_business_account: nil, idempotency_key: nil, x_profile_id: 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.
WhatsApp Business Account
Every profile must be linked to a WhatsApp Business Account. There are two ways to do this:
1. Inherit from organization (default) — Omit the
whatsapp_business_account field. The profile will share the organization's
WhatsApp Business Account, which must have been set up via WhatsApp Embedded
Signup. This is the recommended path for most use cases.
2. Direct credentials — Provide a whatsapp_business_account object with
waba_id, phone_number_id, and access_token. Use this when the profile
needs its own independent WhatsApp Business Account. Obtain these from Meta
Business Manager by creating a System User with whatsapp_business_messaging
and whatsapp_business_management permissions.
If the whatsapp_business_account field is omitted and the organization has no
WhatsApp Business Account configured, the request will be rejected with
HTTP 422.
Brand
Include the optional brand field to create the brand for this profile at the
same time. Cannot be used when inherit_tcr_brand is true.
Payment Details
When billing_model is "profile" or "profile_and_organization" you may
include a payment_details object containing the card number, expiry (MM/YY),
CVC, and billing ZIP code. Payment details are never stored on our servers
and are forwarded directly to the payment processor. Providing payment_details
when billing_model is "organization" is not allowed.
94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/sentdm/resources/profiles.rb', line 94 def create(params = {}) parsed, = Sentdm::ProfileCreateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"} @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(profile_id, sandbox: nil, x_profile_id: 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.
271 272 273 274 275 276 277 278 279 280 281 282 |
# File 'lib/sentdm/resources/profiles.rb', line 271 def delete(profile_id, params = {}) parsed, = Sentdm::ProfileDeleteParams.dump_request(params) header_params = {x_profile_id: "x-profile-id"} @client.request( method: :delete, path: ["v3/profiles/%1$s", profile_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: NilClass, options: ) end |
#list(x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::ProfileListResponse
Some parameter documentations has been truncated, see Models::ProfileListParams for more details.
Retrieves all sender profiles within an organization, including brand information for each profile. Profiles represent different brands, departments, or use cases within an organization, each with their own messaging configuration.
241 242 243 244 245 246 247 248 249 250 |
# File 'lib/sentdm/resources/profiles.rb', line 241 def list(params = {}) parsed, = Sentdm::ProfileListParams.dump_request(params) @client.request( method: :get, path: "v3/profiles", headers: parsed.transform_keys(x_profile_id: "x-profile-id"), model: Sentdm::Models::ProfileListResponse, options: ) end |
#retrieve(profile_id, x_profile_id: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseOfProfileDetail
Some parameter documentations has been truncated, see Models::ProfileRetrieveParams for more details.
Retrieves detailed information about a specific sender profile within an organization, including brand and KYC information if a brand has been configured.
125 126 127 128 129 130 131 132 133 134 |
# File 'lib/sentdm/resources/profiles.rb', line 125 def retrieve(profile_id, params = {}) parsed, = Sentdm::ProfileRetrieveParams.dump_request(params) @client.request( method: :get, path: ["v3/profiles/%1$s", profile_id], headers: parsed.transform_keys(x_profile_id: "x-profile-id"), model: Sentdm::APIResponseOfProfileDetail, options: ) end |
#update(profile_id, allow_contact_sharing: nil, allow_number_change_during_onboarding: nil, allow_template_sharing: nil, billing_contact: nil, billing_model: nil, brand: nil, description: nil, icon: nil, inherit_contacts: nil, inherit_tcr_brand: nil, inherit_tcr_campaign: nil, inherit_templates: nil, name: nil, payment_details: nil, sandbox: nil, sending_phone_number: nil, sending_phone_number_profile_id: nil, sending_whatsapp_number_profile_id: nil, short_name: nil, whatsapp_phone_number: nil, idempotency_key: nil, x_profile_id: 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).
Brand Management
Include the optional brand field to create or update the brand associated with
this profile. The brand holds KYC and TCR compliance data (legal business info,
contact details, messaging vertical). Once a brand has been submitted to TCR it
cannot be modified. Setting inherit_tcr_brand: true and providing brand in
the same request is not allowed.
Payment Details
When billing_model is "profile" or "profile_and_organization" you may
include a payment_details object containing the card number, expiry (MM/YY),
CVC, and billing ZIP code. Payment details are never stored on our servers
and are forwarded directly to the payment processor. Providing payment_details
when billing_model is "organization" is not allowed.
211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/sentdm/resources/profiles.rb', line 211 def update(profile_id, params = {}) parsed, = Sentdm::ProfileUpdateParams.dump_request(params) header_params = {idempotency_key: "idempotency-key", x_profile_id: "x-profile-id"} @client.request( method: :patch, path: ["v3/profiles/%1$s", profile_id], headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Sentdm::APIResponseOfProfileDetail, options: ) end |