Skip to content

应用管理

获取应用

获取指令的应用详情

go
agentID := 100003
WeComApp.Agent.Get(ctx,agentID)

获取access_token对应的应用列表

go
WeComApp.Agent.List(ctx)

微信官方文档

设置应用

go
options := &request.RequestAgentSet{
  AgentID:              100003,
  ReportLocationFlag:  0,
  LogoMediaID:         "j5Y8X5yocspvBHcgXMSS6z1Cn9RQKREEJr4ecgLHi4YHOYP-plvom-yD9zNI0vEl",
  Name:                 "财经助手",
  Description:          "内部财经服务平台",
  RedirectDomain:      "open.work.weixin.qq.com",
  IsReportEnter:        0,
  HomeUrl:             "https://open.work.weixin.qq.com",
}
WeComApp.Agent.Set(ctx,options)

微信官方文档

自定义菜单

创建菜单

go
options := &request.RequestMenuSet{
  Button: []request.RequestMenuSetButton{
    {
      Type: "click",
      Name: "今日歌曲",
      Key:  "V1001_TODAY_MUSIC",
    },
    {
      Name: "菜单",
      SubButton: []request.RequestMenuSetButton{
        {
          Type: "view",
          Name: "搜索",
          Url:  "http://www.soso.com/",
        },
        {
          Type: "click",
          Name: "赞一下我们",
          Key:  "V1001_GOOD",
        },
      },
    },
  },
}
WeComApp.Menu.Create(ctx,options)

微信官方文档

获取菜单

go
WeComApp.Menu.Get(ctx)

微信官方文档

删除菜单

go
agentID := 100003
WeComApp.Menu.Delete(ctx,agentID)

微信官方文档

设置工作台自定义展示

设置应用在工作台展示的模版

go
options := &request.RequestSetWorkbenchTemplate{
  AgentID: agentID,
  Type:    "image",
  Image: request.WorkBenchImage{
    Url:      "xxxx",
    JumpUrl:  "http://www.qq.com",
    PagePath: "pages/index",
  },
  ReplaceUserData: true,
}
WeComApp.AgentWorkbench.SetWorkbenchTemplate(ctx,options)

获取应用在工作台展示的模版

go
agentID := 1000005
WeComApp.AgentWorkbench.GetWorkbenchTemplate(ctx,agentID)

设置应用在用户工作台展示的数据

go
options := &request.RequestSetWorkBenchData{
  AgentID: 1000005,
  UserID:  "test",
  Type:    "keydata",
  KeyData: request.WorkBenchKeyData{
    Items: []request.WorkBenchKeyDataItem{
      {
        Key:      "待审批",
        Data:     "2",
        JumpUrl:  "http://www.qq.com",
        PagePath: "pages/index",
      },
      {
        Key:      "带批阅作业",
        Data:     "4",
        JumpUrl:  "http://www.qq.com",
        PagePath: "pages/index",
      },
      {
        Key:      "成绩录入",
        Data:     "45",
        JumpUrl:  "http://www.qq.com",
        PagePath: "pages/index",
      },
      {
        Key:      "综合评价",
        Data:     "98",
        JumpUrl:  "http://www.qq.com",
        PagePath: "pages/index",
      },
    },
  },
}
WeComApp.AgentWorkbench.SetWorkbenchData(ctx,options)

微信官方文档

修改设置工作台自定义开关事件推送

管理员在管理端应用详情页的自定义工作台页面启用或者停用自定义工作台模式时,会推送接收修改设置工作台自定义开关事件推送到应用的回调url上(如果是第三方应用为数据回调url)。事件推送处理过程详见接收消息与事件。(TODO:需要修改成docs url)

微信官方文档

使用示例

参考:PowerWechatTutorial

Released under the MIT license