17 lines
495 B
TypeScript
17 lines
495 B
TypeScript
export const sendUser = async (accessToken: string) => {
|
|
const data = {
|
|
touser: 'omcvy7AHC6bAA0QM4x9_bE0fGD1g',
|
|
msgtype: 'text',
|
|
text: {
|
|
content: 'Hello World',
|
|
},
|
|
};
|
|
const url = 'https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN';
|
|
const link = url.replace('ACCESS_TOKEN', accessToken);
|
|
const res = await fetch(link, {
|
|
method: 'POST',
|
|
body: JSON.stringify(data),
|
|
}).then((res) => res.json());
|
|
console.log('res', res);
|
|
};
|