Dynamics 365 Bot Knowledge Guide
Dynamics 365 Bot Knowledge Guide
Dynamics 365 Integration Overview
The Dynamics 365 integration gives your Velaro bot direct access to 28 AI tools spanning contacts, accounts, leads, opportunities, cases, activities, notes, quotes, products, appointments, and email history. The bot can look up records, create leads and cases, update opportunities, log activities, and surface real-time Dynamics data — all without a human agent.
This guide covers: what each tool does, step-by-step setup, production-ready sample prompts for every use case, prompt tips, escalation rules, and troubleshooting.
Complete Setup Guide (6 Steps)
You need four credentials to connect Dynamics 365 to Velaro: Tenant ID, Application (Client) ID, Client Secret, and Instance URL. This guide walks through getting each one. You will need Azure admin access (Global Administrator or Application Administrator role in Microsoft Entra ID).
Estimated time: 15–20 minutes if you have admin access. If you need to request admin access from your IT team, send them this guide — they will recognize every step.
Step 1 — Find Your Tenant ID
1. Go to portal.azure.com and sign in with your work account
2. In the search bar at the top, type Microsoft Entra ID and click it
3. On the Overview page, look for Tenant ID under "Basic information" — it is a GUID like a1b2c3d4-e5f6-7890-abcd-ef1234567890
4. Copy this value — you will paste it into Velaro later
Can't find it? If you see "You don't have access to Microsoft Entra ID", ask your IT admin for the Tenant ID. They can also find it at admin.microsoft.com → Settings → Org settings → Organization profile → Tenant ID.
Step 2 — Register an App in Azure Entra ID
This creates a service identity that Velaro uses to connect to your Dynamics 365. It does NOT require a Dynamics license.
1. In Microsoft Entra ID, click App registrations in the left menu
2. Click New registration
3. Fill in:
- Name: Velaro CRM Integration (or any name your team will recognize)
- Supported account types: select "Accounts in this organizational directory only"
- Redirect URI: leave blank — not needed for this integration
4. Click Register
5. On the app's Overview page, copy the Application (client) ID — this is your second credential
Step 3 — Create a Client Secret
1. In the app registration you just created, click Certificates & secrets in the left menu
2. Click New client secret
3. Enter a description (e.g. Velaro Production) and choose an expiry (24 months recommended — set a calendar reminder to rotate before it expires)
4. Click Add
5. Immediately copy the Value column — Azure only shows this once. If you navigate away before copying, you must create a new secret. This is your third credential.
Important: Copy the Value, not the Secret ID. The Value is the long string that starts with something like ETx8Q~.... The Secret ID is a separate GUID you do not need.
Step 4 — Grant Dynamics CRM API Permission
1. In the app registration, click API permissions in the left menu
2. Click Add a permission
3. Click the APIs my organization uses tab
4. Search for Dynamics CRM (you may also see it listed as "Common Data Service") and click it
5. Select Delegated permissions
6. Check user_impersonation and click Add permissions
7. Back on the API permissions page, click Grant admin consent for [your organization] — you must see a green checkmark next to user_impersonation before proceeding
"Grant admin consent" button is grayed out? You need the Global Administrator or Privileged Role Administrator role in Entra ID. Ask your IT admin to click this button, or send them a link to this app registration.
Why "user_impersonation" and not "Application permissions"? Dynamics 365 only offers delegated permissions. The actual access control happens through the Application User you create in Step 6 — that user's security role determines what Velaro can read and write. This is Microsoft's standard pattern for app integrations.
Step 5 — Find Your Instance URL
Your Instance URL is the base web address of your Dynamics 365 environment (e.g. https://yourorg.crm.dynamics.com). Here are three ways to find it:
Option A — Power Platform Admin Center (recommended):
1. Go to admin.powerplatform.microsoft.com
2. Click Environments in the left menu
3. Click your environment name (e.g. "Production" or "Default")
4. Look for Environment URL — copy the full URL including https://
Option B — From the browser address bar:
1. Open Dynamics 365 in your browser (the one you use daily)
2. Look at the URL in the address bar — it will be something like https://yourorg.crm.dynamics.com/main.aspx?...
3. Your Instance URL is everything before /main.aspx — in this example: https://yourorg.crm.dynamics.com
Option C — Dynamics 365 Settings:
1. In Dynamics 365, click Settings (gear icon) → Advanced Settings
2. Go to Settings → Customizations → Developer Resources
3. The Service Root URL contains your Instance URL (take everything before /api/data/...)
Common Instance URL formats: https://yourorg.crm.dynamics.com (North America), https://yourorg.crm4.dynamics.com (EMEA), https://yourorg.crm5.dynamics.com (APAC). The number after crm varies by region.
Step 6 — Create an Application User in Dynamics 365
The app registration from Step 2 gives Velaro a way to authenticate, but Dynamics 365 also needs a user record mapped to it. This "Application User" does NOT consume a Dynamics license — it is free.
1. Go to admin.powerplatform.microsoft.com → Environments → click your environment
2. Click Settings (in the top toolbar)
3. Expand Users + permissions → click Application users
4. Click New app user
5. Click Add an app → search for Velaro CRM Integration (the name from Step 2) → select it
6. Set Business unit — the root business unit is fine for most organizations
7. Click Edit security roles and assign a role:
- Minimum for testing: "Salesperson" (covers contacts, accounts, leads, opportunities)
- Recommended for production: Create a custom security role with access to: Contacts, Accounts, Leads, Opportunities, Cases, Activities, Notes, Products, Quotes, Appointments, and Emails
- Quick start: "Salesperson" + "Customer Service Representative" covers all 28 Velaro AI tools
8. Click Create
"Application users" option not visible? You need the System Administrator security role in Dynamics 365. This is a different role than Azure AD admin — ask your Dynamics 365 administrator.
Application User vs. regular user: An Application User does NOT need a $95/month Dynamics license. It is specifically designed for app integrations. You do NOT need to use anyone's personal Dynamics account for this integration.
Connect in Velaro
Once you have all four credentials:
1. Go to Velaro Admin → Integrations → Dynamics 365
2. Enter your Tenant ID, Application (Client) ID, Client Secret, and Instance URL
3. Click Save — Velaro calls the Dynamics 365 WhoAmI API to validate your connection
4. On success, you will see your Dynamics 365 organization name displayed
Connection failed? See the Troubleshooting section below, or check the Activity Log tab for the specific error message.
Enable AI Skills
1. Go to Integrations → Dynamics 365 → Launch Starter Wizard
2. Pick a pre-built template: Customer Service Bot, Sales Assistant Bot, Account Manager Bot, or Full CRM Specialist
3. The wizard generates a ready-to-use workflow with the right system prompt and all relevant AI tools pre-configured
4. All 28 Dynamics 365 AI tools activate automatically when the integration is connected
All 24 AI Tools
Contact (4 tools)
dynamics365_search_contacts — Find Dynamics 365 contacts by email or name. Returns full name, job title, phone, and linked account. Use this as the first lookup in any conversation.
dynamics365_get_contact — Fetch the full contact record including address, linked opportunities, open cases, and activity history. Call after dynamics365_search_contacts for complete details.
dynamics365_get_contact_by_email — Direct email lookup — retrieves a contact record by exact email address. Faster than search_contacts when you have a precise email.
dynamics365_update_contact — Update specific fields on an existing contact — phone, email, job title, or description. Always confirm with the visitor before updating.
Account (3 tools)
dynamics365_search_accounts — Find Dynamics 365 accounts (companies) by name. Returns website, phone, revenue, and employee count. Use to identify B2B company records.
dynamics365_get_account — Retrieve full account record including revenue, industry, billing address, and relationship manager. Call after search_accounts for complete details.
dynamics365_get_account_contacts — List all contacts associated with an account. Essential for B2B conversations where multiple people interact on behalf of the same company.
Lead (3 tools)
dynamics365_create_lead — Create a new Lead record in Dynamics 365 from visitor data collected during the conversation. Captures first name, last name, email, phone, company, and topic.
dynamics365_search_leads — Find leads by name, email, company, or source. Returns status and qualification stage. Use to check if a visitor is already tracked as a lead.
dynamics365_update_lead — Update a lead's qualification status, source, topic, or contact details. Use when a lead progresses through qualification during a chat.
Opportunity (5 tools)
dynamics365_search_opportunities — Find open opportunities for a contact or account — shows estimated value, pipeline stage, and close date. Use to understand deal history.
dynamics365_get_opportunity — Retrieve full opportunity record: estimated revenue, pipeline stage, products, probability, and close date.
dynamics365_get_contact_opportunities — List all opportunities linked to a specific contact. Use to show a contact's full deal history in a single call.
dynamics365_update_opportunity — Update an opportunity's stage, estimated value, close date, or probability. Always confirm changes with the customer before executing.
dynamics365_create_opportunity — Create a new Dynamics 365 opportunity linked to a contact from conversation data.
Case (5 tools)
dynamics365_search_cases — Search open support cases by title or linked contact. Shows status, priority, and case number. Use before creating a new case to check for duplicates.
dynamics365_get_case — Retrieve full case record — subject, description, priority, status, resolution, and linked contact. Use when the visitor references a specific case number.
dynamics365_create_case — Create a new support Case with subject, description, and priority from conversation data. Links the case to the matching contact.
dynamics365_update_case — Update case status, priority, resolution notes, or assigned owner. Use when a case is resolved during the conversation or needs reassignment.
dynamics365_get_contact_cases — List all support cases linked to a contact. Use to check for existing open cases before creating a new one — avoids duplicates.
Activity & Notes (4 tools)
dynamics365_create_note — Attach a note (conversation summary or transcript) to any Dynamics entity — contact, account, lead, opportunity, or case. Call this after every interaction.
dynamics365_get_activities — Retrieve recent activities for a contact — calls, emails, tasks, and meetings. Use to understand prior interaction history before responding.
dynamics365_create_activity — Log a call, task, or meeting activity against a Dynamics entity from the conversation. Use to record follow-up actions in the activity timeline.
dynamics365_get_entity_notes — Retrieve all notes attached to a Dynamics entity. Use when reviewing prior context on a contact, lead, or case.
Phase 3 Tools (4 tools)
dynamics365_create_quote — Create a Dynamics 365 quote linked to an opportunity. Captures product lines, pricing, and discount. Use when a visitor asks for a formal quote during a sales conversation.
dynamics365_get_products — Search the Dynamics product catalog by name or category. Returns price list items, description, and unit. Use to answer product or pricing questions before creating a quote.
dynamics365_schedule_appointment — Schedule a Dynamics appointment linked to a contact and sync it to Outlook. Captures subject, start/end time, and attendees. Use for follow-up meeting booking.
dynamics365_get_email_history — Retrieve the email activity history for a contact or case. Use to surface what was previously communicated before responding in a live chat.
Sample Bot Prompts
Customer Service Bot
You are a customer service specialist for [Company Name] with access to Dynamics 365 CRM.
TOOLS AVAILABLE: dynamics365_search_contacts, dynamics365_get_contact,
dynamics365_get_contact_by_email, dynamics365_get_contact_cases,
dynamics365_create_case, dynamics365_update_case, dynamics365_create_note
WORKFLOW:
1. Greet the visitor and ask how you can help.
2. Ask for their email address.
3. Call dynamics365_get_contact_by_email to find their contact record.
4. Call dynamics365_get_contact_cases to check for existing open cases.
5. If they have an open related case: share the case number and status. Ask if they have
an update or need help with something new.
6. For new issues: collect subject, description, and severity.
7. Call dynamics365_create_case to create a case linked to their contact.
8. Provide the case number and set expectations for response time.
9. If the issue is resolved during chat: call dynamics365_update_case to close it.
10. Call dynamics365_create_note to log a conversation summary on their contact.
EDGE CASES:
- Contact not found: ask for full name and company to try dynamics365_search_contacts.
If still not found, proceed with case creation using the info provided.
- Duplicate case: link back to existing case, don't create a new one.
- Critical/urgent issue: escalate to human agent immediately after creating the case.
- Frustrated customer: acknowledge frustration, apologize, escalate to human agent.
AFTER EVERY INTERACTION: call dynamics365_create_note on the contact record.
TONE: Empathetic and professional. Never argue. When in doubt, escalate to a human.
Sales Assistant Bot
You are a sales assistant for [Company Name] with access to Dynamics 365 CRM.
TOOLS AVAILABLE: dynamics365_search_contacts, dynamics365_get_contact_by_email,
dynamics365_search_leads, dynamics365_create_lead, dynamics365_search_opportunities,
dynamics365_create_opportunity, dynamics365_update_opportunity
WORKFLOW:
1. Greet the visitor. Ask how you can help.
2. Collect their name, email, and company.
3. Call dynamics365_get_contact_by_email to check if they're an existing contact.
4. If a contact exists: call dynamics365_search_opportunities to surface their open deals.
5. If they're a new prospect: ask qualifying questions:
- What specific problem are you trying to solve?
- What's your timeline for making a decision?
- Who else is involved in the decision?
- What's your approximate budget?
6. For qualified prospects: call dynamics365_create_lead with all captured data.
7. For known contacts with open opportunities: call dynamics365_update_opportunity
to update the stage based on signals from the conversation.
8. For new opportunities on existing contacts: call dynamics365_create_opportunity.
EDGE CASES:
- Lead already exists: retrieve it with dynamics365_search_leads and update instead.
- Not a decision maker: collect their info and ask for the decision maker's contact.
- Already a customer: route to account management or support as appropriate.
AFTER EVERY INTERACTION: call dynamics365_create_note on the contact or lead record.
TONE: Consultative and helpful. Ask questions to understand the need before pitching.
Account Manager Bot
You are an account management assistant for [Company Name] with access to Dynamics 365 CRM.
TOOLS AVAILABLE: dynamics365_search_accounts, dynamics365_get_account,
dynamics365_get_account_contacts, dynamics365_get_contact_opportunities,
dynamics365_get_activities, dynamics365_create_note
WORKFLOW:
1. Greet the visitor. Ask for their company name or email.
2. Call dynamics365_search_accounts to find the account record.
3. Call dynamics365_get_account to retrieve full account details — industry, revenue, owner.
4. Call dynamics365_get_account_contacts to list all contacts from this company in Dynamics.
5. For the primary contact, call dynamics365_get_contact_opportunities to review open deals.
6. Call dynamics365_get_activities to surface recent call, email, and meeting history.
7. Summarize the account context clearly.
8. For any follow-up needed, call dynamics365_create_activity to log a task.
EDGE CASES:
- Account not found: try searching by domain or shorter name variation.
- Multiple accounts matched: show the top 3 and ask which one they mean.
- No contacts found: note that the account exists but has no linked contacts in Dynamics.
AFTER EVERY INTERACTION: call dynamics365_create_note on the relevant account or contact.
TONE: Professional and thorough. Prepare account managers with everything they need.
Full CRM Specialist (Orchestration)
You are a Dynamics 365 CRM specialist for [Company Name] with access to all 28 tools.
FULL TOOL LIST:
- Contact: dynamics365_search_contacts, dynamics365_get_contact,
dynamics365_get_contact_by_email, dynamics365_update_contact
- Account: dynamics365_search_accounts, dynamics365_get_account,
dynamics365_get_account_contacts
- Lead: dynamics365_create_lead, dynamics365_search_leads, dynamics365_update_lead
- Opportunity: dynamics365_search_opportunities, dynamics365_get_opportunity,
dynamics365_get_contact_opportunities, dynamics365_update_opportunity,
dynamics365_create_opportunity
- Case: dynamics365_search_cases, dynamics365_get_case, dynamics365_create_case,
dynamics365_update_case, dynamics365_get_contact_cases
- Activity & Notes: dynamics365_create_note, dynamics365_get_activities,
dynamics365_create_activity, dynamics365_get_entity_notes
- Phase 3: dynamics365_create_quote, dynamics365_get_products,
dynamics365_schedule_appointment, dynamics365_get_email_history
GENERAL WORKFLOW:
1. Identify what the visitor needs: support, sales, account info, or general query.
2. Ask for email address to look up their contact record.
3. Use the appropriate tool group based on their intent.
4. For support questions: use Case + Contact tools.
5. For sales questions: use Lead + Opportunity + Contact tools.
6. For account questions: use Account tools.
7. Always log a note after the interaction.
RULES:
- Never create a lead, case, or opportunity without checking if one already exists.
- Always confirm before creating or updating records with pipeline impact.
- For anything outside Dynamics CRM scope, route to the appropriate team.
- Escalate to a human agent for billing disputes, legal matters, or frustrated customers.
AFTER EVERY INTERACTION: call dynamics365_create_note to log a full conversation summary.
TONE: Professional and knowledgeable. Every visitor should feel their account is well understood.
Prompt Tips
Start with contact lookup: always call dynamics365_get_contact_by_email or dynamics365_search_contacts first. Most follow-up tools need a contact ID or account ID to work correctly.
Check before creating: call dynamics365_get_contact_cases before creating a new case, and dynamics365_search_leads before creating a new lead — avoids duplicates that clutter the CRM.
Log every interaction: add dynamics365_create_note at the end of every workflow. This keeps Dynamics timelines complete and gives your team full context after every chat.
Use sidebar fields: go to Integrations → Dynamics 365 → Sidebar Fields tab to configure which Dynamics fields appear in the agent panel during live chats. Standard fields (name, email, job title, phone) are always shown — you can add custom fields from any entity.
Entity ID discipline: most Dynamics tools accept either an ID (GUID) or a name/email. The tools handle lookup internally, but passing the exact GUID from a prior lookup result is always faster and more reliable.
Escalation Rules
Escalate to a human agent immediately when:
- The visitor is angry, frustrated, or threatening escalation
- The issue involves a refund, billing dispute, legal matter, or contractual commitment
- The visitor asks to speak with a named person or specific team
- The bot has called 3+ tools without resolving the issue
- The visitor's account shows a Critical or high-priority open case
Troubleshooting
Contact not found: ask for their full name and company, then try dynamics365_search_contacts. If still not found, proceed with the information provided and create a note for your team to investigate.
Case not found: try dynamics365_search_cases with a broader keyword. If the case genuinely doesn't exist, confirm with the visitor before creating a new one.
Tool returns permission error: the Entra App Registration may be missing required Dynamics API permissions. Go to Integrations → Dynamics 365 and verify the connection status. Your Azure admin may need to grant additional API permissions.
Lead creation fails: verify that all required fields are provided — Lead requires at minimum a last name and company name in most Dynamics configurations.
Dynamics connection expired: if tools are failing with auth errors, go to Integrations → Dynamics 365 and re-save your credentials. Client secrets expire based on your Entra configuration — rotate them before expiry.
Was this article helpful?