企业微信效率工具的使用(一)

455 阅读24分钟

前提条件

需要获取access_token

  • 请求方式: GET(HTTPS)

  • 请求地址: qyapi.weixin.qq.com/cgi-bin/get…

  • 参数说明:

    • corpid:必填项,企业ID
    • corpsecret:必填项应用的凭证密钥

需要获取企业微信用户的userid

获取userid步骤:

  1. 获取部门列表

    • 请求方式:GET(HTTPS)

    • 请求地址:qyapi.weixin.qq.com/cgi-bin/dep…

    • 参数说明:

      • access_token:必填项,调用接口凭证
      • id:非必填项,部门id。获取指定部门及其下的子部门(以及及子部门的子部门等等,递归)。如果不填,默认获取全量组织架构
  2. 获取部门成员id

    • 请求方式:GET(HTTPS)

    • 请求地址:qyapi.weixin.qq.com/cgi-bin/use…

    • 参数说明:

      • access_token:必填项,调用接口凭证
      • department_id:必填项,获取的部门id
      • fetch_child:非必填项,是否递归获取子部门下面的成员:1-递归获取,0-只获取本部门

日程

概述

企业通过日程相关接口,可以很方便的将企业已有系统的会议、日程或提醒,同步到企业微信日历本

日历,即日历本,是日程事件的集合。日历有一些基本的属性,如日历名称、描述、共享成员,颜色等。可以存在多个日历。

日程,日程是一个在某个时间或时间段发生的事件。一个日程有以下信息:主题、开始与结束时间、描述、地点、提醒时间、参与者等。一个日历可以添加多个日程。

配置可使用日程的应用

系统应用“日程”可直接调用日程相关接口,其他应用若要使用,需配置使用权限。

  • 自建应用。管理员登录企业微信管理端,应用管理->应用->日程,配置“可调用接口的应用”
  • 第三方应用。第三方服务商创建应用的时候,需要开启“日程接口权限”

注意事项

  • 企业微信需要更新到3.0.2及以上版本
  • 日历/日程不可跨应用操作
  • 日历/日程的组织者或共享成员需在应用的可见范围内
  • 每个应用每天最多能创建10000个日历,10000个日程
  • 用户在应用创建的日历上创建的日程,应用可以读取,但不可更改或删除

日历接口

创建日历

用于通过应用在企业内创建一个日历。

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/oa/…

请求参数:

 
 {
   "calendar" : {
     "organizer" : "serendipity",
     "readonly" : 1,
     "set_as_default" : 1,
     "summary" : "test_summary",
     "color" : "#FF3030",
     "description" : "test_describe",
     "shares" : [
       {
         "userid" : "serendipity",
         "readonly" : 1
       },
     ]
   },
   "agentid" : 3010084
 }

参数说明:

参数是否必须说明
calendar日历信息
organizer指定的组织者userid。注意该字段指定后不可更新
readonly日历组织者对日历是否只读权限(即不可编辑日历,不可在日历上添加日程,仅可作为组织者删除日历)。 0-否;1-是。默认为1,即只读
set_as_default是否将该日历设置为组织者的默认日历。 0-否;1-是。默认为0,即不设为默认日历 第三方应用不支持使用该参数
summary日历标题。1 ~ 128 字符
color日历在终端上显示的颜色,RGB颜色编码16进制表示,例如:”#0000FF” 表示纯蓝色
description日历描述。0 ~ 512 字符
shares日历共享成员列表。最多2000人
shares.userid日历共享成员的id
shares.readonly共享成员对日历是否只读权限(即不可编辑日历,不可在日历上添加日程,仅可以退出日历)。 0-否;1-是。默认为1,即只读
agentid授权方安装的应用agentid。仅旧的第三方多应用套件需要填此参数

返回结果

 {
     "errcode": 0,
     "errmsg": "ok. Warning: wrong json format. ",
     "cal_id": "wcL6acEQAA7o7O-bat4XqYxNL9Fup15w"
 }

参数说明:

参数说明
cal_id日历ID

更新日历

用于修改指定日历的信息。

更新操作是覆盖式,而不是增量式

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/oa/…

请求参数:

 {
     "calendar" : {
         "cal_id":"wcL6acEQAA7o7O-bat4XqYxNL9Fup15w",
         "readonly" : 1,
         "summary" : "test_summary",
         "color" : "#0000FF",
         "description" : "test_describe_1",
         "shares" : [
             {
                 "userid" : "MoDaoBuXiaoHun",
                 "readonly" : 1
             }
         ]
     }
 }

注意:不能更新组织者

参数说明:

参数是否必须说明
calendar日历信息
cal_id日历ID
readonly日历组织者对日历是否只读权限(即不可编辑日历,不可在日历上添加日程,仅可作为组织者删除日历)。 0-否;1-是。默认为1,即只读
summary日历标题。1 ~ 128 字符
color日历颜色,RGB颜色编码16进制表示,例如:”#0000FF” 表示纯蓝色
description日历描述。0 ~ 512 字符
shares日历共享成员列表。最多2000人
shares.userid日历共享成员的id
shares.readonly共享成员对日历是否只读权限(即不可编辑日历,不可在日历上添加日程,仅可以退出日历)。 0-否;1-是。默认为1,即只读

返回结果

 {
     "errcode": 0,
     "errmsg": "ok"
 }

获取日历详情

用于获取应用在企业内创建的日历信息。

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/oa/…

请求参数:

 { 
     "cal_id_list": ["wcL6acEQAA7o7O-bat4XqYxNL9Fup15w"]
 }

参数说明:

参数是否必须说明
cal_id_list日历ID列表,调用创建日历接口后获得。一次最多可获取1000条

返回结果

 {
     "errcode": 0,
     "errmsg": "ok",
     "calendar_list": [
         {
             "cal_id": "wcL6acEQAA7o7O-bat4XqYxNL9Fup15w",
             "organizer": "serendipity",
             "summary": "test_summary",
             "color": "#FF00FF",
             "description": "test_describe_1",
             "shares": [
                 {
                     "userid": "MoDaoBuXiaoHun",
                     "readonly": 1
                 }
             ],
             "readonly": 1
         }
     ]
 }

参数说明:

参数说明
calendar_list日历列表
cal_id日历ID
organizer指定的组织者userid
readonly日历组织者对日历是否只读权限。0-否;1-是;
summary日历标题。1 ~ 128 字符
color日历颜色,RGB颜色编码16进制表示,例如:”#0000FF” 表示纯蓝色
description日历描述。0 ~ 512 字符
shares日历共享成员列表。最多2000人
shares.userid日历共享成员的id
shares.readonly共享成员对日历是否只读权限。0-否;1-是;

删除日历

用于删除指定日历。

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/oa/…

请求参数:

 { 
     "cal_id":"wcL6acEQAA7o7O-bat4XqYxNL9Fup15w"
 }

参数说明:

参数是否必须说明
cal_id日历ID

返回结果

 { 
     "errcode": 0,
     "errmsg" : "ok"
 }

日程接口

创建日程

用于在日历中创建一个日程。

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/oa/…

请求参数

 {
   "schedule": {
     "organizer": "serendipity",
     "start_time": 1629252000,
     "end_time": 1629255600,
     "attendees": [{
       "userid": "serendipity"
     }],
     "summary": "日程测试",
     "description": "1.0日程测试",
     "reminders": {
       "is_remind": 1,
       "remind_before_event_secs": 3600,
       "is_repeat": 0,
       "repeat_until": 0,
       "is_custom_repeat": 0,
       "timezone" : +8
     },
     "location": "10楼1005会议室",
     "cal_id": "wcL6acEQAAo6Dd-Z2Eq99x0y4x7mzrlA"
   },
   "agentid": 3010084
 }

参数说明

参数必须类型说明
access_tokenstring调用接口凭证
scheduleobj日程信息
schedule.attendeesobj[]日程参与者列表。最多支持2000人
schedule.attendees.useridstring日程参与者ID 不多于64字节
schedule.summarystring日程标题。0 ~ 128 字符。不填会默认显示为“新建事件”
schedule.descriptionstring日程描述 不多于512个字符
schedule.remindersobj提醒相关信息
schedule.reminders.is_remindint32是否需要提醒。0-否;1-是
schedule.reminders.is_repeatint32是否重复日程。0-否;1-是
schedule.reminders.remind_before_event_secsuint32日程开始(start_time)前多少秒提醒,当is_remind为1时有效。 例如: 300表示日程开始前5分钟提醒。目前仅支持以下数值: 0 - 事件开始时 300 - 事件开始前5分钟 900 - 事件开始前15分钟 3600 - 事件开始前1小时 86400 - 事件开始前1天
schedule.reminders.repeat_typeuint32重复类型,当is_repeat为1时有效。目前支持如下类型: 0 - 每日, 1 - 每周, 2 - 每月, 5 - 每年, 7 - 工作日
schedule.reminders.repeat_untiluint32重复结束时刻,Unix时间戳。不填或填0表示一直重复
schedule.reminders.is_custom_repeatuint32是否自定义重复。0-否;1-是
schedule.reminders.repeat_intervaluint32重复间隔 仅当指定为自定义重复时有效 该字段随repeat_type不同而含义不同 例如: repeat_interval指定为3,repeat_type指定为每周重复,那么每3周重复一次; repeat_interval指定为3,repeat_type指定为每月重复,那么每3个月重复一次
schedule.reminders.repeat_day_of_weekuint32[]每周周几重复 仅当指定为自定义重复且重复类型为每周时有效 取值范围:1 ~ 7,分别表示周一至周日
schedule.reminders.repeat_day_of_monthuint32[]每月哪几天重复 仅当指定为自定义重复且重复类型为每月时有效 取值范围:1 ~ 31,分别表示1~31号
schedule.reminders.timezoneuint32时区。UTC偏移量表示(即偏离零时区的小时数),东区为正数,西区为负数。 例如:+8 表示北京时间东八区 默认为北京时间东八区 取值范围:-12 ~ +12
schedule.locationstring日程地址 不多于128个字符
schedule.organizerstring组织者 不多于64字节
schedule.start_timeuint32日程开始时间,Unix时间戳
schedule.end_timeuint32日程结束时间,Unix时间戳
schedule.cal_idstring日程所属日历ID。该日历必须是access_token所对应应用所创建的日历。 注意,这个日历必须是属于组织者(organizer)的日历; 如果不填,那么插入到组织者的默认日历上。 第三方应用必须指定cal_id 不多于64字节
agentiduint32授权方安装的应用agentid。仅旧的第三方多应用套件需要填此参数

关于自定义重复的说明

is_custom_repeat 如果为0,那么系统会根据 start_time 和 repeat_type 来自动计算下一次重复的时间,例如:

  • start_time 为本周周三8点整,repeat_type 为每周重复,那么每周三8点整重复;
  • start_time 为本月3号10点整,repeat_type 为每月重复,那么每月3号10点整重复;

如果 is_custom_repeat 指定为1,那么可以配合 repeat_day_of_week 或 repeat_day_of_month 特别指定周几或几号重复,且可以使用 repeat_interval 指定重复间隔

返回结果:

 {
     "errcode": 0,
     "errmsg": "ok. Warning: wrong json format. ",
     "schedule_id": "482c2ca92447e68331016f3f925c5a47"
 }

参数说明:

参数类型说明
schedule_idstring日程ID

更新日程

用于在日历中更新指定的日程。

更新操作是覆盖式,而不是增量式

不可更新组织者和日程所属日历ID

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/oa/…

请求参数:

 {
   "schedule": {
     "organizer": "serendipity",
     "schedule_id": "482c2ca92447e68331016f3f925c5a47",
     "start_time": 1571274600,
     "end_time": 1571320210,
     "attendees": [
       {
         "userid": "serendipity"
       }
     ],
     "summary": "日程更新",
     "description": "2.0日程测试",
     "reminders": {
       "is_remind": 1,
       "remind_before_event_secs": 3600,
       "is_repeat": 0,
       "repeat_until": 1606976813,
       "is_custom_repeat": 0,
       "timezone" : 8
     },
     "location": "test_place"
   }
 }

参数说明:

参数必须类型说明
access_tokenstring调用接口凭证
scheduleobj日程信息
schedule.schedule_idstring日程ID。创建日程时返回的ID
schedule.attendeesobj[]日程参与者列表。最多支持2000人
schedule.attendees.useridstring日程参与者ID 不多于64字节
schedule.summarystring日程标题。0 ~ 128 字符。不填会默认显示为“新建事件”
schedule.descriptionstring日程描述 不多于512个字符
schedule.remindersobj提醒相关信息
schedule.reminders.is_remindint32是否需要提醒。0-否;1-是
schedule.reminders.is_repeatint32是否重复日程。0-否;1-是
schedule.reminders.remind_before_event_secsuint32日程开始(start_time)前多少秒提醒,当is_remind为1时有效。 例如: 300表示日程开始前5分钟提醒。目前仅支持以下数值: 0 - 事件开始时 300 - 事件开始前5分钟 900 - 事件开始前15分钟 3600 - 事件开始前1小时 86400 - 事件开始前1天
schedule.reminders.repeat_typeuint32重复类型,当is_repeat为1时有效。目前支持如下类型: 0 - 每日 1 - 每周 2 - 每月 5 - 每年 7 - 工作日
schedule.reminders.repeat_untiluint32重复结束时刻,Unix时间戳。不填或填0表示一直重复
schedule.reminders.is_custom_repeatuint32是否自定义重复。0-否;1-是
schedule.reminders.repeat_intervaluint32重复间隔 仅当指定为自定义重复时有效 该字段随repeat_type不同而含义不同 例如: repeat_interval指定为2,repeat_type指定为每周重复,那么每2周重复一次; repeat_interval指定为2,repeat_type指定为每月重复,那么每2月重复一次
schedule.reminders.repeat_day_of_weekuint32[]每周周几重复 仅当指定为自定义重复且重复类型为每周时有效 取值范围:1 ~ 7,分别表示周一至周日
schedule.reminders.repeat_day_of_monthuint32[]每月哪几天重复 仅当指定为自定义重复且重复类型为每月时有效 取值范围:1 ~ 31,分别表示1~31号
schedule.reminders.timezoneuint32时区。UTC偏移量表示(即偏离零时区的小时数),东区为正数,西区为负数。 例如:+8 表示北京时间东八区 默认为北京时间东八区 取值范围:-12 ~ +12
schedule.locationstring日程地址 不多于128个字符
schedule.organizerstring组织者 不多于64字节
schedule.start_timeuint32日程开始时间,Unix时间戳
schedule.end_timeuint32日程结束时间,Unix时间戳

返回结果:

 {
     "errcode": 0,
     "errmsg": "ok"
 }

获取日程详情

用于获取指定的日程详情。

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/oa/…

请求参数:

 {
     "schedule_id_list": ["482c2ca92447e68331016f3f925c5a47"]
 }

参数说明:

参数是否必须说明
schedule_id_list日程ID列表。一次最多拉取1000条

返回结果:

 {
     "errcode": 0,
     "errmsg": "ok",
     "schedule_list": [
         {
             "schedule_id": "482c2ca92447e68331016f3f925c5a47",
             "attendees": [],
             "summary": "日程更新",
             "description": "2.0日程测试",
             "reminders": {
                 "is_remind": 1,
                 "is_repeat": 0,
                 "remind_before_event_secs": 3600,
                 "repeat_type": 0,
                 "is_custom_repeat": 0,
                 "repeat_interval": 0,
                 "repeat_day_of_week": [],
                 "repeat_day_of_month": [],
                 "timezone": 8,
                 "remind_time_diffs": [
                     -3600
                 ],
                 "exclude_time_list": []
             },
             "location": "test_place",
             "organizer": "serendipity",
             "status": 0,
             "start_time": 1571274600,
             "end_time": 1571320210,
             "cal_id": "wcL6acEQAAo6Dd-Z2Eq99x0y4x7mzrlA"
         }
     ]
 }

参数说明

参数类型说明
schedule_listobj[]日程列表
schedule_list.schedule_idstring日程ID
schedule_list.attendeesobj[]日程参与者列表。最多支持2000人
schedule_list.attendees.useridstring日程参与者ID
schedule_list.attendees.response_statusuint32日程参与者的接受状态。 0 - 未处理 1 - 待定 2 - 全部接受 3 - 仅接受一次 4 - 拒绝
schedule_list.summarystring日程标题
schedule_list.descriptionstring日程描述
schedule_list.remindersobj提醒相关信息
schedule_list.reminders.is_remindint32是否需要提醒。0-否;1-是
schedule_list.reminders.is_repeatint32是否重复日程。0-否;1-是
schedule_list.reminders.remind_before_event_secsuint32日程开始(start_time)前多少秒提醒,当is_remind为1时有效。例如: 300表示日程开始前5分钟提醒。目前仅支持以下数值: 0 - 事件开始时 300 - 事件开始前5分钟 900 - 事件开始前15分钟 3600 - 事件开始前1小时 86400 - 事件开始前1天 注意:建议使用 remind_time_diffs 字段,该字段后续将会废弃。
schedule_list.reminders.remind_time_diffsint32[]日程开始(start_time)与提醒时间的差值,当is_remind为1时有效。例如:-300表示日程开始前5分钟提醒。 特殊情况:企业微信终端设置的“全天”类型的日程,由于start_time是0点时间戳,提醒如果设置了当天9点,则会出现正数32400。 取值范围:-604800 ~ 86399
schedule_list.reminders.repeat_typeuint32重复类型,当is_repeat为1时有效。目前支持如下类型: 0 - 每日 1 - 每周 2 - 每月 5 - 每年 7 - 工作日
schedule_list.reminders.repeat_untiluint32重复结束时刻,Unix时间戳。不填或填0表示一直重复
schedule_list.reminders.is_custom_repeatuint32是否自定义重复。0-否;1-是
schedule_list.reminders.repeat_intervaluint32重复间隔 仅当指定为自定义重复时有效 该字段随repeat_type不同而含义不同 例如: repeat_interval指定为2,repeat_type指定为每周重复,那么每2周重复一次; repeat_interval指定为2,repeat_type指定为每月重复,那么每2月重复一次
schedule_list.reminders.repeat_day_of_weekuint32[]每周周几重复 仅当指定为自定义重复且重复类型为每周时有效 取值范围:1 ~ 7,分别表示周一至周日
schedule_list.reminders.repeat_day_of_monthuint32[]每月哪几天重复 仅当指定为自定义重复且重复类型为每月时有效 取值范围:1 ~ 31,分别表示1~31号
schedule_list.reminders.timezoneuint32时区。UTC偏移量表示(即偏离零时区的小时数),东区为正数,西区为负数。 例如:+8 表示北京时间东八区 默认为北京时间东八区 取值范围:-12 ~ +12
schedule_list.reminders.exclude_time_listobj[]重复日程不包含的日期列表。对重复日程修改/删除特定一天或多天,则原来的日程将会排除对应的日期。
schedule_list.reminders.exclude_time_list.start_timeuint32不包含的日期时间戳。
schedule_list.locationstring日程地址 不多于128个字符
schedule_list.organizerstring组织者 不多于64字节
schedule_list.statusuint32日程状态。0-正常;1-已取消
schedule_list.start_timeuint32日程开始时间,Unix时间戳
schedule_list.end_timeuint32日程结束时间,Unix时间戳
schedule_list.cal_idstring日程所属日历ID。该日历必须是access_token所对应应用所创建的日历。 注意,这个日历必须是属于组织者(organizer)的日历; 如果不填,那么插入到组织者的默认日历上。 第三方应用必须指定cal_id 不多于64字节

注意,被取消的日程也可以拉取详情,调用者需要检查 status

取消日程

用于取消指定的日程。

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/oa/…

请求参数:

 {
     "schedule_id":"482c2ca92447e68331016f3f925c5a47"
 }

参数说明:

参数是否必须说明
schedule_id日程ID

返回结果:

 { 
     "errcode": 0,
     "errmsg" : "ok"
 }

获取日历下的日程列表

用于获取指定的日历下的日程列表。

仅可获取应用自己创建的日历下的日程。

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/oa/…

请求参数

 {
     "cal_id": "wcL6acEQAAo6Dd-Z2Eq99x0y4x7mzrlA",
     "offset" : 100,
     "limit" : 1000
 }

参数说明

参数是否必须说明
cal_id日历ID
offset分页,偏移量, 默认为0
limit分页,预期请求的数据量,默认为500,取值范围 1 ~ 1000

当日程较多时,需要使用参数是offsetlimit 分页获取,注意offset以0为起点,这里以图例简单说明:

image-20210817213333727

当获取到的 schedule_list 是空的时候,表示offset已经过大,此时应终止获取。若有新增日程,可在此基础上继续增量获取。

返回结果

 {
     "errcode": 0,
     "errmsg": "ok",
     "schedule_list": [{
         "schedule_id": "17c7d2bd9f20d652840f72f59e796AAA",
         "sequence": 100,
         "attendees": [{
             "userid": "userid1",
             "response_status": 0
         }],
         "summary": "test_summary",
         "description": "test_content",
         "reminders": {
             "is_remind": 1,
             "is_repeat": 1,
             "remind_before_event_secs": 3600,
             "repeat_type": 7,
             "repeat_until": 1606976813,
             "is_custom_repeat": 1,
             "repeat_interval": 1,
             "repeat_day_of_week": [3, 7],
             "repeat_day_of_month": [10, 21],
             "timezone" : 8
         },
         "location": "test_place",
         "start_time": 1571274600,
         "end_time": 1571320210,
         "status": 1,
         "cal_id": "wcjgewCwAAqeJcPI1d8Pwbjt7nttzAAA"
     }]
 }

参数说明

参数类型说明
schedule_listobj[]日程列表
schedule_list.schedule_idstring日程ID
schedule_list.attendeesobj[]日程参与者列表。最多支持2000人
schedule_list.attendees.useridstring日程参与者ID
schedule_list.attendees.response_statusuint32日程参与者的接受状态。 0 - 未处理 1 - 待定 2 - 全部接受 3 - 仅接受一次 4 - 拒绝
schedule_list.summarystring日程标题
schedule_list.descriptionstring日程描述
schedule_list.remindersobj提醒相关信息
schedule_list.reminders.is_remindint32是否需要提醒。0-否;1-是
schedule_list.reminders.is_repeatint32是否重复日程。0-否;1-是
schedule_list.reminders.remind_before_event_secsuint32日程开始(start_time)前多少秒提醒,当is_remind为1时有效。例如: 300表示日程开始前5分钟提醒。目前仅支持以下数值: 0 - 事件开始时 300 - 事件开始前5分钟 900 - 事件开始前15分钟 3600 - 事件开始前1小时 86400 - 事件开始前1天
schedule_list.reminders.repeat_typeuint32重复类型,当is_repeat为1时有效。目前支持如下类型: 0 - 每日 1 - 每周 2 - 每月 5 - 每年 7 - 工作日
schedule_list.reminders.repeat_untiluint32重复结束时刻,Unix时间戳。不填或填0表示一直重复
schedule_list.reminders.is_custom_repeatuint32是否自定义重复。0-否;1-是
schedule_list.reminders.repeat_intervaluint32重复间隔 仅当指定为自定义重复时有效 该字段随repeat_type不同而含义不同 例如: repeat_interval指定为2,repeat_type指定为每周重复,那么每2周重复一次; repeat_interval指定为2,repeat_type指定为每月重复,那么每2月重复一次
schedule_list.reminders.repeat_day_of_weekuint32[]每周周几重复 仅当指定为自定义重复且重复类型为每周时有效 取值范围:1 ~ 7,分别表示周一至周日
schedule_list.reminders.repeat_day_of_monthuint32[]每月哪几天重复 仅当指定为自定义重复且重复类型为每月时有效 取值范围:1 ~ 31,分别表示1~31号
schedule_list.reminders.timezoneuint32时区。UTC偏移量表示(即偏离零时区的小时数),东区为正数,西区为负数。 例如:+8 表示北京时间东八区 默认为北京时间东八区 取值范围:-12 ~ +12
schedule_list.locationstring日程地址 不多于128个字符
schedule_list.organizerstring组织者 不多于64字节
schedule_list.statusuint32日程状态。0-正常;1-已取消
schedule_list.start_timeuint32日程开始时间,Unix时间戳
schedule_list.end_timeuint32日程结束时间,Unix时间戳
schedule_list.sequenceuint64日程编号,是一个自增数字
schedule_list.cal_idstring日程所属日历ID。该日历必须是access_token所对应应用所创建的日历。 注意,这个日历必须是属于组织者(organizer)的日历; 如果不填,那么插入到组织者的默认日历上。 第三方应用必须指定cal_id 不多于64字节

注意:被取消的日程也可以拉取详情,调用者需要检查status

会议

概述

企业和开发者通过会议接口可以便捷地创建会议、管理会议、获取会议入口以及查询会议明细信息。

配置可使用会议的应用

  • 系统应用“会议”默认可使用会议接口,其他应用则需先配置调用权限方可使用。
  • 自建应用需要配置在“可调用接口的应用”列表
  • 第三方服务商创建应用的时候,需要开启“会议接口权限”

创建预约会议

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/mee…

请求参数

 {
    "creator_userid": "serendipity",
    "title": "新建会议",
    "meeting_start": 1629255600,
    "meeting_duration": 3600,
    "description": "新建会议描述",
    "type": 1,
    "remind_time": 60,
    "agentid" : 3010085,
    "attendees": {
         "userid":[
             "QiuJunFeng",
             "WoShiZhuangZhuangXiaoKeAi"
         ]
    }
 }

参数说明

参数必须说明
access_token调用接口凭证。
creator_userid会议发起者的userId
title会议的标题,最多支持40个字节或者20个utf8字符
meeting_start会议开始时间的unix时间戳。需大于当前时间
meeting_duration会议持续时间单位秒,最小300秒
type会议的类型,1:表示视频会议,2:表示语音会议
description会议的描述,最多支持500个字节或者utf8字符
remind_time指定会议开始前多久提醒用户,相对于meeting_start前的秒数,默认为0
agentid授权方安装的应用agentid。仅旧的第三方多应用套件需要填此参数
attendees参与会议的成员,与会人员最多299,任何userid,external_userid和device_sn不合法,直接报错
attendees.userid参与会议的企业成员userid
attendees.external_userid参与会议的外部联系人external_userid
attendees.device_sn参与会议的硬件设备sn

权限说明

  • 发起人和企业内部参与人必须在应用可见范围内,「会议」应用默认全员可见
  • 发起人需要与外部联系人有好友关系
  • 系统应用「会议」默认可使用会议接口
  • 自建应用需要配置在“可调用接口的应用”列表
  • 第三方服务商创建应用的时候,需要开启“会议接口权限”

返回结果:

 {
     "errcode": 0,
     "errmsg": "ok",
     "meetingid": "mtL6acEQAA_tq_Gd5Wk89YloG2mmr1rQ"
 }

参数说明

参数说明
meetingid会议id,通过此id可调用“进入会议”接口(包括小程序接口JS-SDK接口),以实现主持人到点后的开始会议操作,以及参会人进入会议详情参加会议

修改预约会议

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/mee…

请求参数

 {
   "meetingid": "mtL6acEQAA_tq_Gd5Wk89YloG2mmr1rQ",
    "title": "新需求",
    "meeting_start": 1629255600,
    "meeting_duration": 10000,
    "description": "test",
    "type": 1,
    "remind_time": 60,
    "attendees": {
         "userid":[
             "WoShiZhuangZhuangXiaoKeAi"
         ]
    }
 }

参数说明

参数必须说明
access_token调用接口凭证。获取方法查看“获取access_token
meetingid会议id,仅允许取消预约状态下的会议
title会议的标题,最多支持40个字节或者20个utf8字符
meeting_start会议开始时间的unix时间戳
meeting_duration会议持续时间单位秒,最小300秒
type会议的类型,1:表示视频会议,2:表示语音会议
description会议的描述,最多支持500个字节或者utf8字符
remind_time指定会议开始前多久提醒用户,相对于meeting_start前的秒数,默认为0
attendees参与会议的成员,与会人员最多299。如果填写该字段,该字段则全量覆盖。
attendees.userid参与会议的企业成员userid
attendees.external_userid参与会议的外部联系人external_userid
attendees.device_sn参与会议的硬件设备sn

权限说明

  • 发起人和企业内部参与人必须在应用可见范围内
  • 发起人需要与外部联系人有好友关系
  • 仅允许修改当前应用创建的会议

返回结果:

 {
    "errcode": 0,
    "errmsg": "ok"
 }

取消预约会议

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/mee…

请求参数

 {
    "meetingid": "mtL6acEQAA_tq_Gd5Wk89YloG2mmr1rQ"
 }

参数说明

参数必须说明
access_token调用接口凭证。获取方法查看“获取access_token
meeting_id会议id,仅允许取消预约状态下的会议

权限说明

  • 仅允许取消当前应用创建的会议。

返回结果

 {
    "errcode": 0,
    "errmsg": "ok"
 }

获取成员会议ID列表

可以获取指定成员指定时间内的所有会议ID

请求方式:POST(HTTPS)

请求地址:qyapi.weixin.qq.com/cgi-bin/mee…

请求参数

 {
     "userid": "serendipity",
     "cursor": "0",
     "begin_time": 1586136317,
     "end_time": 1586236317,
     "limit": 100
 }

参数说明

参数必须说明
access_token调用接口凭证
userid企业成员的userid
cursor上一次调用时返回的cursor,初次调用可以填”0”
limit每次拉取的数据量,默认值和最大值都为100
begin_time开始时间,begin_time与end_time都不填表示来取全量的数据
end_time结束时间,时间跨度不超过180天

返回结果:

 {
     "errcode": 0,
     "errmsg": "ok",
     "next_cursor": "",
     "meetingid_list": [
         "mtL6acEQAA_tq_Gd5Wk89YloG2mmr1rQ"
     ]
 }

参数说明

参数说明
next_cursor当前数据最后一个key值,如果下次调用带上该值则从该key值往后拉,用于实现分页拉取,next_cursor为未返回或者为空字符串表示数据已取完
meetingid_list会议ID列表,可能为空

获取会议详情

请求方式: POST(HTTPS)

请求地址: qyapi.weixin.qq.com/cgi-bin/mee…

请求参数

 {
    "meetingid": "mtL6acEQAA_tq_Gd5Wk89YloG2mmr1rQ"
 }

参数说明

参数必须说明
access_token调用接口凭证。获取方法查看“获取access_token
meetingid会议id

返回结果

 {
     "errcode": 0,
     "errmsg": "ok",
     "creator_userid": "serendipity",
     "title": "新需求",
     "reserve_meeting_start": 1629255600,
     "reserve_meeting_duration": 10000,
     "meeting_start": 0,
     "meeting_duration": 0,
     "remind_time": 60,
     "description": "test",
     "main_department": 1,
     "type": 1,
     "status": 4,
     "attendees": {
         "member": [
             {
                 "userid": "WoShiZhuangZhuangXiaoKeAi",
                 "status": 6
             },
             {
                 "userid": "serendipity",
                 "status": 6
             }
         ],
         "external_user": [],
         "device": []
     }
 }

参数说明

参数说明
creator_userid会议发起者的userId
title会议的标题,最大60个字节
reserve_meeting_start会议预约的开始时间的unix时间戳
reserve_meeting_duration会议预约时长
meeting_start会议开始时间的unix时间戳
meeting_duration会议时长
description会议的描述,最大600字节
main_department发起人所在部门
type会议的类型,1:表示视频会议,2:表示语音会议
status会议的状态,1:待开始,2:会议中,3:已结束,4:已取消,5:已过期
remind_time指定会议开始前多久提醒用户,相对于meeting_start前的秒数
attendees会议成员
attendees.member企业内部成员
attendees.member.userid企业内部成员的userid
attendees.member.status与会议状态。1为已参与,2为未参与,3为已接受,4为已拒绝,5为待定,6为未处理
attendees.external_user外部联系人
attendees.external_user.external_userid外部联系人的external_userid
attendees.external_user.status与会议状态。1为已参与,2为未参与,3为已接受,4为已拒绝,5为待定,6为未处理,对于外部的微信用户暂时不提供状态信息,默认为0
attendees.device会议硬件设备
attendees.device.device_sn会议硬件设备sn
attendees.device.status与会议状态。1为已参与,2为未参与,3为已接受,4为已拒绝,5为待定,6为未处理