Class: Twilio::REST::Messaging::V1::ServiceContext::UsAppToPersonInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, messaging_service_sid: nil, sid: nil) ⇒ UsAppToPersonInstance

Initialize the UsAppToPersonInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • account_sid (String)

    The SID of the Account that created this UsAppToPerson resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 331

def initialize(version, payload , messaging_service_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'account_sid' => payload['account_sid'],
        'brand_registration_sid' => payload['brand_registration_sid'],
        'messaging_service_sid' => payload['messaging_service_sid'],
        'description' => payload['description'],
        'message_samples' => payload['message_samples'],
        'us_app_to_person_usecase' => payload['us_app_to_person_usecase'],
        'has_embedded_links' => payload['has_embedded_links'],
        'has_embedded_phone' => payload['has_embedded_phone'],
        'subscriber_opt_in' => payload['subscriber_opt_in'],
        'age_gated' => payload['age_gated'],
        'direct_lending' => payload['direct_lending'],
        'campaign_status' => payload['campaign_status'],
        'campaign_id' => payload['campaign_id'],
        'is_externally_registered' => payload['is_externally_registered'],
        'rate_limits' => payload['rate_limits'],
        'message_flow' => payload['message_flow'],
        'opt_in_message' => payload['opt_in_message'],
        'opt_out_message' => payload['opt_out_message'],
        'help_message' => payload['help_message'],
        'opt_in_keywords' => payload['opt_in_keywords'],
        'opt_out_keywords' => payload['opt_out_keywords'],
        'help_keywords' => payload['help_keywords'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
        'mock' => payload['mock'],
        'errors' => payload['errors'],
    }

    # Context
    @instance_context = nil
    @params = { 'messaging_service_sid' => messaging_service_sid  || @properties['messaging_service_sid']  ,'sid' => sid  || @properties['sid']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that the Campaign belongs to.

Returns:



390
391
392
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 390

def 
    @properties['account_sid']
end

#age_gatedBoolean

Returns A boolean that specifies whether campaign is age gated or not.

Returns:

  • (Boolean)

    A boolean that specifies whether campaign is age gated or not.



444
445
446
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 444

def age_gated
    @properties['age_gated']
end

#brand_registration_sidString

Returns The unique string to identify the A2P brand.

Returns:

  • (String)

    The unique string to identify the A2P brand.



396
397
398
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 396

def brand_registration_sid
    @properties['brand_registration_sid']
end

#campaign_idString

Returns The Campaign Registry (TCR) Campaign ID.

Returns:

  • (String)

    The Campaign Registry (TCR) Campaign ID.



462
463
464
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 462

def campaign_id
    @properties['campaign_id']
end

#campaign_statusString

Returns Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED.

Returns:

  • (String)

    Campaign status. Examples: IN_PROGRESS, VERIFIED, FAILED.



456
457
458
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 456

def campaign_status
    @properties['campaign_status']
end

#contextUsAppToPersonContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



375
376
377
378
379
380
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 375

def context
    unless @instance_context
        @instance_context = UsAppToPersonContext.new(@version , @params['messaging_service_sid'], @params['sid'])
    end
    @instance_context
end

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



522
523
524
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 522

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.

Returns:



528
529
530
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 528

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the UsAppToPersonInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



553
554
555
556
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 553

def delete

    context.delete
end

#descriptionString

Returns A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters.

Returns:

  • (String)

    A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters.



408
409
410
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 408

def description
    @properties['description']
end

#direct_lendingBoolean

Returns A boolean that specifies whether campaign allows direct lending or not.

Returns:

  • (Boolean)

    A boolean that specifies whether campaign allows direct lending or not.



450
451
452
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 450

def direct_lending
    @properties['direct_lending']
end

#errorsArray<Hash>

Returns Details indicating why a campaign registration failed. These errors can indicate one or more fields that were incorrect or did not meet review requirements.

Returns:

  • (Array<Hash>)

    Details indicating why a campaign registration failed. These errors can indicate one or more fields that were incorrect or did not meet review requirements.



546
547
548
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 546

def errors
    @properties['errors']
end

#fetchUsAppToPersonInstance

Fetch the UsAppToPersonInstance

Returns:



561
562
563
564
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 561

def fetch

    context.fetch
end

Returns Indicate that this SMS campaign will send messages that contain links.

Returns:

  • (Boolean)

    Indicate that this SMS campaign will send messages that contain links.



426
427
428
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 426

def has_embedded_links
    @properties['has_embedded_links']
end

#has_embedded_phoneBoolean

Returns Indicates that this SMS campaign will send messages that contain phone numbers.

Returns:

  • (Boolean)

    Indicates that this SMS campaign will send messages that contain phone numbers.



432
433
434
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 432

def has_embedded_phone
    @properties['has_embedded_phone']
end

#help_keywordsArray<String>

Returns End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio’s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.

Returns:

  • (Array<String>)

    End users should be able to text in a keyword to receive help. Those keywords must be provided as part of the campaign registration request. This field is required if managing help keywords yourself (i.e. not using Twilio’s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.



516
517
518
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 516

def help_keywords
    @properties['help_keywords']
end

#help_messageString

Returns When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio’s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.

Returns:

  • (String)

    When customers receive the help keywords from their end users, Twilio customers are expected to send back an auto-generated response; this may include the brand name and additional support contact information. This field is required if managing help keywords yourself (i.e. not using Twilio’s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.



498
499
500
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 498

def help_message
    @properties['help_message']
end

#inspectObject

Provide a detailed, user friendly representation



606
607
608
609
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 606

def inspect
    values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Messaging.V1.UsAppToPersonInstance #{values}>"
end

#is_externally_registeredBoolean

Returns Indicates whether the campaign was registered externally or not.

Returns:

  • (Boolean)

    Indicates whether the campaign was registered externally or not.



468
469
470
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 468

def is_externally_registered
    @properties['is_externally_registered']
end

#message_flowString

Returns Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum.

Returns:

  • (String)

    Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum.



480
481
482
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 480

def message_flow
    @properties['message_flow']
end

#message_samplesArray<String>

Returns An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars.

Returns:

  • (Array<String>)

    An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars.



414
415
416
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 414

def message_samples
    @properties['message_samples']
end

#messaging_service_sidString

Returns The SID of the [Messaging Service](www.twilio.com/docs/messaging/api/service-resource) that the resource is associated with.

Returns:



402
403
404
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 402

def messaging_service_sid
    @properties['messaging_service_sid']
end

#mockBoolean

Returns A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes.

Returns:

  • (Boolean)

    A boolean that specifies whether campaign is a mock or not. Mock campaigns will be automatically created if using a mock brand. Mock campaigns should only be used for testing purposes.



540
541
542
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 540

def mock
    @properties['mock']
end

#opt_in_keywordsArray<String>

Returns If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum.

Returns:

  • (Array<String>)

    If end users can text in a keyword to start receiving messages from this campaign, those keywords must be provided. This field is required if end users can text in a keyword to start receiving messages from this campaign. Values must be alphanumeric. 255 character maximum.



504
505
506
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 504

def opt_in_keywords
    @properties['opt_in_keywords']
end

#opt_in_messageString

Returns If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum.

Returns:

  • (String)

    If end users can text in a keyword to start receiving messages from this campaign, the auto-reply messages sent to the end users must be provided. The opt-in response should include the Brand name, confirmation of opt-in enrollment to a recurring message campaign, how to get help, and clear description of how to opt-out. This field is required if end users can text in a keyword to start receiving messages from this campaign. 20 character minimum. 320 character maximum.



486
487
488
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 486

def opt_in_message
    @properties['opt_in_message']
end

#opt_out_keywordsArray<String>

Returns End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio’s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.

Returns:

  • (Array<String>)

    End users should be able to text in a keyword to stop receiving messages from this campaign. Those keywords must be provided. This field is required if managing opt out keywords yourself (i.e. not using Twilio’s Default or Advanced Opt Out features). Values must be alphanumeric. 255 character maximum.



510
511
512
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 510

def opt_out_keywords
    @properties['opt_out_keywords']
end

#opt_out_messageString

Returns Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio’s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.

Returns:

  • (String)

    Upon receiving the opt-out keywords from the end users, Twilio customers are expected to send back an auto-generated response, which must provide acknowledgment of the opt-out request and confirmation that no further messages will be sent. It is also recommended that these opt-out messages include the brand name. This field is required if managing opt out keywords yourself (i.e. not using Twilio’s Default or Advanced Opt Out features). 20 character minimum. 320 character maximum.



492
493
494
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 492

def opt_out_message
    @properties['opt_out_message']
end

#rate_limitsHash

Returns Rate limit and/or classification set by each carrier, Ex. AT&T or T-Mobile.

Returns:

  • (Hash)

    Rate limit and/or classification set by each carrier, Ex. AT&T or T-Mobile.



474
475
476
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 474

def rate_limits
    @properties['rate_limits']
end

#sidString

Returns The unique string that identifies a US A2P Compliance resource ‘QE2c6890da8086d771620e9b13fadeba0b`.

Returns:

  • (String)

    The unique string that identifies a US A2P Compliance resource ‘QE2c6890da8086d771620e9b13fadeba0b`.



384
385
386
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 384

def sid
    @properties['sid']
end

#subscriber_opt_inBoolean

Returns A boolean that specifies whether campaign has Subscriber Optin or not.

Returns:

  • (Boolean)

    A boolean that specifies whether campaign has Subscriber Optin or not.



438
439
440
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 438

def subscriber_opt_in
    @properties['subscriber_opt_in']
end

#to_sObject

Provide a user friendly representation



599
600
601
602
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 599

def to_s
    values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
    "<Twilio.Messaging.V1.UsAppToPersonInstance #{values}>"
end

#update(has_embedded_links: nil, has_embedded_phone: nil, message_samples: nil, message_flow: nil, description: nil, age_gated: nil, direct_lending: nil) ⇒ UsAppToPersonInstance

Update the UsAppToPersonInstance

Parameters:

  • has_embedded_links (Boolean) (defaults to: nil)

    Indicates that this SMS campaign will send messages that contain links.

  • has_embedded_phone (Boolean) (defaults to: nil)

    Indicates that this SMS campaign will send messages that contain phone numbers.

  • message_samples (Array[String]) (defaults to: nil)

    An array of sample message strings, min two and max five. Min length for each sample: 20 chars. Max length for each sample: 1024 chars.

  • message_flow (String) (defaults to: nil)

    Required for all Campaigns. Details around how a consumer opts-in to their campaign, therefore giving consent to receive their messages. If multiple opt-in methods can be used for the same campaign, they must all be listed. 40 character minimum. 2048 character maximum.

  • description (String) (defaults to: nil)

    A short description of what this SMS campaign does. Min length: 40 characters. Max length: 4096 characters.

  • age_gated (Boolean) (defaults to: nil)

    A boolean that specifies whether campaign requires age gate for federally legal content.

  • direct_lending (Boolean) (defaults to: nil)

    A boolean that specifies whether campaign allows direct lending or not.

Returns:



576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 576

def update(
    has_embedded_links: nil, 
    has_embedded_phone: nil, 
    message_samples: nil, 
    message_flow: nil, 
    description: nil, 
    age_gated: nil, 
    direct_lending: nil
)

    context.update(
        has_embedded_links: has_embedded_links, 
        has_embedded_phone: has_embedded_phone, 
        message_samples: message_samples, 
        message_flow: message_flow, 
        description: description, 
        age_gated: age_gated, 
        direct_lending: direct_lending, 
    )
end

#urlString

Returns The absolute URL of the US App to Person resource.

Returns:

  • (String)

    The absolute URL of the US App to Person resource.



534
535
536
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 534

def url
    @properties['url']
end

#us_app_to_person_usecaseString

Returns A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR…]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand.

Returns:

  • (String)

    A2P Campaign Use Case. Examples: [ 2FA, EMERGENCY, MARKETING, SOLE_PROPRIETOR…]. SOLE_PROPRIETOR campaign use cases can only be created by SOLE_PROPRIETOR Brands, and there can only be one SOLE_PROPRIETOR campaign created per SOLE_PROPRIETOR Brand.



420
421
422
# File 'lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb', line 420

def us_app_to_person_usecase
    @properties['us_app_to_person_usecase']
end