Prerequisites
Complete the Create an app procedure.Procedure
- Select the target app, go to the app details page, and click Basic Information > Credentials and Basic Information.
- Obtain the app Client ID and Client Secret.
- Internal apps have the Work Notifications API permission enabled by default. You do not need to submit an application manually.
- Obtain the access credential to get the access_token of the internal app. When you call the API, the caller’s identity is authenticated using the access token.
- Call the Send a Work Notification API to send a Work Notification to the target user. The user needs to click the message to trigger the redirect, so the suitable message types are link messages, OA messages, and Card messages. For details, see Message notification types.
Redirect to a web app (H5 micro app) by clicking a Work Notification
- Call the Send a Work Notification API. Select link messages, OA messages, or Card messages as the format of the Work Notification. These three message types support redirection.
-
For how to construct the redirect link, see Message link description. The following examples show how to construct the link for each of the three message types. For the complete message sending format, see Message notification types.
Parameter Description corpid - For an internal app web app (H5 micro app), this parameter is the corpid value of the organization where the current micro app resides. - For a third-party enterprise app web app (H5 micro app), this parameter is the corpid value of the organization that has authorized the current app. container_type The method used to open the link (fixed value): - work_platform: Open the link in the workbench. app_id - For an internal app H5 micro app, set this parameter to 0_agentId, which is composed of the digit 0, an underline, and the agentId. To view the agentId, see Agent ID. - For a third-party enterprise app H5 micro app, set this parameter to the appId value of the current third-party micro app. To view the appId, see App ID. redirect_type In this scenario, set to jump (fixed value). redirect_url The target URL to redirect to. It must be urlEncoded.
Example
Example of constructing a redirect link for a link message
Example of constructing a redirect link for an OA message
Example of constructing a redirect link for a Card message
Card messages support the whole-card redirect ActionCard style and the independent-button redirect ActionCard style:-
Whole-card redirect ActionCard style
-
Independent-button redirect ActionCard style