DingTalkSender class
发送的主类, 主要目的就是可以使用钉钉的机器人发送消息到群里
关于配置机器人可以查看文档
关于消息类型可以查看文档
使用示例如下
为简单, 就使用关键字字段, 如果有加签需求, 则传入 appsecret
final sender = DingTalkSender(
hookUrl: hookUrl,
keyword: keyword,
appsecret: appsecret,
);
final at = At(isAtAll: true);
await sender.sendText('1', at: at);
final markdown = '''
标题
# 一级标题
## 二级标题
### 三级标题
#### 四级标题
##### 五级标题
###### 六级标题
引用
> A man who stands for nothing will fall for anything.
文字加粗、斜体
**bold**
*italic*
链接
[this is a link](http://name.com)
图片
![](http://name.com/pic.jpg)
无序列表
- item1
- item2
有序列表
1. item1
2. item2
''';
final at2 = At(userIds: ['manager5664']);
await sender.sendMarkdown(markdown, at: at2);
Constructors
Properties
- appsecret → String?
-
加签, 有需求就传入
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hookUrl → String
-
webhook url
final
-
keywords
→ List<
String> -
关键字, 在软件的机器人里配置
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- throwErrorOnSendFail → bool
-
发送失败时, 是否 throw 错误信息, 默认不发送
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sendFeedCard(
{List< FeedAction> actions = const []}) → Future<void> - 发送 FeedCard 类型
-
sendLink(
{required String title, required String text, required String messageUrl, String? picUrl}) → Future< void> - 发送链接型
-
sendMarkdown(
{required String title, required String markdownText, At? at}) → Future< void> - 发送 markdown 文本
-
sendMultiActionCard(
{required String title, required String text, List< SingleAction> btns = const [], String? btnOrientation = '0'}) → Future<void> - 多按钮的卡片式
-
sendSingleActionCard(
{required String title, required String text, required String singleTitle, required String singleURL, String? btnOrientation}) → Future< void> - 整体的卡片式
-
sendText(
String text, {At? at}) → Future< void> - 发送纯文本
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited