Skip to main content

Notifications

Copilot Studio - General
Suggested answer

How to trigger different Topics depenent on what regex-entity format was in conversation?

(0) ShareShare
ReportReport
Posted on by
I have a problem triggerering different Topics dependent on what numbers are discussed.
 
REGEXP ENTITY VARIABLES
 
Users should be able to identify different data objects that can be classified by the number format. E.g.
- Customer numbers are always 8 digits and starts with 1....
- Building numbers are always 18 digits
- Organization VAT numbers are always in the format xxxxxx-yyyy, where X and Y are digits
- etc.
 
So I have defined regex-based Entities in the Copilot studio, which works fine. The numbers are extracted into variables correctly, dependent on number format.
 
TOPIC TRIGGER
 
I can add Topics with trigger phrases like "show data about customer number" or "show data about building number". The correct Topic will then be triggered due to keywords "customer number" or "building number" being in the trigger phrases. But I want to trigger on the entity type number format being in the conversation.
 
Based on the number format, Copilot studio knows that 112233-4455 is an organization number, and that 12345678 is a customer number.
 
So the users should be able to write "what do we know about 112233-4455" or what do we know about "12345678" and Copilot studio should be able to pick the right topic dependent on what data object type the number format refers to.
 
So I would like a "get customer data Topic" to trigger if the number entered is 12345678, and a "get organisation data Topic" to trigger if the number entered is 112233-4455.
 
But I find no way to write a topic that triggers when the user enters "what do we know about 12345678", or just "12345678".
 
Different API calls will be made downstream dependent on object type queried, to query DB for either customer data or organization data etc.
 
Additionally, the new Generative AI orchestration mode" only works in English, and my chatbot is in a different language where Generative AI orchestration mode isnt enabled.
 
Any suggestions on how best to trigger the right topic if the wake-word is a number-format, eg someone types 12345678 or 112233-4455?
 
 
  • Suggested answer
    Chanel Rediker Profile Picture
    Chanel Rediker 2 on at
    How to trigger different Topics depenent on what regex-entity format was in conversation?
    Hey there,
     
    Looks like you've done a great job setting up those regex-based entities! To trigger different topics based on number formats in your conversations, here's a step-by-step guide:
     
     1. Define Regex Entities
    Make sure your regex entities are accurately defined for customer numbers, building numbers, and organization VAT numbers. For example:
    - **Customer Number:** Regex: `^1\d{7}$` (8 digits starting with 1)
    - **Building Number:** Regex: `^\d{18}$` (18 digits)
    - **Organization VAT Number:** Regex: `^\d{6}-\d{4}$` (Format: xxxxxx-yyyy)
     
     2. Extract Entities
    Use Copilot Studio to extract these entities into variables. This way, the system can recognize and classify the number formats correctly.
     
     3. Custom Middleware (if supported)
    Set up middleware to intercept user input and check for regex entities. Based on the identified number format, choose the appropriate topic to trigger.
     
    4. Define Topics
    Create topics in Copilot Studio like "Get Customer Data" and "Get Organization Data". Use trigger phrases like "show data about number" to start the conversation.
     
     5. Dynamic Topic Triggering
    Write a custom script (if supported) to dynamically check the entity and reroute the conversation to the correct topic. Example:
     
    def determine_topic(entity):
        if re.match('^1\d{7}$', entity):
            return "Get Customer Data"
        elif re.match('^\d{18}$', entity):
            return "Get Building Data"
        elif re.match('^\d{6}-\d{4}$', entity):
            return "Get Organization Data"
        else:
            return "Default Topic"
     
    user_input = get_user_input()
    entity = extract_entity(user_input)
    topic = determine_topic(entity)
    trigger_topic(topic)
     
     
    6. Contextual Prompts
    Use contextual prompts in your topics to guide the user based on the identified entity.
     
     7. Fallback Mechanism
    Set up a fallback mechanism for when the system can't determine the number format. Prompt the user for clarification if needed.
     
     Example Flow:
    1. User: "What do we know about 12345678?"
    2. System: Recognizes "12345678" as a customer number.
    3. System: Triggers "Get Customer Data" topic and fetches relevant data.
     
    Using regex entity extraction and custom logic, you can dynamically trigger the right topics based on the number formats in user conversations.
     
    Hope this helps! Feel free to ask if you need more details. 🌟 

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,445

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,741

Leaderboard