← 返回
未分类 Key 中文

Dynamics 365 CRM

Create and update CRM records in Microsoft Dynamics 365 — Opportunities, Leads, Contacts, Accounts, and Tasks via Dataverse Web API with Azure AD OAuth 2.0.
通过 Dataverse Web API(Azure AD OAuth 2.0 认证)在 Microsoft Dynamics 365 中创建和更新 CRM 记录,包括机会、线索、联系人、账户和任务。
vieiradiego
未分类 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 359
下载
💾 0
安装
1
版本
#crm#dataverse#dynamics365#latest#microsoft

概述

Dynamics 365 CRM Skill

When to activate

Activate this skill when the user mentions Microsoft Dynamics 365, D365, Dynamics CRM, or any of the following actions directed at a Dynamics 365 CRM:

  • Creating or updating an opportunity / deal / oportunidade
  • Creating or updating a lead
  • Creating or updating a contact / contacto
  • Creating or updating an account / empresa / conta
  • Creating a task / activity linked to a CRM record

Credentials required

VariableDescription
------
DYNAMICS365_CLIENT_IDAzure AD Application (client) ID
DYNAMICS365_CLIENT_SECRETAzure AD client secret
DYNAMICS365_TENANT_IDAzure AD Tenant ID — use common for multi-tenant
DYNAMICS365_INSTANCE_URLDynamics 365 instance URL, e.g. https://contoso.crm.dynamics.com

Step-by-step execution

1 — Identify intent and entity type

Determine from the user's message which entity to create or update:

User saysEntityAction
---------
"create deal", "new opportunity", "deal com X"Opportunityupsert
"new lead", "criar lead", "prospect X"Leadupsert
"add contact", "criar contacto", "cliente X no CRM"Contactupsert
"new account", "empresa Y no CRM", "criar conta"Accountupsert
"create task", "follow-up", "lembrete para X"Taskcreate

2 — Extract fields from user input

Opportunity fields:

  • name — deal / opportunity name (required)
  • estimatedvalue — numeric value in local currency
  • stepname — pipeline stage: "Qualify" / "Develop" / "Propose" / "Close"
  • actualclosedate — expected close date (ISO: YYYY-MM-DD)

Lead fields:

  • fullname — full name (required)
  • emailaddress1 — email address
  • companyname — company name
  • telephone1 — phone number
  • jobtitle — job title

Contact fields:

  • fullname — full name (required)
  • emailaddress1 — email address
  • telephone1 — phone number
  • jobtitle — job title

Account fields:

  • name — company / account name (required)
  • emailaddress1 — email address
  • telephone1 — phone number
  • websiteurl — website

Task fields:

  • subject — task title (required)
  • description — details / notes
  • scheduledend — due date-time (ISO 8601)
  • prioritycode — 0 = Low, 1 = Normal, 2 = High

3 — Call the appropriate method

Use the Dynamics365Client from the openclaw-dynamics-365 npm package:

import { Dynamics365Client } from "openclaw-dynamics-365";

const client = new Dynamics365Client(
  process.env.DYNAMICS365_INSTANCE_URL,
  accessToken,  // obtained via OAuth flow
);

// Opportunity
const result = await client.upsertOpportunity({ name: "Deal Contoso", estimatedvalue: 50000 });

// Lead
const result = await client.upsertLead({ fullname: "João Silva", companyname: "TechNova" });

// Contact
const result = await client.upsertContact({ fullname: "Maria Santos", emailaddress1: "maria@techno.com" });

// Account
const result = await client.upsertAccount({ name: "TechNova Ltda" });

// Task
const taskId = await client.createTask({ subject: "Follow-up call", prioritycode: 2 });

4 — Format response to the user

On success:

✅ [Entity] "[name]" [created/updated] in Dynamics 365.
🔗 [record URL]

On error:

❌ Could not [create/update] [entity] in Dynamics 365: [error message]

OAuth setup

For initial authorization, use getAuthorizationUrl() to redirect the user to

Microsoft's consent screen, then exchangeCodeForTokens() in the callback:

import { getAuthorizationUrl, exchangeCodeForTokens } from "openclaw-dynamics-365";

// 1. Redirect user
const url = getAuthorizationUrl(config, redirectUri, state);

// 2. In callback
const tokens = await exchangeCodeForTokens(config, code, redirectUri);

// 3. Refresh when expired (~1h)
if (isTokenExpired(tokens)) {
  tokens = await refreshAccessToken(config, tokens.refreshToken);
}

Notes

  • The Dataverse Web API uses OData v4 — all queries use $filter, $select, $top
  • Upsert operations search by name/email first to avoid duplicates
  • Lookup fields (e.g. linking a Contact to an Account) use OData binding syntax:

"parentcustomerid_account@odata.bind": "/accounts({accountId})"

  • Rate limit: 6,000 requests / 5 minutes per user — well within typical usage
  • Access tokens expire after ~1 hour — implement refresh logic using refreshAccessToken()

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-05-07 11:37 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,364 📥 319,268
ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,065 📥 802,064
security-compliance

Skill Vetter

spclaudehome
AI智能体技能安全预审工具。安装ClawdHub、GitHub等来源技能前,检查风险信号、权限范围及可疑模式。
★ 1,219 📥 267,034