Message analysis data interface


Message analysis data interface

1474942992867943.jpg


# WeChat public platform was launched on January 6, 2015 The data interface is invited for internal testing. Through the data interface, developers can obtain similar but more flexible data to the statistics module of the official website of the public platform, and can also perform advanced processing as needed.

In the permission set division of the official account login authorization mechanism, the message analysis data interface belongs to the message management permission.

The time to open the data interface to all public account developers will be notified separately.

Please note:

1、接口侧的公众号数据的数据库中仅存储了2014年12月1日之后的数据,将查询不到在此之前的日期,即使有查到,也是不可信的脏数据;
2、请开发者在调用接口获取数据后,将数据保存在自身数据库中,即加快下次用户的访问速度,也降低了微信侧接口调用的不必要损耗。

The message analysis data interface refers to the interface used to obtain message analysis data in the data statistics module of the official website of the public platform. The specific interface list is as follows (no message keyword data is available yet) interface):

Interface nameMaximum time spanInterface calling address (must use https)
Get Message sending profile data (getupstreammsg)7https://api.weixin.qq.com/datacube/getupstreammsg?access_token=ACCESS_TOKEN
Get message distribution time-sharing data (getupstreammsghour)1https://api.weixin.qq.com/datacube/getupstreammsghour?access_token=ACCESS_TOKEN
Get message sending week data (getupstreammsgweek)30https://api.weixin.qq.com/datacube/getupstreammsgweek?access_token=ACCESS_TOKEN
Get message sending month data (getupstreammsgmonth)30https://api.weixin.qq.com/datacube/getupstreammsgmonth?access_token=ACCESS_TOKEN
Get message sending distribution data (getupstreammsgdist)15https://api.weixin.qq.com/datacube/getupstreammsgdist?access_token=ACCESS_TOKEN
Get message sending distribution week data (getupstreammsgdistweek)30https://api.weixin.qq.com/datacube/getupstreammsgdistweek?access_token=ACCESS_TOKEN
Get message sending distribution monthly data (getupstreammsgdistmonth) 30https://api.weixin.qq.com/datacube/getupstreammsgdistmonth?access_token=ACCESS_TOKEN

The maximum time span refers to the maximum time range that can obtain data when an interface is called. For example, the maximum time span is 7, which means that up to 7 days of data can be obtained at one time. Please obtain the actual value of access_token through "Get access_token".

Regarding weekly data and monthly data, please note that the date of the monthly/weekly periodic data is marked on the first day of the month/week (the 1st of the month or Monday). Only by calling the interface after a certain month/week has passed can the data of that period be obtained. For example, if you use (November 1st - November 5th) as (begin_date and end_date) to call the monthly data acquisition interface on December 1st, you can get the monthly data on November 1st (that is, the monthly data for November).

Interface call request description

The message analysis data interface (including all interfaces in the interface list) needs to POST the following sample data packet to the corresponding interface call address:

{ 
    "begin_date": "2014-12-07", 
    "end_date": "2014-12-08"
}

Call parameter description

ParameterIs it requiredDescription
access_tokenYesCall interface credentials
begin_date is the starting date for to obtain data. The difference between begin_date and end_date must be less than "maximum "Time span" (for example, when the maximum time span is 1, the difference between begin_date and end_date can only be 0 to be less than 1), otherwise an error will be reported
end_date It is the end date of to obtain data. The maximum value allowed for end_date is yesterday

Return instructions

To obtain the message sending overview data interface, you need to call the corresponding interface address to POST the following data packet:

{ 
   "list": [ 
       { 
           "ref_date": "2014-12-07", 
           "msg_type": 1, 
           "msg_user": 282, 
           "msg_count": 817
       }
	//后续还有同一ref_date的不同msg_type的数据,以及不同ref_date(在时间范围内)的数据
   ]
}

To obtain the message distribution time-sharing data interface, you need to POST the following data packet to the corresponding interface call address:

{ 
   "list": [ 
       { 
           "ref_date": "2014-12-07", 
           "ref_hour": 0, 
           "msg_type": 1, 
           "msg_user": 9, 
           "msg_count": 10
       }
	//后续还有同一ref_hour的不同msg_type的数据,以及不同ref_hour的数据,ref_date固定,因为最大时间跨度为1
   ]
}

Get the returned JSON data packet of the message sending weekly data interface as follows:

{ 
   "list": [ 
       { 
           "ref_date": "2014-12-08", 
           "msg_type": 1, 
           "msg_user": 16, 
           "msg_count": 27
       }
		//后续还有同一ref_date下不同msg_type的数据,及不同ref_date的数据
   ]
}

Get the returned JSON data packet of the message sending monthly data interface as follows:

{ 
   "list": [ 
       { 
           "ref_date": "2014-11-01", 
           "msg_type": 1, 
           "msg_user": 7989, 
           "msg_count": 42206
       }
	//后续还有同一ref_date下不同msg_type的数据,及不同ref_date的数据
   ]
}

Get the returned JSON data packet of the message sending distribution data interface as follows:

{ 
   "list": [ 
       { 
           "ref_date": "2014-12-07", 
           "count_interval": 1, 
           "msg_user": 246
       }
	//后续还有同一ref_date下不同count_interval的数据,及不同ref_date的数据
   ]
}

Get the returned JSON data packet of the message sending distribution weekly data interface as follows:

{ 
   "list": [ 
       { 
           "ref_date": "2014-12-07", 
           "count_interval": 1, 
           "msg_user": 246
       }
	//后续还有同一ref_date下不同count_interval的数据,及不同ref_date的数据
   ]
}

Get the message The return JSON data packet of the interface for sending distribution monthly data is as follows:

{ 
   "list": [ 
       { 
           "ref_date": "2014-12-07", 
           "count_interval": 1, 
           "msg_user": 246
       }
	//后续还有同一ref_date下不同count_interval的数据,及不同ref_date的数据
   ]
}

Return parameter description

##int_page_read_countNumber of readings of picture and text pagesori_page_read_userThe number of readers of the original text page (the page entered by clicking "Read Original Text" on the graphic page). When there is no original text page, the data here is 0

When an error occurs, WeChat will return error code and other information. For specific error code inquiries, please see: Global Return Code Description

ParametersDescription
ref_dateThe date of the data must be between begin_date and end_date
ref_hourThe hour of data, including from 000 to 2300, represents [000,100) to [2300,2400) respectively, that is, the first hour of each day and the last hour
msg_type message type, the meanings are as follows:

1 represents text 2 represents picture 3 represents voice 4 represents video 6 represents third-party application Message (link message)

msg_userThe number of users who have sent messages upstream (sent to the public account)
msg_countThe total number of messages sent upstream
count_intervalThe interval of the distribution of the amount of messages sent on the day, 0 represents "0", 1 represents "1-5", 2 represents "6-10", 3 represents "more than 10 times"