# Update feed card button

You can add shortcut operation buttons, update buttons, or delete buttons to Groups & Bots feed card.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/im/v2/chat_button
HTTP Method | PUT
Rate Limit | [10 per second](https://open.feishu.cn/document/ukTMukTMukTM/uUzN04SN3QjL1cDN)
Supported app types | Custom App、Store App
Required scopes<br>**To use this API, you must have at least 1 of the listed scopes.** | Create, update, and delete app feed card(im:app_feed_card:write)
Required field scopes | **Notice**：The response body of the API contains the following sensitive fields, and they will be returned only after corresponding scopes are added. If you do not need the fields, it is not recommended that you request the scopes.<br>Obtain user ID(contact:user.employee_id:readonly)

### Request header

Parameter | Type | Required | Description
---|---|---|---
Authorization | string | Yes | `tenant_access_token`<br>**Value format**: "Bearer `access_token`"<br>**Example value**: "Bearer t-7f1bcd13fc57d46bac21793a18e560"<br>[How to choose and get access token](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-choose-which-type-of-token-to-use)
Content-Type | string | Yes | **Fixed value**: "application/json; charset=utf-8"

### Query parameters

Parameter | Type | Required | Description
---|---|---|---
user_id_type | string | No | User ID categories<br>**Example value**: open_id<br>**Optional values are**:<br>- open_id：Identifies a user to an app. The same user has different Open IDs in different apps. [How to get Open ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-openid)<br>- union_id：Identifies a user to a tenant that acts as a developer. A user has the same Union ID in apps developed by the same developer, and has different Union IDs in apps developed by different developers. A developer can use Union ID to link the same user's identities in multiple apps.[How to get Union ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-union-id)<br>- user_id：Identifies a user to a tenant. The same user has different User IDs in different tenants. In one single tenant, a user has the same User ID in all apps （including store apps）. User ID is usually used to communicate user data between different apps. [How to get User ID](https://open.feishu.cn/document/uAjLw4CM/ugTN1YjL4UTN24CO1UjN/trouble-shooting/how-to-obtain-user-id)<br>**Default value**: `open_id`<br>**When the value is `user_id`, the following field scopes are required**:<br>Obtain user ID(contact:user.employee_id:readonly)

### Request body

Parameter | Type | Required | Description
---|---|---|---
user_ids | string\[\] | No | List of user IDs (The ID type is consistent with the values of user_id_type. If it is a store application, user IDs of type user_id cannot be used as the permission to obtain user IDs is not supported.)<br>**Example value**: ["ou_88553eda9014c201e6969b478895c223"]<br>**Data validation rules**:<br>- Length range: `1` ～ `20`
chat_id | string | Yes | Chat id<br>**Example value**: "oc_a0553eda9014c201e6969b478895c230"
buttons | open_app_feed_card_buttons | No | button (Optional field; if this field is not provided, the button will not be displayed; a maximum of 2 buttons can be shown.)
buttons | open_app_feed_card_button\[\] | Yes | buttons, this field is a full update field, if the original value of the field is not passed in, the field data will be cleared. For example:<br>- While maintaining the field configuration of the original button, adding a new button configuration will add a button.<br>- If you update the field configuration of the original button, the button will be updated.<br>- Clearing the field configuration of the original button will delete the button.<br>**Data validation rules**:<br>- Length range: `0` ～ `2`
multi_url | open_app_feed_card_url | No | url (support https only)
url | string | No | url<br>**Example value**: "https://www.feishu.cn/"<br>**Data validation rules**:<br>- Maximum length: `700` characters
android_url | string | No | Android url<br>**Example value**: "https://www.feishu.cn/"<br>**Data validation rules**:<br>- Maximum length: `700` characters
ios_url | string | No | iOS url<br>**Example value**: "https://www.feishu.cn/"<br>**Data validation rules**:<br>- Maximum length: `700` characters
pc_url | string | No | PC url<br>**Example value**: "https://www.feishu.cn/"<br>**Data validation rules**:<br>- Maximum length: `700` characters
action_type | string | Yes | action type (The button interaction method can be configured to redirect to a URL page or set up a webhook callback.)<br>**Example value**: "url_page"<br>**Optional values are**:<br>- url_page：url page<br>- webhook：webhook
text | open_app_feed_card_text | Yes | text
text | string | Yes | text<br>**Example value**: "text"<br>**Data validation rules**:<br>- Length range: `1` ～ `30` characters
button_type | string | No | button type<br>**Example value**: "default"<br>**Optional values are**:<br>- default：default<br>- primary：primary<br>- success：success<br>**Default value**: `default`
action_map | map&lt;string, string&gt; | No | action map<br>**Example value**: {"foo": "bar"}

### Request body example
```json
{
    "user_ids": [
        "ou_88553eda9014c201e6969b478895c223"
    ],
    "chat_id": "oc_a0553eda9014c201e6969b478895c230",
    "buttons": {
        "buttons": [
            {
                "multi_url": {
                    "url": "https://www.feishu.cn/",
                    "android_url": "https://www.feishu.cn/",
                    "ios_url": "https://www.feishu.cn/",
                    "pc_url": "https://www.feishu.cn/"
                },
                "action_type": "url_page",
                "text": {
                    "text": "text"
                },
                "button_type": "default",
                "action_map": {
                    "foo": "bar"
                }
            }
        ]
    }
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
failed_user_reasons | failed_reason\[\] | failed reason
error_code | int | error code
error_message | string | error message
user_id | string | User ids

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "failed_user_reasons": [
            {
                "error_code": 0,
                "error_message": "The user is not in the chat",
                "user_id": "ou_679eaeb583654bff73fefcc6e6371301"
            }
        ]
    }
}
```

### Error code

HTTP status code | Error code | Description | Troubleshooting suggestions
---|---|---|---
400 | 230001 | param is invalid | Determine invalid fields and reasons according to the error message.
400 | 230027 | no permission, bot not in the chat | Check if the bot is in the chat

