Identify unique fields in a string and replace with participant data

Hi, is there a way we can do the below within an Architect Message flow.

  1. assign a variable called var_welcome_response (string) = "Hi, {{sender_first_name}}. How can we help you today? Your access key is {{access_key}}
  2. retrieve the value of the 1st {}
  3. if 1st {} is eg. "sender_first_name", we do a Get Participant Data for "sender_first_name" (eg. returns value of "John"
  4. search for next {} in var_welcome_response. we do another Get Participant Data for "access_key" (eg. returns value of "12345")
  5. We continue to search for {} until there are none left in the var_welcome_response variable.
  6. we then interject those values back into the var_welcome_response before we send the response to the customer. Eg, Hi, John. How can we help you today? Your access key is 12345.

Don't there is a single function or step to do this.
It can be done in a few steps, but first for me it is important to know how many unique {} will there be, hoping there are not a lot, say 10 different.
Then for each of these different {}, I will first search for the unique one I know of, and using the returned value to run the getaprtcipantdata action, and repeat it for all 10 unique items.
yes it is a very basic one but can't think of any other way at this time

you can also set these unique {} codes in a data table, then using a loop task in architect, you can loop through each of these datatable entries for unique {} and then find them in the text and do what you need to do if found. probably much easier.

Hi Vineet, thanks for your responses. In answered your first question re: number of {}, I don't think there will be more than 2-3 within each string(response). Finding each {} and then using the value to do a get participant data(PD) sounds doable according to your suggestion, but how would I be able to replace the {} with the value of the PD before I send the web message response? Cheers

you should be able to use the update-data action to update the string value by using Replace function.
your_original_string_with{} = Replace(your_original_string_with{}, element_you_are_looking_for{}, value_you_want_to_replace_with)
So as for your example;
var_welcome_response = Replace(var_welcome_response, "{{sender_first_name}}", "John")
var_welcome_response = Replace(var_welcome_response, "{{access_key}}", "12345")

Thanks @Vineet_Kakroo, your suggestion worked a treat.