> For the complete documentation index, see [llms.txt](https://doc.duaer.com/zh/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.duaer.com/zh/recipes/hubspot-deal-to-slack.md).

# 在 Duaer 里把 HubSpot 新商机推送到 Slack

在 Duaer 里，HubSpot 新建商机后把名称、金额和阶段推到 Slack。可以用 HubSpot Trigger 实时推送，也可以每几分钟查一次。
## 做法一：HubSpot Trigger 实时推送

1. 按 [Duaer 里的 HubSpot 凭证](/zh/integrations/builtin/credentials/hubspot.md) 建两条凭证：HubSpot Developer API（给触发器，要开发者账号里的应用）和 HubSpot Service Key（给读取商机）。
2. 加 [HubSpot Trigger](/zh/integrations/builtin/trigger-nodes/duaer-nodes-base.hubspottrigger.md)，Events 里加 Deal Created。
3. 接 HubSpot 节点，Resource 选 Deal，Operation 选 Get，Deal ID 填 {{ $json.dealId }}。推送里只有编号，名称和金额要再读一次。
4. 接 [Slack](/zh/build/slack.md)，消息写：新商机 {{ $json.properties.dealname.value }}，金额 {{ $json.properties.amount.value }}，阶段 {{ $json.properties.dealstage.value }}。
5. 发布数字组织。

## 做法二：不建开发者应用，每 5 分钟查一次

1. 加 [Schedule Trigger](/zh/build/schedule-trigger.md)，每 5 分钟。
2. 接 HubSpot 节点（Service Key 凭证），Resource 选 Deal，Operation 选 Get Recently Created/Updated。
3. 接 [Remove Duplicates](/zh/build/remove-duplicates.md)，选 Remove Items Processed in Previous Executions，Value to Dedupe On 填 {{ $json.dealId }}，只放行没推过的。
4. 接 Slack，消息同上。

去重的细节见 [在 Duaer 里去重](/zh/snippets/remove-duplicates.md)。
## Questions

### Duaer 的 HubSpot Trigger 为什么要开发者账号？

HubSpot 只通过开发者应用推送事件，所以 Duaer 的 HubSpot Trigger 用 HubSpot Developer API 凭证。不想建应用时用定时查询加去重。

### Duaer 收到的 HubSpot 商机为什么没有名称？

HubSpot 推送只带商机编号。在 Duaer 里接 HubSpot 节点的 Deal Get 再读一次。

## 相关

- [在 Duaer 里配置 HubSpot 凭证](https://doc.duaer.com/zh/integrations/builtin/credentials/hubspot.md)
- [在 Duaer 里用 Slack 发消息](https://doc.duaer.com/zh/build/slack.md)
- [在 Duaer 里去重：本次重复和以前处理过的](https://doc.duaer.com/zh/snippets/remove-duplicates.md)

