jeessy2 / ddns-go

Simple and easy to use DDNS. Support Aliyun, Tencent Cloud, Dnspod, Cloudflare, Callback, Huawei Cloud, Baidu Cloud, Porkbun, GoDaddy, Namecheap, NameSilo...

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Webhook配置参考

jeessy2 opened this issue · comments

可把大家常用的Webhook通知分享出来,只分享,不提问,无关的将被删除

企业微信

下载企业微信→左上角三横杠→全新创建企业→个人组件团队(创建个人的企业群聊),
进入群聊添加 [群机器人] 复制机器人Webhook地址填入ddns-go后台Webhook URL地址栏。
在RequestBody栏填入回调函数,格式:

{ "msgtype": "markdown","markdown": { "content": "公网IP变更:\n 新IPV6地址:#{ipv6Addr} \n 已解析的域名:#{ipv6Domains} \n 域名更新结果:#{ipv6Result}" } }

饭碗警告

链接:https://fwalert.com (含 aff,注册后会赠送 10 元余额)

支持通过 邮件(0.02元/次)、短信(0.1元/次)、电话(0.2元/次)、Telegram(免费)、饭碗警告App(免费) 的方式推送通知。

先点击右上角头像选择“联系方式”并在此对你所希望的通知渠道进行绑定,然后进入“转发规则”,点击加号新建规则,其中触发方式选择 Webhook,可参照下图添加模板变量,并依据你所设置的模板变量来设置通知正文,最后联系方式选择先前绑定的通知渠道即可。
Snipaste_2022-07-29_10-32-35
Snipaste_2022-07-29_10-36-27
保存转发规则后会生成一个 Webhook 地址,将该地址后添加 ?result=#{ipv6Result}&addr=#{ipv6Addr}(此处等号前的变量需与前面设置的一致) 填入 ddns-go 后台 Webhook URL 地址栏并保持 RequestBody 留空即可。

企业微信{"msgtype": "markdown","markdown": {"content": "#### 你的公网IP变了 \n - IPV4地址:#{ipv4Addr} \n - 域名更新结果:#{ipv4Result} \n - IPV6地址:#{ipv6Addr}\n - 域名更新结果:#{ipv6Result} \n"}}

Apprise的邮箱推送

  1. apprise webhook url
    https://你的公网域名:端口/notify/你的密钥 就是一个webhook url
    "你的密钥"是自建的{key}或者token,可以换成任意一个
  2. 设置推送邮箱
    进入https://你的公网域名:端口/cfg/你的密钥 配置一下
    mailto://邮箱账号:授权码@qq.com?name=📢DDNS-GO
  3. 配置DDNS-GO
    在webhook url中填入第一步里的url
    在request body中填入:
    { "title":
    "公网IP变动了",
    "format":
    "html",
    "body":
    "新IPV4地址:#{ipv4Addr}
    已解析的域名:#{ipv4Domains}
    域名更新结果:#{ipv4Result}

    ------DDNS-GO------"}
    *其中的"title"、"type"、"format"、"body"都是apprise定义的,其中的#{ipv4Addr}、#{ipv4Domains}、#{ipv4Result}是DDNS-GO定义的

效果如图:
微信图片_20220920090907

我在ddns-go的webhook通知方面主要用的是“方糖”和“爱语飞飞”,两者都是在微信(个人版)上推送通知给我的。免费用户在方糖上每天可以推送5次,爱语飞飞现在好像还是免费不限次。我用得比较初级,在此只是告诉大家有这两个渠道。它们有没有其他推送方式,例如短信,邮件,丁丁等,我也没深入研究,可否实现更复杂的功能,我也没有研究。

commented

http://www.pushplus.plus/send?
请问下 这个直接get日志提示成功,但是收不到消息
post又无法识别到RequestBody的内容

Telegram

  • Webhook url
    https://api.telegram.org/bot{your token}/sendmessage
  • RequestBody
    {
       "chat_id":"{notify room id}",
       "text":"外網IP改變:\n新IPV4地址:#{ipv4Addr}\n域名更新结果:#{ipv4Result}"
    }
    
  • Result
    image
  • ntfy : 免费免注册可自建的多平台推送方案。

  • 使用官方/公共服务器,推荐以 uuid 为 topic :

    1. uuidgen : e056a473-c080-4f34-b49c-e62f9fcd1f9d
    2. URL :https://ntfy.sh/
    3. RequestBody :
    {
        "topic": "e056a473-c080-4f34-b49c-e62f9fcd1f9d",
        "message": "IPv4已变更:#{ipv4Addr},域名 #{ipv4Domains} 更新#{ipv4Result}",
        "title": "DDNS-GO Cloudflare 更新",
        "priority": 2,
        "actions": [{ "action": "view", "label": "管理界面", "url": "http://192.168.0.1:9876/" }]
    }
    1. 客户端添加订阅topic:e056a473-c080-4f34-b49c-e62f9fcd1f9d ,可设置别名。
  • 自建服务并且设置了认证:

    1. 生成auth参数(*nix命令):echo -n "Basic `echo -n '<user>:<pass>' | base64`" | base64 | tr -d '='(替换<user><pass>),请结合https加密url,详细请参考ntfy文档
    2. URL: https://ntfy.example.com/?auth=<上一步生成的base64 auth参数>
    3. RequestBody :
    {
        "topic": "ddns-go",
        "message": "IPv4已变更:#{ipv4Addr},域名 #{ipv4Domains} 更新#{ipv4Result}",
        "title": "DDNS-GO Cloudflare 更新",
        "priority": 2,
        "actions": [{ "action": "view", "label": "管理界面", "url": "http://192.168.0.1:9876/" }]
    }
    1. 客户端在设置里更改默认服务器为自建:https://ntfy.example.com/,设置用户名和密码,然后添加订阅topic:ddns-go
  • 推送效果
    ddnsgo-ntfy

  • https://api.telegram.org/bot{your token}/sendmessage

测试失败,返回内容: {"ok":false,"error_code":400,"description":"Bad Request: chat not found"} ,返回状态码: 400

Gotify

首先,登录到 Gotify 的 WebUI,点击 APPS -> CREATE APPLICATION 来创建 Token,得到 Token 后回到 ddns-go

然后,登录到 ddns-go,找到 Webhook,在 URL 处填入:

http://[IP]/message?token=[Token]

[IP] 替换为 Gotify 服务器的 IP,将 [Token] 替换为得到的 Token。

RequestBody 处填入:

{
	"title": "你的公网 IP 变了",
	"message": "IPv4 地址:#{ipv4Addr}\n域名更新结果:#{ipv4Result}",
        "priority": 5,
	"extras": {
		"client::display": {
			"contentType": "text/plain"
		}
	}
}

效果:
result

参考:

  1. Push messages · Gotify
  2. Message Extras · Gotify

像是使用本地搭建的通知服务(设置了证书),ddns访问内网地址会提示“无法验证由服务器提供的证书“,请问这个如何解决

像是使用本地搭建的通知服务(设置了证书),ddns访问内网地址会提示“无法验证由服务器提供的证书“,请问这个如何解决

通过添加选项 -skipVerify 跳过证书验证。

Syncology Chat 整合

http://localhost:5000/chat/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=AABBCC
payload={"text":"IPv6变了#{ipv6Addr},域名更新结果:#{ipv6Result}"}
commented

GO-CQHTTP机器人

http://ip:5700/send_msg?user_id=接收QQ号码&message= IPv6变了#{ipv6Addr},域名更新结果:#{ipv6Result}

Telegram

  • Webhook url
    https://api.telegram.org/bot{your token}/sendmessage
  • RequestBody
    {
       "chat_id":"{notify room id}",
       "text":"外網IP改變:\n新IPV4地址:#{ipv4Addr}\n域名更新结果:#{ipv4Result}"
    }
    
  • Result
    image

如果是内地的动态ip服务器,用香港服务器反代了tg的api应该怎样修改呢

commented

我在ddns-go的webhook通知方面主要用的是“方糖”和“爱语飞飞”,两者都是在微信(个人版)上推送通知给我的。免费用户在方糖上每天可以推送5次,爱语飞飞现在好像还是免费不限次。我用得比较初级,在此只是告诉大家有这两个渠道。它们有没有其他推送方式,例如短信,邮件,丁丁等,我也没深入研究,可否实现更复杂的功能,我也没有研究。

请教在ddnsgo具体配置iyuu的方法

http://www.pushplus.plus/send? 请问下 这个直接get日志提示成功,但是收不到消息 post又无法识别到RequestBody的内容

RequestBody里面需要传JSON

{
    "content": "xxxx"
}

apprise最新版header里要加一句这个
Content-Type: application/json
不然没法识别

NoneBot+plugin to QQ or other

To QQ

  • Webhook url
    http://127.0.0.1:8080/report
  • RequestBody
{
    "token": "REPORT_TOKEN",
    "title": "你的公网IP变了",
    "content": "\n ipv4是:#{ipv4Addr}  \n 域名更新结果:#{ipv4Result}  \n 更新的域名是:#{ipv4Domains}",
    "send_to": "QQ"
}
  • Result
    image

Telegram测试成功,不是用楼上的方案,填写{your token}和,{your id},要把{}去掉
URL:https://api.telegram.org/bot{your token}/sendMessage?chat_id={your id}&text=IPV4变更#{ipv4Result},IPV6变更#{ipv6Result},注意看下QQ和Wechat是否能上网

飞书的配置

{"msg_type": "post","content": {"post": {"zh_cn": {"title": "你的公网IP变了","content": [[{"tag": "text","text": "IPv4地址:#{ipv4Addr}"}] , [{"tag": "text","text": "域名更新结果:#{ipv4Result}"}],[{"tag": "text","text": "IPv6地址:#{ipv6Addr}"}] , [{"tag": "text","text": "域名更新结果:#{ipv6Result}"}]]}}}}

图片

请教在ddnsgo具体配置iyuu的方法
https://iyuu.cn/【token】.send?title=你的公网IP变了&desp=主人IPv4变了#{ipv4Addr} , 域名更新结果:#{ipv4Result}

请教在ddnsgo具体配置iyuu的方法
https://iyuu.cn/【token】.send?title=你的公网IP变了&desp=主人IPv4变了#{ipv4Addr} , 域名更新结果:#{ipv4Result}

需要把title改为text,没有title这个参数了

commented

Telegram测试成功,不是用楼上的方案,填写{your token}和,{your id},要把{}去掉

URL:https://api.telegram.org/bot{your token}/sendMessage?chat_id={your id}&text=IPV4变更#{ipv4Result},IPV6变更#{ipv6Result},注意看下QQ和Wechat是否能上网

是不是失效了,我用不行提示404

使用CF 反代TG api,通知自建BOT

新建CF Workers,填入以下内容,并使用自定义域

const tg_host = "api.telegram.org";
addEventListener('fetch', event => {
    event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
    var u = new URL(request.url);
    u.host = tg_host;
    var req = new Request(u, {
        method: request.method,
        headers: request.headers,
        body: request.body
    });
    const result = await fetch(req);
    return result;
}
  • 例如:你的自定义域www.tiktok.com,那么api.telegram.org=www.tiktok.com

自建BOT

DDNS-GOWebhook填写

  • URL:
# 注意:bot后直接接Token,没有其它符号
https://www.tiktok.com/bot<自建BOT Token>/sendmessage
  • RequestBody:
{
  "chat_id": "你自己的UserID",
  "text": "主人!您的 IP 有变化\n\nIPv4: #{ipv4Result}\nIP: #{ipv4Addr}\n域名: telegram.org\n\nIPv6: #{ipv6Result}\nIP: #{ipv6Addr}\n域名: telegram.org"
}
image

用文本格式可在微信中直接看
Webhook地址填入ddns-go后台Webhook URL地址栏。 在RequestBody栏填入回调函数,格式:

{ "msgtype": "text","text": {"content": "公网IP变更:\n 新IP地址:#{ipv4Addr} \n 已解析的域名:#{ipv4Domains} \n 域名更新结果:#{ipv4Result} \n 新IP地址:#{ipv6Addr} \n 已解析的域名:#{ipv6Domains} \n 域名更新结果:#{ipv6Result}" } }" } }

Screenshot_2023-12-12-14-02-02-546_com.tencent.mm.png

webhook在slack上怎么配置?一直配置不好。

Slack配置webhook:
捕获
先去这个位置把webhook url复制下来。
RequestBody填写:
{"text": "您的公网IP已经变化:\n\n 新IPV4地址:#{ipv4Addr} \n 已解析的域名:#{ipv4Domains} \n 域名更新结果:#{ipv4Result} \n\n 新IPV6地址:#{ipv6Addr} \n 已解析的域名:#{ipv6Domains} \n 域名更新结果:#{ipv6Result}" }
Headers填写:
'Content-Type': 'application/json'

企业微信:

{ "msgtype": "markdown","markdown": { "content": "**公网IP变更:**\n >域名更新结果:<font color=\"warning\">#{ipv4Result}</font> \n>新ipv4地址:<font color=\"comment\">#{ipv4Addr}</font> \n>已解析的域名:<font color=\"comment\">#{ipv4Domains}</font>" } }

Screenshot_2024-01-20-18-12-45-773_com tencent we

钉钉

{
    "msgtype": "markdown",
    "markdown": {
        "title": "您的公网IP已变更:",
        "text": "**公网IP已变更:**  \n ------IPv4------  \n 域名更新结果:**<font color=\"warning\">#{ipv4Result}</font>**  \n 新IPV4地址:#{ipv4Addr}  \n 已解析的域名:#{ipv4Domains}  \n ------IPv6------  \n 域名更新结果:**<font color=\"warning\">#{ipv6Result}</font>**  \n 新IPv6地址:#{ipv6Addr}  \n 已解析的域名:#{ipv6Domains}  \n ------DDNS-GO------\n"
    }
}

PixPin_2024-01-20_22-30-03

用文本格式可在微信中直接看 Webhook地址填入ddns-go后台Webhook URL地址栏。 在RequestBody栏填入回调函数,格式:

{ "msgtype": "text","text": {"content": "公网IP变更:\n 新IP地址:#{ipv4Addr} \n 已解析的域名:#{ipv4Domains} \n 域名更新结果:#{ipv4Result} \n 新IP地址:#{ipv6Addr} \n 已解析的域名:#{ipv6Domains} \n 域名更新结果:#{ipv6Result}" } }" } }

Screenshot_2023-12-12-14-02-02-546_com.tencent.mm.png

在微信中怎么看啊

使用CF 反代TG api,通知自建BOT

新建CF Workers,填入以下内容,并使用自定义域

const tg_host = "api.telegram.org";
addEventListener('fetch', event => {
    event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
    var u = new URL(request.url);
    u.host = tg_host;
    var req = new Request(u, {
        method: request.method,
        headers: request.headers,
        body: request.body
    });
    const result = await fetch(req);
    return result;
}
  • 例如:你的自定义域www.tiktok.com,那么api.telegram.org=www.tiktok.com

自建BOT

DDNS-GOWebhook填写

  • URL:
# 注意:bot后直接接Token,没有其它符号
https://www.tiktok.com/bot<自建BOT Token>/sendmessage
  • RequestBody:
{
  "chat_id": "你自己的UserID",
  "text": "主人!您的 IP 有变化\n\nIPv4: #{ipv4Result}\nIP: #{ipv4Addr}\n域名: telegram.org\n\nIPv6: #{ipv6Result}\nIP: #{ipv6Addr}\n域名: telegram.org"
}
image

这个是不能用了吗,ddnsgo上webhook模拟测试总是有问题 Webhook调用失败! 异常信息:返回内容: error code: 522 ,返回状态码: 522

WxPusher

URL: https://wxpusher.zjiecode.com/api/send/message
RequestBody:

{
  "appToken":"AT_xxx", //填入 AppToken
  "content":"新的 IPv4 地址: #{ipv4Addr}\n影响域名: #{ipv4Domains}\n更新结果: #{ipv4Result}\n新的 IPv6 地址: #{ipv6Addr}\n影响域名: #{ipv6Domains}\n更新结果: #{ipv6Result}",
  "summary":"IPv4: #{ipv4Addr} #{ipv4Result} | IPv6: #{ipv6Addr} #{ipv6Result}",
  "contentType":1,
  "topicIds":[
      114514 //填入 TopicID
  ]
}

gotify 自建的多平台推送方案。

URL: http://x.x.x.x.:port/message?token=AXWpiJam7V_rSwW
RequestBody: 为json格式
{
"title": "公网IP变动了",
"message": "新IPV4地址:#{ipv4Addr}\n已解析的域名:#{ipv4Domains}\n域名更新结果:#{ipv4Result}\n\n 新IPV6地址:#{ipv6Addr}\n已解析的域名:#{ipv6Domains}\n域名更新结果:#{ipv6Result}\n\n------DDNS-GO-----"
}

企业微信

下载企业微信→左上角三横杠→全新创建企业→个人组件团队(创建个人的企业群聊), 进入群聊添加 [群机器人] 复制机器人Webhook地址填入ddns-go后台Webhook URL地址栏。 在RequestBody栏填入回调函数,格式:

{ "msgtype": "markdown","markdown": { "content": "公网IP变更:\n 新IPV6地址:#{ipv6Addr} \n 已解析的域名:#{ipv6Domains} \n 域名更新结果:#{ipv6Result}" } }

2024/03/02 17:48:16 Webhook called successfully! Response body: {"errcode":0,"errmsg":"ok. WARNING: invalid character after json. "}
消息是推送过来了,但是日志里面显示错误
Screenshot 2024-03-02 at 17 49 08

企业微信

下载企业微信→左上角三横杠→全新创建企业→个人组件团队(创建个人的企业群聊), 进入群聊添加 [群机器人] 复制机器人Webhook地址填入ddns-go后台Webhook URL地址栏。 在RequestBody栏填入回调函数,格式:

{ "msgtype": "markdown","markdown": { "content": "公网IP变更:\n 新IPV6地址:#{ipv6Addr} \n 已解析的域名:#{ipv6Domains} \n 域名更新结果:#{ipv6Result}" } }

2024/03/02 17:48:16 Webhook called successfully! Response body: {"errcode":0,"errmsg":"ok. WARNING: invalid character after json. "} 消息是推送过来了,但是日志里面显示错误 屏幕截图 2024-03-02 at 17 49 08

把填写的Webhook放到 在线json网站 中,如果报错就肯定是你填的Webhook不对,有语法错误

企业微信 - 机器人

创建企业内部群聊,进入群聊,右上角三个点->群机器人->添加 [群机器人],复制机器人Webhook地址填入ddns-go后台Webhook URL地址栏,在RequestBody栏填入回调函数,

RequestBody格式:
{ "msgtype": "text", "text": { "content": "°o.O【公网IP变更通知】O.o°
⋆⌁⌁⌁⋆⌁⌁❤︎⌁⌁⌁⋆⌁⌁⌁❤︎⌁⌁⋆⌁⌁⌁⋆
IPv4:#{ipv4Addr}
域名:#{ipv4Domains}
结果:解析#{ipv4Result}
𓆟𓆜𓆞𓆝𓆟𓆜𓆞𓆝𓆟𓆜
IPv6:#{ipv6Addr}
域名:#{ipv6Domains}
结果:解析#{ipv6Result}" } }

预览图:
微信图片_20240304201536

用的方糖(Server酱),示例中只是推送title,把Body也一起加进去了:
https://sctapi.ftqq.com/Token.send?title=公网IP更新了&desp=新的IPv4地址<#{ipv4Addr}>,已解析域名<#{ipv4Domains}>,IPv4域名更新结果<#{ipv4Result}>。新的IPv6地址<#{ipv6Addr}>,已解析域名<#{ipv6Domains}>,IPv6域名更新结果<#{ipv6Result}>。
预览图:
8e1bff93aacf5536c171b8f126ffbfe

{ "msgtype": "text", "text": { "content": "🍯🍯【公网IP变更通知】🍯🍯
🚞🚃🚃🚃💨
IPv4地址:#{ipv4Addr}
已解析域名:#{ipv4Domains}
IPv4更新结果:#{ipv4Result}
𓆟𓆜𓆞𓆝𓆟𓆜𓆞𓆝𓆟𓆜
IPv6地址:#{ipv6Addr}
已解析域名:#{ipv6Domains}
IPv6更新结果:#{ipv6Result}" } }
20240425-222825

pushdeer


URL: https://api2.pushdeer.com/message/push?pushkey=yourkey

RequestBody:

{
    "title": "你的公网IP变了",
    "text": "\n ipv4是:#{ipv4Addr}  \n 域名更新结果:#{ipv4Result}  \n 更新的域名是:#{ipv4Domains}",
    "type": "markdown"
}

使用CF 反代TG api,通知自建BOT

新建CF Workers,填入以下内容,并使用自定义域

const tg_host = "api.telegram.org";
addEventListener('fetch', event => {
    event.respondWith(handleRequest(event.request))
})
async function handleRequest(request) {
    var u = new URL(request.url);
    u.host = tg_host;
    var req = new Request(u, {
        method: request.method,
        headers: request.headers,
        body: request.body
    });
    const result = await fetch(req);
    return result;
}
  • 例如:你的自定义域www.tiktok.com,那么api.telegram.org=www.tiktok.com

自建BOT

DDNS-GOWebhook填写

  • URL:
# 注意:bot后直接接Token,没有其它符号
https://www.tiktok.com/bot<自建BOT Token>/sendmessage
  • RequestBody:
{
  "chat_id": "你自己的UserID",
  "text": "主人!您的 IP 有变化\n\nIPv4: #{ipv4Result}\nIP: #{ipv4Addr}\n域名: telegram.org\n\nIPv6: #{ipv6Result}\nIP: #{ipv6Addr}\n域名: telegram.org"
}
image

现在主要问题是域名被qiang, 用这个方案可以解决

anpush
可以推送至
image
免费账户,每天30条
post请求:
curl --location --request POST 'https://api.anpush.com/push/your_token'
--header 'Content-Type: application/x-www-form-urlencoded'
--data-urlencode 'title=your_title'
--data-urlencode 'content=your_content'
--data-urlencode 'channel=your_channel'

get请求:
curl --location --request GET 'https://api.anpush.com/push/your_token?title=your_title&content=your_content&channel=your_channel'

image

支持markdown格式的消息内容

image

用文本格式可在微信中直接看
Webhook地址填入ddns-go后台Webhook URL地址栏。 在RequestBody栏填入回调函数,格式:

我目前也是这样做的,只能使用text格式,markdown的话,个人微信看不了,只能跳转到企业微信,你有什么办法不

用文本格式可在微信中直接看
Webhook地址填入ddns-go后台Webhook URL地址栏。 在RequestBody栏填入回调函数,格式:

我目前也是这样做的,只能使用text格式,markdown的话,个人微信看不了,只能跳转到企业微信,你有什么办法不

企业微信中拉入个人微信号

24年最新使用CF 反代TG api,通知自建BOT

新建CF Workers,填入以下内容,并使用自定义域

/**
 * Helper functions to check if the request uses
 * corresponding method.
 *
 */
const Method = (method) => (req) => req.method.toLowerCase() === method.toLowerCase();
const Get = Method('get');
const Post = Method('post');

const Path = (regExp) => (req) => {
	const url = new URL(req.url);
	const path = url.pathname;
	return path.match(regExp) && path.match(regExp)[0] === path;
};

/*
 * The regex to get the bot_token and api_method from request URL
 * as the first and second backreference respectively.
 */
const URL_PATH_REGEX = /^\/bot(?<bot_token>[^/]+)\/(?<api_method>[a-z]+)/i;

/**
 * Router handles the logic of what handler is matched given conditions
 * for each request
 */
class Router {
	constructor() {
		this.routes = [];
	}

	handle(conditions, handler) {
		this.routes.push({
			conditions,
			handler,
		});
		return this;
	}

	get(url, handler) {
		return this.handle([Get, Path(url)], handler);
	}

	post(url, handler) {
		return this.handle([Post, Path(url)], handler);
	}

	all(handler) {
		return this.handler([], handler);
	}

	route(req) {
		const route = this.resolve(req);

		if (route) {
			return route.handler(req);
		}

		const description = 'No matching route found';
		const error_code = 404;

		return new Response(
			JSON.stringify({
				ok: false,
				error_code,
				description,
			}),
			{
				status: error_code,
				statusText: description,
				headers: {
					'content-type': 'application/json',
				},
			}
		);
	}

	/**
	 * It returns the matching route that returns true
	 * for all the conditions if any.
	 */
	resolve(req) {
		return this.routes.find((r) => {
			if (!r.conditions || (Array.isArray(r) && !r.conditions.length)) {
				return true;
			}

			if (typeof r.conditions === 'function') {
				return r.conditions(req);
			}

			return r.conditions.every((c) => c(req));
		});
	}
}

/**
 * Sends a POST request with JSON data to Telegram Bot API
 * and reads in the response body.
 * @param {Request} request the incoming request
 */
async function handler(request) {
	// Extract the URl method from the request.
	const { url, ..._request } = request;

	const { pathname: path, search } = new URL(url);

	// Leave the first match as we are interested only in backreferences.
	const { bot_token, api_method } = path.match(URL_PATH_REGEX).groups;

	// Build the URL
	const api_url = 'https://api.telegram.org/bot' + bot_token + '/' + api_method + search;

	// Get the response from API.
	const response = await fetch(api_url, _request);

	const result = await response.text();

	const res = new Response(result, _request);

	res.headers.set('Content-Type', 'application/json');

	return res;
}

/**
 * Handles the incoming request.
 * @param {Request} request the incoming request.
 */
async function handleRequest(request) {
	const r = new Router();
	r.get(URL_PATH_REGEX, (req) => handler(req));
	r.post(URL_PATH_REGEX, (req) => handler(req));

	const resp = await r.route(request);
	return resp;
}

/**
 * Hook into the fetch event.
 */
addEventListener('fetch', (event) => {
	event.respondWith(handleRequest(event.request));
});

什么都不要动直接复制粘贴进去。其他步骤和以前一直。

然后添加workers的路由,指向这个workers。

也可以不做。

### 这个地址需要外网访问
https://api.telegram.org/bot<bot的token>/sendMessage?chat_id=<tg用户的id>&text=<发送内容>
### 这个地址在国内就可以访问
https://tg.你的域名/bot<bot的token>/sendMessage?chat_id=<tg用户的id>&text=<发送内容>

QQ机器人LLOneBot

LLOneBot如何安装,自己看: https://llonebot.github.io/

LLOneBot下载: 需要版本QQNT
https://github.com/super1207/install_llob/releases/download/0.0.4/llob_install.exe

然后启用HTTP 默认3000端口

QQ截图20240702140341

在DDNS-GO如下写就行了 user_id 写需要发送消息的QQ号

URL:http://localhost:3000/send_private_msg?user_id=QQ号

RequestBody:
{"message": "公网IP变更:\n\n域名更新结果:#{ipv6Result} \n\n新IPV6地址:#{ipv6Addr} \n\n已解析的域名:#{ipv6Domains} "}

QQ截图20240702135657

以下就是享有效果:
QQ截图20240702140928
4079140467B81444FC84D0CB8EE34C88