Hello Francisco,
Welcome to Microsoft Q&A!
In your case, implementing an authentication flow in a WhatsApp conversation with a Copilot Studio Bot can be a bit tricky, especially since there isn't a direct REST API for generating one-time passwords (OTPs) from Azure B2C specifically for WhatsApp interactions.
However, you here are our current options:
- You can configure your Copilot to use manual authentication with Azure B2C. This involves prompting users to enter their credentials (like an OTP) directly in the chat. However, this requires the user to have a pre-existing account with Azure B2C.
- As Azure B2C doesn't provide a direct API for OTP generation in this context, you could create a custom backend service that accepts the user's email, generates an OTP (using a library like pyotp for Python), sends the OTP to the user's email and prompts the user to enter the OTP in the WhatsApp conversation for verification
- You could set up an Azure Function that handles the OTP generation and validation. This function can be called from your Copilot when the user initiates the authentication process
In case you need it, here are the steps you can follow to implement the options mentioned:
- User Identification: Since you already have the user's email and name, you can start the authentication flow by sending a message asking them to verify their identity.
- Generate OTP: Call your custom backend or Azure Function to generate and send the OTP to the user's email.
- User Input: Prompt the user to enter the OTP in the WhatsApp conversation.
- Validate OTP: Once the user enters the OTP, validate it against your backend service.
- Authentication Success: If the OTP is correct, you can proceed with the authenticated session in the conversation.
I hope the information provided was helpful, please let me know if you have any questions or concerns with the information provided. I will be waiting for your response.
Best regards,
Gao
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.