# Webhook事件⭐

<div style="background: linear-gradient(135deg, rgba(255, 213, 145, 0.45) 0%, rgba(255, 255, 255, 0.06) 100%); border: 1px solid rgba(255, 236, 202, 0.7); border-radius: 12px; padding: 28px 32px; margin-bottom: 24px; box-shadow: 0 4px 12px rgba(250, 140, 22, 0.08);">
 <div style="display: flex; align-items: center; gap: 12px; margin-bottom: 12px;">

<h1 style="margin: 0; font-size: 24px; font-weight: 600; color: inherit; border: none; padding-bottom: 0;">Webhook 事件回调</h1>
 </div>
 <p style="margin: 0; font-size: 15px; color: inherit; line-height: 1.7;">
 当您需要开发<strong>自动回复、入群欢迎、消息存档</strong>等功能时，需要配置「回调地址」。配置后，机器人收到的所有消息都会实时推送到您的服务器。
 </p>
</div>

<div style="margin-bottom: 20px;">
 <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 14px;">
 <span style="font-size: 20px;"></span>
 <h2 style="margin: 0; font-size: 18px; color: inherit; font-weight: 600; border: none; padding-bottom: 0;">如何配置回调地址？</h2>
 </div>
 <p style="margin: 0 0 14px 0; font-size: 14px; color: inherit; opacity: 0.75;">您可以选择以下任意一种方式进行配置：</p>

 <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 16px;">
 <div style="background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 236, 202, 0.22) 100%); border: 1px solid rgba(255, 241, 214, 0.65); border-radius: 10px; padding: 18px; box-shadow: 0 2px 6px rgba(250, 140, 22, 0.06);">
 <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 10px;">
 <span style="background: #FA8C16; color: #fff; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;">1</span>
 <h3 style="margin: 0; font-size: 15px; color: inherit; font-weight: 600;">后台手动配置（推荐）</h3>
 </div>
 <p style="margin: 0; font-size: 13px; color: inherit; opacity: 0.7; line-height: 1.6;">登录 <a href="http://new.qiweapi.com/token" style="color: #FA8C16; text-decoration: none; font-weight: 500;">控制台</a> → <strong>应用凭证</strong> → 点击 <strong>[配置]</strong> 即可设置回调地址。</p>
 </div>

 <div style="background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 236, 202, 0.22) 100%); border: 1px solid rgba(255, 241, 214, 0.65); border-radius: 10px; padding: 18px; box-shadow: 0 2px 6px rgba(250, 140, 22, 0.06);">
 <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 10px;">
 <span style="background: #FA8C16; color: #fff; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;">2</span>
 <h3 style="margin: 0; font-size: 15px; color: inherit; font-weight: 600;">API 接口配置</h3>
 </div>
 <p style="margin: 0; font-size: 13px; color: inherit; opacity: 0.7; line-height: 1.6;">调用 <a href="api-344613853" style="color: #FA8C16; text-decoration: none; font-weight: 500;">设置回调地址</a> 接口进行程序化配置。</p>
 </div>
 </div>

 <div style="background: rgba(255, 247, 230, 0.35); border-left: 4px solid #FA8C16; border-radius: 0 8px 8px 0; padding: 12px 16px;">
 <p style="margin: 0; font-size: 13px; color: inherit; line-height: 1.6;"> <strong>注意：</strong>配置成功后，该 Token 下登录的所有账号消息都会转发至此地址。</p>
 </div>
</div>

<div style="margin-bottom: 20px;">
 <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 14px;">
 <span style="font-size: 20px;"></span>
 <h2 style="margin: 0; font-size: 18px; color: inherit; font-weight: 600; border: none; padding-bottom: 0;">开发要求与规范</h2>
 </div>
 <p style="margin: 0 0 14px 0; font-size: 14px; color: inherit; opacity: 0.75;">为确保消息推送稳定，您的回调接口需满足以下条件：</p>

 <div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px;">


 <div style="background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 236, 202, 0.22) 100%); border: 1px solid rgba(255, 241, 214, 0.65); border-radius: 10px; padding: 16px; box-shadow: 0 2px 6px rgba(250, 140, 22, 0.06);">
 <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
 <span style="font-size: 18px;">⏱</span>
 <h3 style="margin: 0; font-size: 14px; color: inherit; font-weight: 600;">响应耗时</h3>
 </div>
 <p style="margin: 0; font-size: 13px; color: inherit; opacity: 0.7;"><strong>POST 请求</strong>（<code style="background: rgba(255, 247, 230, 0.35); padding: 1px 6px; border-radius: 4px; color: #FA8C16;">application/json</code>）</p>
 <p style="margin: 0; font-size: 13px; color: inherit; opacity: 0.7;">必须在 <strong>3秒内</strong> 完成响应，否则系统会判定超时并丢弃该消息。</p>
 </div>

 <div style="background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 236, 202, 0.22) 100%); border: 1px solid rgba(255, 241, 214, 0.65); border-radius: 10px; padding: 16px; box-shadow: 0 2px 6px rgba(250, 140, 22, 0.06);">
 <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
 <span style="font-size: 18px;"></span>
 <h3 style="margin: 0; font-size: 14px; color: inherit; font-weight: 600;">响应内容</h3>
 </div>
 <p style="margin: 0; font-size: 13px; color: inherit; opacity: 0.7;">无需特定格式，直接返回<strong>空字符串</strong>或 HTTP 200 即可。</p>
 </div> 
 <div style="background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 236, 202, 0.22) 100%); border: 1px solid rgba(255, 241, 214, 0.65); border-radius: 10px; padding: 16px; box-shadow: 0 2px 6px rgba(250, 140, 22, 0.06);">
 <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
 <span style="font-size: 18px;"></span>
 <h3 style="margin: 0; font-size: 14px; color: inherit; font-weight: 600;">网络环境</h3>
 </div>
 <p style="margin: 0; font-size: 13px; color: inherit; opacity: 0.7;">必须发布在<strong>公网</strong>（第三方可访问）。测试环境建议使用内网穿透工具。</p>
 </div>
 <div style="background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 236, 202, 0.22) 100%); border: 1px solid rgba(255, 241, 214, 0.65); border-radius: 10px; padding: 16px; box-shadow: 0 2px 6px rgba(250, 140, 22, 0.06);">
 <div style="display: flex; align-items: center; gap: 8px; margin-bottom: 8px;">
 <span style="font-size: 18px;"></span>
 <h3 style="margin: 0; font-size: 14px; color: inherit; font-weight: 600;">消息范围</h3>
 </div>
 <p style="margin: 0; font-size: 13px; color: inherit; opacity: 0.7;">接收好友/群消息、手机端发送的消息；<strong>接口发送的消息不触发回调</strong>。</p>
 </div>
 </div>
</div>
<div style="margin-bottom: 20px;">
 <div style="display: flex; align-items: center; gap: 10px; margin-bottom: 14px;">
 <span style="font-size: 20px;"></span>
 <h2 style="margin: 0; font-size: 18px; color: inherit; font-weight: 600; border: none; padding-bottom: 0;">调试小贴士</h2>
 </div>

 <div style="display: flex; flex-direction: column; gap: 12px;">
 <div style="background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 236, 202, 0.18) 100%); border: 1px solid rgba(255, 241, 214, 0.65); border-radius: 10px; padding: 16px 18px; box-shadow: 0 2px 6px rgba(250, 140, 22, 0.06); display: flex; align-items: flex-start; gap: 12px;">
 <span style="background: #FA8C16; color: #fff; border-radius: 50%; min-width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;">1</span>
 <div>
 <h4 style="margin: 0 0 6px 0; font-size: 14px; color: inherit; font-weight: 600;">验证请求</h4>
 <p style="margin: 0; font-size: 13px; color: inherit; opacity: 0.85; line-height: 1.6;">配置成功后，系统会立即向您的接口发送一条包含 <code style="color: inherit; background: rgba(82, 196, 26, 0.2); border: 1px solid rgba(82, 196, 26, 0.35); padding: 2px 6px; border-radius: 4px; font-weight: bold;">验证回调地址是否可用</code> 的 JSON 数据。若收到此消息，说明配置成功。</p>
 </div>
 </div>

 <div style="background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 236, 202, 0.18) 100%); border: 1px solid rgba(255, 241, 214, 0.65); border-radius: 10px; padding: 16px 18px; box-shadow: 0 2px 6px rgba(250, 140, 22, 0.06); display: flex; align-items: flex-start; gap: 12px;">
 <span style="background: #FA8C16; color: #fff; border-radius: 50%; min-width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;">2</span>
 <div>
 <h4 style="margin: 0 0 6px 0; font-size: 14px; color: inherit; font-weight: 600;">排查失败</h4>
 <p style="margin: 0; font-size: 13px; color: inherit; opacity: 0.85; line-height: 1.6;">若提示「验证失败」，请先使用 <strong>Apifox</strong> 或 <strong>Postman</strong> 手动模拟 POST 请求，确认您的接口在公网环境下可以正常访问。</p>
 </div>
 </div>

 <div style="background: linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 236, 202, 0.18) 100%); border: 1px solid rgba(255, 241, 214, 0.65); border-radius: 10px; padding: 16px 18px; box-shadow: 0 2px 6px rgba(250, 140, 22, 0.06); display: flex; align-items: flex-start; gap: 12px;">
 <span style="background: #FA8C16; color: #fff; border-radius: 50%; min-width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0;">3</span>
 <div>
 <h4 style="margin: 0 0 6px 0; font-size: 14px; color: inherit; font-weight: 600;">打印日志</h4>
 <p style="margin: 0; font-size: 13px; color: inherit; opacity: 0.85; line-height: 1.6;">开发初期，建议直接打印请求的 <strong>Body</strong> 体，这是了解消息结构最快的方法。</p>
 </div>
 </div>
 </div>
</div>
<div style="background: rgba(82, 196, 26, 0.12); border: 1px solid rgba(82, 196, 26, 0.35); border-radius: 6px; padding: 12px 16px; margin-top: 16px;">
 <p style="margin: 0; font-size: 14px; color: #389E0D; font-weight: bold;"> 回调配置完成后，您可以在<a href="doc-9079961" style="color: #FA8C16; font-weight: bold;">调试指南</a>页面查看如何测试回调是否正常工作。</p>
</div>
 
