Class: Sentdm::Resources::Profiles

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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.

Parameters:



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

#campaignsSentdm::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

Parameters:

  • profile_id (String)

    Path param: Profile ID from route

  • web_hook_url (String)

    Body param: Webhook URL to call when profile completion finishes (success or fai

  • sandbox (Boolean)

    Body param: Sandbox flag - when true, the operation is simulated without side ef

  • idempotency_key (String)

    Header param: Unique key to ensure idempotent request processing. Must be 1-255

  • x_profile_id (String)

    Header param: Profile UUID to scope the request to a child profile. Only organiz

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

Returns:

See Also:



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, options = 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: 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.

Parameters:

  • allow_contact_sharing (Boolean)

    Body param: Whether contacts are shared across profiles (default: false)

  • allow_template_sharing (Boolean)

    Body param: Whether templates are shared across profiles (default: false)

  • billing_contact (Sentdm::Models::BillingContactInfo, nil)

    Body param: Billing contact information for a profile.

  • billing_model (String, nil)

    Body param: Billing model: profile, organization, or profile_and_organization (d

  • brand (Sentdm::Models::BrandsBrandData, nil)

    Body param: Brand and KYC data grouped into contact, business, and compliance se

  • description (String, nil)

    Body param: Profile description (optional)

  • icon (String, nil)

    Body param: Profile icon URL (optional)

  • inherit_contacts (Boolean, nil)

    Body param: Whether this profile inherits contacts from organization (default: t

  • inherit_tcr_brand (Boolean, nil)

    Body param: Whether this profile inherits TCR brand from organization (default:

  • inherit_tcr_campaign (Boolean, nil)

    Body param: Whether this profile inherits TCR campaign from organization (defaul

  • inherit_templates (Boolean, nil)

    Body param: Whether this profile inherits templates from organization (default:

  • name (String)

    Body param: Profile name (required)

  • payment_details (Sentdm::Models::PaymentDetails, nil)

    Body param: Payment card details for a profile.

  • sandbox (Boolean)

    Body param: Sandbox flag - when true, the operation is simulated without side ef

  • short_name (String, nil)

    Body param: Profile short name/abbreviation (optional). Must be 3–11 characters,

  • whatsapp_business_account (Sentdm::Models::ProfileCreateParams::WhatsappBusinessAccount, nil)

    Body param: Direct WhatsApp Business Account credentials for a profile.

  • idempotency_key (String)

    Header param: Unique key to ensure idempotent request processing. Must be 1-255

  • x_profile_id (String)

    Header param: Profile UUID to scope the request to a child profile. Only organiz

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

Returns:

See Also:



94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/sentdm/resources/profiles.rb', line 94

def create(params = {})
  parsed, options = 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: 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.

Parameters:

  • profile_id (String)

    Path param

  • sandbox (Boolean)

    Body param: Sandbox flag - when true, the operation is simulated without side ef

  • x_profile_id (String)

    Header param: Profile UUID to scope the request to a child profile. Only organiz

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

Returns:

  • (nil)

See Also:



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, options = 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: 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.

Parameters:

  • x_profile_id (String)

    Profile UUID to scope the request to a child profile. Only organization API keys

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

Returns:

See Also:



241
242
243
244
245
246
247
248
249
250
# File 'lib/sentdm/resources/profiles.rb', line 241

def list(params = {})
  parsed, options = 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: 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.

Parameters:

  • profile_id (String)
  • x_profile_id (String)

    Profile UUID to scope the request to a child profile. Only organization API keys

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

Returns:

See Also:



125
126
127
128
129
130
131
132
133
134
# File 'lib/sentdm/resources/profiles.rb', line 125

def retrieve(profile_id, params = {})
  parsed, options = 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: 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.

Parameters:

  • profile_id (String)

    Path param

  • allow_contact_sharing (Boolean, nil)

    Body param: Whether contacts are shared across profiles (optional)

  • allow_number_change_during_onboarding (Boolean, nil)

    Body param: Whether number changes are allowed during onboarding (optional)

  • allow_template_sharing (Boolean, nil)

    Body param: Whether templates are shared across profiles (optional)

  • billing_contact (Sentdm::Models::BillingContactInfo, nil)

    Body param: Billing contact information for a profile.

  • billing_model (String, nil)

    Body param: Billing model: profile, organization, or profile_and_organization (o

  • brand (Sentdm::Models::BrandsBrandData, nil)

    Body param: Brand and KYC data grouped into contact, business, and compliance se

  • description (String, nil)

    Body param: Profile description (optional)

  • icon (String, nil)

    Body param: Profile icon URL (optional)

  • inherit_contacts (Boolean, nil)

    Body param: Whether this profile inherits contacts from organization (optional)

  • inherit_tcr_brand (Boolean, nil)

    Body param: Whether this profile inherits TCR brand from organization (optional)

  • inherit_tcr_campaign (Boolean, nil)

    Body param: Whether this profile inherits TCR campaign from organization (option

  • inherit_templates (Boolean, nil)

    Body param: Whether this profile inherits templates from organization (optional)

  • name (String, nil)

    Body param: Profile name (optional)

  • payment_details (Sentdm::Models::PaymentDetails, nil)

    Body param: Payment card details for a profile.

  • sandbox (Boolean)

    Body param: Sandbox flag - when true, the operation is simulated without side ef

  • sending_phone_number (String, nil)

    Body param: Direct phone number for SMS sending (optional)

  • sending_phone_number_profile_id (String, nil)

    Body param: Reference to another profile to use for SMS configuration (optional)

  • sending_whatsapp_number_profile_id (String, nil)

    Body param: Reference to another profile to use for WhatsApp configuration (opti

  • short_name (String, nil)

    Body param: Profile short name/abbreviation (optional). Must be 3–11 characters,

  • whatsapp_phone_number (String, nil)

    Body param: Direct phone number for WhatsApp sending (optional)

  • idempotency_key (String)

    Header param: Unique key to ensure idempotent request processing. Must be 1-255

  • x_profile_id (String)

    Header param: Profile UUID to scope the request to a child profile. Only organiz

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

Returns:

See Also:



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, options = 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: options
  )
end