sendTextToWeixinWebhooks function
发送文本到企业微信
Implementation
Future<bool> sendTextToWeixinWebhooks(String text, String hookUrl) async {
final dio = Dio();
final response = await dio.post(
hookUrl,
options: Options(headers: {
'Content-Type': 'application/json',
}),
data: json.encode({
'msgtype': 'text',
'text': {'content': text},
}),
);
final status = response.statusCode;
if (status != 200) {
logger.log('企业微信发送失败', status: LogStatus.error);
return false;
}
return true;
}