# Create app feed card

The app feed card is a tool that allows applications to directly send messages within the feed list, ensuring that important messages reach users more quickly.
**Notice**：**Note**: Lark client supports app feed card starting from version 7.6 and above.

## Request

Facts | &nbsp;
---|---
HTTP URL | https://open.feishu.cn/open-apis/im/v2/app_feed_card
HTTP Method | POST
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
---|---|---|---
app_feed_card | open_app_feed_card | No | app feed card
biz_id | string | No | business id (Optional field; developers can customize the business ID for easier data management. If not provided, the API response will return a system-assigned business ID.)<br>**Example value**: "096e2927-40a6-41a3-9562-314d641d09ae"<br>**Data validation rules**:<br>- Length range: `0` ～ `200` characters
title | string | No | title (Displays a maximum of one line in the user interface, automatically truncating any overflow content; font size and color customization are not supported.)<br>**Example value**: "main title"<br>**Data validation rules**:<br>- Length range: `0` ～ `60` characters
avatar_key | string | No | avatar key<br>**Example value**: "v3_0041_007bca9f-67ba-4199-bf00-4031b12cf226"<br>**Data validation rules**:<br>- Length range: `0` ～ `100` characters
preview | string | No | preview text (Displays a maximum of one line in the user interface, automatically truncating any overflow content; supports concatenation of multiple fields, special characters, and emojis; font size and color customization are not supported.)<br>**Example value**: "this is preview text"<br>**Data validation rules**:<br>- Length range: `0` ～ `120` characters
status_label | open_feed_status_label | No | status label (Optional field; if this field is not selected, the default display will show the card's reach time.)
text | string | Yes | text<br>**Example value**: "label text"<br>**Data validation rules**:<br>- Length range: `1` ～ `20` characters
type | string | Yes | label type<br>**Example value**: "primary"<br>**Optional values are**:<br>- primary：primary<br>- secondary：secondary<br>- success：success<br>- danger：Danger<br>**Default value**: `primary`
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 | 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 demo"<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"}
link | open_app_feed_link | No | card redirect link (This parameter is required when creating)
link | string | No | link <br>**Note**: Only HTTPS protocol is supported, as well as Applink for web app or gadget (appid will be verified for correctness).<br>**Example value**: "https://www.feishu.cn/"<br>**Data validation rules**:<br>- Maximum length: `700` characters
time_sensitive | boolean | No | Instant reminder state (Setting to true will temporarily pin the card at the top of the message list; setting to false will not pin the message card.)<br>**Example value**: false<br>**Default value**: `false`
notify | app_feed_notify | No | notify
close_notify | boolean | No | without notify<br>**Example value**: true<br>**Default value**: `false`
custom_sound_text | string | No | Customized sound notification text content (Only supports mobile devices)<br>**Example value**: "You have a new order"<br>**Data validation rules**:<br>- Maximum length: `20` characters
with_custom_sound | boolean | No | Whether to play custom sound (Only supports mobile devices; currently do not support switching voice packages and only support a female voice by default.)<br>**Example value**: true<br>**Default value**: `false`
user_ids | string\[\] | No | List of user IDs, support open_id, union_id, user_id. (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`

### Request body example
```json
{
    "app_feed_card": {
        "biz_id": "096e2927-40a6-41a3-9562-314d641d09ae",
        "title": "main title",
        "avatar_key": "v3_0041_007bca9f-67ba-4199-bf00-4031b12cf226",
        "preview": "this is preview text",
        "status_label": {
            "text": "label text",
            "type": "primary"
        },
        "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 demo"
                    },
                    "button_type": "default",
                    "action_map": {
                        "foo": "bar"
                    }
                }
            ]
        },
        "link": {
            "link": "https://www.feishu.cn/"
        },
        "time_sensitive": false,
        "notify": {
            "close_notify": true,
            "custom_sound_text": "You have a new order",
            "with_custom_sound": true
        }
    },
    "user_ids": [
        "ou_88553eda9014c201e6969b478895c223"
    ]
}
```

## Response

### Response body

Parameter | Type | Description
---|---|---
code | int | Error codes, fail if not zero
msg | string | Error descriptions
data | \- | \-
failed_cards | open_failed_user_app_feed_card_item\[\] | failed cards
biz_id | string | business id
user_id | string | user id
reason | string | reason<br>**Optional values are**:<br>- 0：unknown<br>- 1：no permission<br>- 2：not created<br>- 3：rate limited<br>- 4：duplicated
biz_id | string | business id

### Response body example
```json
{
    "code": 0,
    "msg": "success",
    "data": {
        "failed_cards": [
            {
                "biz_id": "bdf22389-87ec-4890-9eb6-78a7efaeecbb",
                "user_id": "ou_88553eda9014c201e6969b478895c223",
                "reason": "NO_PERMISSION"
            }
        ],
        "biz_id": "b90ce43a-fca8-4f42-92f4-794bff206ee5"
    }
}
```

### 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

