1.首先创建一个群聊,并在群聊里面添加机器人
2.获取机器人对应的webhook地址,
具体参考:(链接里面很详细)
3.编辑后端代码:(此处已将text的内容去除)
async sendPointShopMessage(
packageNum: string,
user_id: number,
shop_order_id: number,
): Promise<any> {
const requestParam = {
msgtype: 'actionCard',
actionCard: {
title: `积分商品下单通知`,
text: `内容`,
btnOrientation: '0',
btns: [],
},
};
const dingTalkNotificationUrl =YOUR_WEBHOOK;
this.requestService.post(dingTalkNotificationUrl, requestParam);
}
4.最后就可以得到这样的推送: