Skip to main content

Function: authenticate_by_phone_number

For when you must have real users

Updated over 3 weeks ago

When and Why to Use

Use this to verify the respondent’s identity by phone. This adds a layer of security and is ideal for:

• High-sensitivity or confidential surveys

• Preventing duplicate responses

• Ensuring respondent authenticity for incentives or gated content

Respondents enter their phone number, receive a code by SMS, and must enter it correctly to continue.

Portrait Experience

• User is prompted to enter a phone number

• Next screen prompts for the code sent to their device

• Failure to verify shows termination message

Landscape Experience

• Experience is the same as portrait with more screen real estate for labels and buttons

• Designed to work well across device types including mobile and desktop

Configuration Options

Option

Type

Required

Default

Description

question_1

string

yes

-

Prompt asking for the phone number

question_2

string

no

“Please enter the code we sent you.”

Prompt asking for the verification code

termination_message

string

no

“Sorry, the code you entered was incorrect”

Message shown if verification fails

store_phone_number

bool

no

False

Whether to save the number in the response data

image

MediaItem

no

-

Optional image shown above the question

default_country

string

no

US

Default country code for phone formatting

**topics

dict

no

-

For use in grouped reporting or string substitution

Example Code

s.authenticate_by_phone_number( "This is a high security survey. Please enter your phone number to continue, and we'll send you a verification code." )

With custom prompts and storage:

s.authenticate_by_phone_number( question_1="Enter your mobile number to receive a code.", question_2="Type the code sent to your phone.", termination_message="That code doesn't match. Access denied.", store_phone_number=True, default_country="GB" )

Notes

• Verification is one-time and applies per survey session

• You can use the stored phone number later in your logic (e.g., deduplication)

• Ensure this usage complies with your local data privacy regulations

Did this answer your question?