当前位置: 首页 > news >正文

山东工商网上服务大厅优化建站seo门户

山东工商网上服务大厅,优化建站seo门户,韩国优秀平面设计网站有哪些,深圳短视频seo教程目标是开发一个简易机器人,能接收消息并作出回复。 获取企业 ID 企业信息页面链接地址:https://work.weixin.qq.com/wework_admin/frame#profile 自建企业微信机器人 配置机器人应用详情 功能配置 接收消息服务器配置 配置消息服务器配置 配置环境变量…

目标是开发一个简易机器人,能接收消息并作出回复。

获取企业 ID

企业信息页面链接地址:https://work.weixin.qq.com/wework_admin/frame#profile

在这里插入图片描述

自建企业微信机器人

在这里插入图片描述

配置机器人应用详情

在这里插入图片描述

功能配置

在这里插入图片描述

接收消息服务器配置

配置消息服务器配置

在这里插入图片描述

配置环境变量

获取 agentId 和 Secret 信息
在这里插入图片描述

创建 .env 配置文件配置企业微信机器人应用的配置信息

corpId=
corpSecret=
agentId=

发送应用消息配置

配置应用消息:https://developer.work.weixin.qq.com/document/path/90236

请求方式POST(HTTPS)
请求地址https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=ACCESS_TOKEN

机器人应用支持推送文本、图片、视频、文件、图文等类型。

配置 POST 请求参数
在这里插入图片描述
config.js 配置

const request = require('request')
const { config } = require('dotenv')
config()const corpId = process.env.corpId
const corpSecret = process.env.corpSecret
const agentId = parseInt(process.env.agentId)
const toUser = '@all'const tokenUrl = `https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=${corpId}&corpsecret=${corpSecret}`
const sendMsgUrl = "https://qyapi.weixin.qq.com/cgi-bin/message/send?access_token=";function getToken(success, error) {request(tokenUrl, function(error, response, body) {if (!error && response.statusCode == 200) {var json = JSON.parse(body);console.log(json)success(json.access_token)} else {error('Token in error.')}})
}function sendMessage(token, content) {const requestData = {touser: toUser,msgtype: "text",agentid: agentId,safe: 0,text: {content: content}}request({url: `${sendMsgUrl}${token}`,method: "POST",json: true,headers: {"content-type": "application/json",},body: requestData}, function(error, response, body) {console.log(body)if (!error && response.statusCode == 200) {}});
}function sendText(content) {getToken((token) => {sendMessage(token, content)}, (error) => {console.log(error)})
}module.exports = {sendText,
}

定时发送任务

npm 下载 node-schedule 定时任务模块

npm install node-schedule

配置定时发送任务

const alarmWechat = require('./config.js')
const schedule = require('node-schedule')const scheduleTask = ()=> {schedule.scheduleJob('30 * * * * *',() =>{console.log('scheduleCronstyle:' + new Date());alarmWechat.sendText('testmessage')}); 
}scheduleTask();

开发者调试工具

在这里插入图片描述

http://www.yidumall.com/news/4225.html

相关文章:

  • 做网站维护难吗抖音营销推广怎么做
  • 什么网站做污水处理药剂的好武汉网站seo德升
  • 做国外百科知识网站百度竞价专员
  • 如何在网站中做公示信息免费创建网站软件
  • wordpress建手机站精准客源app
  • 本溪做网站的公司高级搜索技巧
  • 服务网站运营方案广州seo关键词优化是什么
  • 网站营销设计百度信息流推广教程
  • 邢台哪个公司做网站好服务推广软文范例
  • 孝感市网站建设宁波建站模板系统
  • 现在做网站开发网店推广的方式
  • 遵义县住房和城乡建设局网站网络营销型网站
  • 国务院 政府网站建设要求seo关键词查询工具
  • 黄色网站开发会阿森纳英超积分
  • 电脑哪个网站可以做公务员试题营销模式100个经典案例
  • 企业网站备案 名称成都做整站优化
  • 珠海疫情最新消息公布福州seo服务
  • 福州网站制网络营销的发展趋势
  • 创业做网站 优帮云最近几天的重大新闻事件
  • 黄石网站设计岳阳网站建设推广
  • 做外贸网站平台宁波seo网络推广代理公司
  • 换个网站对seo有什么影响长沙百度快速优化
  • 网站正在升级建设中代码百度服务中心人工客服
  • eclipse 开发jsp网站开发seo托管服务
  • 黄岛网站建设多少钱网络推广站
  • 贵州网站制作设计公司哪家好口碑营销的前提及好处有哪些?
  • 凡科建站代理平台整合营销沟通
  • wordpress如何使用cdnseo引擎搜索
  • 怎样利用网站做自己的链接最新域名查询
  • 找个网站开发的师傅怎么注册网址