Customize menu creation interface
Customize menu creation interface
URL
HTTP request mode
Interface request parameters
|
|
|
|
---|---|---|---|
|
|
|
|
|
|
|
|
matters needing attention
-
About updating the customized menu: -
1. The user-defined menu takes effect immediately after calling; -
2. However, the mobile terminal has a caching mechanism for the processing of customized menus. When the user first accesses account A, the customized menu of account A will be cached locally, and will be updated again within 24 hours; -
3. If you want to see the effect immediately after updating the customized menu, you can go to the IM on the web end to see the effect, or try to clear the phone cache;
-
-
For the json example of the parameter menu, the following json needs to be URLEncode when actually calling: -
1, where 1~3 are required in the "button" array -
2. One to five "sub_button" arrays are required
-
{ "button": [ { "type": "click", "Name": "Get coupon", "key": "get_groupon" }, { "type": "click", "Name": "Query customer service telephone", "key": "the_big_brother_need_your_phone" }, { "Name": "Menu", "sub_button": [ { "type": "view", "Name": "Online 4S shop", "url": " http://apps.weibo.com/1838358847/8rYu1uHD " }, { "type": "view", "Name": "Bargaining Group", "url": " http://apps.weibo.com/1838358847/8s1i6v74 " }, { "type": "click", "Name": "Momada", "key": "memeda" } ] } ] } Parameter description: 1. The button must fill in the first level menu array, and the number should be 1~3 2. The number of sub_button in the secondary menu array should be 1-5 3. Type is optional (not required if it is the same level as the submenu sub_button). There are two types of response action: click and view 4. Name must fill in the menu title, no more than 16 bytes, and no more than 40 bytes for submenus 5. The key is mandatory when the optional type is click. The menu KEY value is used for message interface push, and does not exceed 128 bytes 6. The url is mandatory when the optional type is view. The web link can be opened by the user clicking the menu, which does not exceed 256 bytes
curl " https://m.api.weibo.com/2/messages/menu/create.json?access_token=ACCESS_TOKEN " -d 'menus=%7B%22button%22%3A+%5B%7B%22type%22%3A+%22click%22%2C%22name%22%3A+%22%E8%8E%B7%E5%8F%96%E4%BC%98%E6%83%A0%E5%88%B8%22%2C%22key%22%3A+%22get_groupon%22%7D%2C%7B%22type%22%3A+%22click%22%2C%22name%22%3A+%22%E6%9F%A5%E8%AF%A2%E5%AE%A2%E6%9C%8D%E7%94%B5%E8%AF%9D%22%2C%22key%22%3A+%22the_big_brother_need_your_phone%22%7D%2C%7B%22name%22%3A +%22%E8%8F%9C%E5%8D%95%22%2C%22sub_button%22%3A+%5B%7B%22type%22%3A+%22view%22%2C%22name%22%3A+%22%E7%BD%91%E4%B8%8A4S%E5%BA%97%22%2C%22url%22%3A+%22http%3A%2F%2Fapps.weibo.com%2F1838358847%2F8rYu1uHD%22%7D%2C%7B%22type%22%3A+%22view%22%2C%22name%22%3A+%22%E7%A0%8D%E4%BB%B7%E5%9B%A2%22%2C%22url%22%3A+%22http%3A%2F%2Fapps.weibo.com%2F1838358847%2F8 s1i6v74%22%7D%2C%7B%22type%22%3A+%22click%22%2C%22name%22%3A+%22%E4%B9%88%E4%B9%88%E5%93%92%22%2C%22key%22%3A+%22memeda%22%7D%5D%7D%5D%7D'
Return Results
//Successful return { "result": true } //Failure return { "request": "/2/messages/menu/create.json", "error_code": 264XX, "error": "error message." }