Phone Numbers from String Value Providers - Use case

The SMS Event Subscriber sends event-triggered SMS notifications to phone numbers supplied by phone number provider plugins. The Phone Numbers from String Value Providers plugin allows you to dynamically provide recipient phone numbers during a flow.

This article demonstrates the Phone Numbers from String Value Providers plugin with a use case where an end-user changes their email address in the protected self-services. It describes how to send an SMS notification to the mobile number that the end-user provides during the flow. The number is used only for this event and is not stored in a database.

Steps:

Step 1 - Add a User Data Edit Step

To add a User Data Edit Step to the change-email-address flow in the protected self-services, follow these steps. There is an image illustrating the instructions below the steps.

  1. In the Config Editor, go to
    Loginapp >> Protected Self-Services >> Protected Self-Service Flows
  2. In the Flows list, select and open the Custom Protected Self-Service Flow plugin used to change the email address.
  3. In the Custom Protected Self-Service Flow plugin dialog, in the Steps list, add a User Data Edit Step plugin, as the last step in the list. Follow the instructions:
  4. Configure the User Data Edit Step plugin

    1. In section Basic Settings, the Editable Items list defines the items that the end-user can edit in the User Data Edit Step. In our use case, this is a mobile phone number. Configure this item by creating a String User Context Data Item plugin in the Editable Items list. Edit the plugin as follows:
    2. Configure the String User Context Data Item plugin

      • In the first Context Data Name field, create a new String Context Data Item Name plugin. In the second Context Data Name field, enter a suitable name for the new data item, such as “mob_number”. Note that only lower case characters are allowed. Keep this item name in mind. You will need it later when configuring the SMS Event Subscriber (Loginapp) event subscriber.
      • Return to the String User Context Data Item plugin dialog. Check the Required checkbox (the default setting). This means that the end-user must set the new item, that is, enter a mobile number, for the User Data Edit Step to be successful.
    3. Return to the User Data Edit Step plugin dialog.
    4. In section Flow Control, the Step ID field assigns an ID to the current User Data Edit Step. For this, create a Step ID plugin. In the plugin's ID field, enter a suitable ID for the User Data Edit Step, such as “provide-mob-nr”. Keep this ID in mind. You will need it later when configuring the SMS Event Subscriber (Loginapp) event subscriber.
    5. Return to the User Data Edit Step plugin dialog.
    • You have now completed the configuration of the User Data Edit Step plugin.
  5. Return to the Custom Protected Self-Service Flow plugin dialog for the change-email-address flow.
  6. Click Activate to activate your configuration.
  7. You have now configured and activated a new User Data Edit Step. This new step prompts an end-user to provide a mobile number during the change-email-address flow in the protected self-services.

The next image illustrates the steps described above.

Step 2 - Create an SMS Event Subscriber (Loginapp) plugin

These instructions explain how to create an SMS Event Subscriber (Loginapp) plugin. The plugin sends an SMS notification to the mobile number entered in the User Data Edit Step you created earlier. Follow these steps to create the plugin. There is an image illustrating the instructions below the steps.

  1. In the Config Editor, go to
    Loginapp >> Event Settings >> Event Subscribers
  2. In the Event Subscribers list, create and edit an SMS Event Subscriber (Loginapp) plugin, as follows:
  3. Configure the SMS Event Subscriber (Loginapp) plugin

    1. In the SMS Settings field, either select an already configured Basic mTAN Settings plugin from the list, or create one according to your requirements.
    2. In the Phone Number Providers list, create a Phone Numbers from String Value Providers plugin. This plugin retrieves the mobile phone number that the end-user entered in the User Data Edit Step you created earlier.
      Edit the plugin as follows:
    3. Configure the Phone Numbers from String Value Providers plugin

      • In the Recipient Providers list, create a new String From Map Value Provider plugin. Edit the plugin as follows:
      • In the Value Maps list, create an Edited Context Data Map plugin.
      • In the Key field, specify a case-sensitive key. The subscriber needs this key to select the correct string from the value map defined in the previous step. Enter the name you gave the mobile number data item in the String Context Data Item Name plugin that you created earlier. The name is “mob_number”. See also section Step 1 - Add a User Data Edit Step above as well as the image further below.
    4. Return to the SMS Event Subscriber (Loginapp) plugin dialog.
    5. In the Message Resource Key field, enter sms.notification.message.
    6. The Language field specifies the string value provider that provides the language of the SMS notification. Use the already existing “language” context data field as value provider. Thus, the event subscriber will use the preferred language set by the current end-user for the SMS notification. For this, either select an already configured, suitable value provider from the list. Or create and edit a new String Context Data Value Provider plugin, as follows:
    7. Configure the String Context Data Value Provider plugin

      • The Context Data Field field specifies the context data field returning the required value. Create and edit a String Context Data Item Name plugin. In this plugin's dialog, in the Context Data Name field, enter “language”.
      • Return to the String Context Data Value Provider plugin dialog. Leave the Mandatory checkbox unchecked to avoid runtime exceptions if the current end-user has not set a preferred language.
    8. Return to the SMS Event Subscriber (Loginapp) plugin dialog.
    9. The Value Map Providers list defines all mappings required to replace the variables in the SMS notification template. Here, create the Context Data Map plugin. This plugin provides all context data of the current end-user.
    10. The Event field defines the event that triggers the event subscriber. Here, create and edit a Generic Step Result plugin, as follows:
    11. Configure the Generic Step Result plugin

      • In the Step ID Filter field, enter the ID of the step that must trigger the event subscriber. In our case, this is the User Data Edit Step that you created earlier, with step ID “provide-mob-nr”. See also Step 1 - Add a User Data Edit Step as well as the image further below. Thus, enter “provide-mob-nr” in the Step ID Filter field.
      • In the Result Type Filter dropdown, select SUCCESS.
    12. Return to the SMS Event Subscriber (Loginapp) plugin dialog.
    • You have now completed the configuration of the new SMS Event Subscriber (Loginapp) plugin.
  4. Return to the Loginapp Event Settings plugin dialog.
  5. Click Activate to activate your configuration.
  6. You have now configured and activated a new SMS Event Subscriber (Loginapp), which sends an SMS notification to a mobile number that the current end-user entered in the User Data Edit Step you created earlier.

The next image illustrates the steps described above.