MFA SMS Leading Zero

Hi @Kush1,

Yes, you can most definitely use a Send Phone Message Action to set the recipient phone number.

Since Hooks have been deprecated, here is the converted script in an Action:

exports.onExecuteSendPhoneMessage = async (event, api) => {
  // Start formatting code
  
  const PNF = require('google-libphonenumber').PhoneNumberFormat;
  const phoneUtil = require('google-libphonenumber').PhoneNumberUtil.getInstance();
  
  // // Load recipient into the phone number object.
  let enteredNum = phoneUtil.parse(event.message_options.recipient);
  // // E.164 format recipient
  let e164Num = phoneUtil.format(enteredNum, PNF.E164);
  
  // End formatting code
  
  // Not shown: Call Phone message provider as normal using the value of e164Num instead of recipient.
  
  // Assuming that your message sending logic is synchronous or wrapped in a Promise,
  // you can just await on it here. Example:
  // await sendMessage(e164Num, event.message);
  
  // In an Action, there is no need to explicitly return a success response like in Hooks,
  // unless you wish to terminate the Action execution under certain conditions.
};

Let me know if you have any questions.

Thanks,
Rueben