Send SMS OTP to Mobile using API in Pega

“Security is not a product but a process”. Pega provides various options to ensure security of an end user. One of its ways of ensuring security is authentication- the process of verifying the identity of a user via mobile OTP.

This article illustrates how pega ensures authenticity of a using mobile OTP.

Example Scenario :

ABC company uses the pega platform to verify the authenticity of customers by generating the one time password(OTP) and sending it to the registered mobile number of the customer. . Let’s have a look at how pega performs it .


Step 1 :Create fast2sms account

Register on  for messaging service

Once successfully registered, login with your credentials. After logged-in, at the left side panel, you will get an option Dev API. Click on it.

In Dev API section, copy developer’s API authorization key & paste into notepad


Step 2: Configure Case type

Create a case type SMS

Create Mobile property in step which will configured for sending sms


Step 3. Create Activity for Connect-Rest: 

Create an activity by following the path:

Create 🡪 Technical 🡪 Activity

Method: Connect-Rest

Method parameters:    

  • ServiceName: “Connect-Rest” service name
  • MethodName: Get
  • ExcuationMode: Run

Now click on gear icon next to service name and create Connect-Rest


Now Create Connect-Rest:

In the Service tab provide Endpoint URL:

Endpoint URL will be unique to the SMS API you are using. Refer to API documentation on the respective website to find the Endpoint URL

Go to Method Tab, in Get Section on Request Tab

Add Additional query string parameters

Map From 
Map From key 
authorization Constant YOUR_API_KEY
sender_id Constant FSTSMS 
message Clipboard .pyTempInteger
route Constant 
language Constant english 
numbers Clipboard .Mobile
flash Constant 0

You must replace YOUR_API_KEY with your Fast2SMS account API Authorization Key which look like this: “weBQKBrtZzLnD2ZUEnUYJIO40zZGnjgZm3BA1SAUd0qZ56gHm0k3X45DWR9c


Save it and go to Service Tab, at the bottom of the window click on “Test Connectivity” Button.

This image shows that connection is successfully done. It is giving Neutralstatus because in messageand numbersString parameters values are not present, it is coming from clipboard.

After creating Connect-Rest , plugin this service into SendSMS activity

Step 4: Create DataTransform:

Create🡪Data Model🡪Data Transform


Use Random function to get the random decimal number and use the round function to make it an integer. 

Example: round(random(1000,5000))

Step 5: Configure Section

Open Section: App explorer🡪Expand casetype🡪UserInterface🡪Section

Add button & configure ActionSet for it

1.Configure the Event As : Refresh this section

2.Configure the Event as :Flow in Modal dialog


Click gear icon next to the Flow name & Create the Flow


After creating Flow, Open the connector & click gearicon next to the Flow Action and Create it.


In layout tab, in the section field enter section name 

click gear icon next to the section name & create it

      Create the following fields:

Property TypeName
LabelOTP has been sent to the Mobile Number
Text InputEnter OTP
ButtonResend OTP

Action Set for Button field:

  • Finish Assignment
  • Refresh this section (Plugin DataTransforn & Activity)
  • Flow in Modal dialog (Plugin Current Section Flow)

Save all the rules (Section, FlowAction & Flow)

Step 6: Create EditValidate rule

Create the validate rule by following the path :Create🡪Process🡪Validate

In property field, select EnterOTP property


In Assignment FlowAction, call this EditValidate rule 

(Casetype🡪Open Process🡪Open Assignment🡪Open FlowAction )

Save all rules and Run

Youtube Video:

Happy Learning!!!


Add yours →

  1. Hi ,

    I have tried with below url but sms is not generating to given mobile number
    URL ::

    Any Suggestion to overcome this issue??

    Thanks in Advance.

  2. Great!!

© 2024 Pega Tech

Theme by Anders NorénUp ↑

error: Content is protected !!