All Products
Search
Document Center

Mobile Platform as a Service:Message templates

Last Updated:Feb 11, 2026

Common fields

Input parameters

Parameter

Type

Required

Example

Description

appId

String

Yes

ONEX570DA89211721

The application ID.

workspaceId

String

Yes

default

The workspace ID.

tenantId

String

Yes

LZFPEFIM

The tenant ID.

Output parameters

Parameter

Type

Example

Description

requestId

String

B589F4F4-CD68-3CE5-BDA0-6597F33E23916512

The request ID.

success

boolean

true

Indicates whether the request was successful.

code

String

100

The result code.

msg

String

SUCCESS

The result message.

data

Object

-

The result content.

currentPage

int

1

The current page number.

pageSize

int

100

The number of records per page.

totalSize

int

80

The total number of records.

Important
  • For the create, delete, paged query, and single query APIs, the response data is returned in the `Data` field.

  • Only the paged query API includes the currentPage, pageSize, and totalSize parameters.

Result codes

Result code

Result message

Description

100

SUCCESS

Success.

3022

TEMPLATE_NOT_EXIST

The template does not exist.

3028

INVALID_PARAM

Check the parameters.

3036

TEMPLATE_ALREADY_EXIST

The template already exists.

8011

FLOW_CONTROL_ERROR

Throttling.

8012

INVALID_INSTANCE_ID

Check the AppID and WorkspaceID.

8013

INVALID_TENANT_ID

Invalid TenantID.

8014

ACCOUNT_NO_PERMISSION

No permission.

9000

SYSTEM_ERROR

System error.

Create a template

You can create a maximum of 100 templates for each app.

Input parameters

Parameter

Type

Required

Example

Description

templateName

String

Yes

TestTemplate

The name of the template. Create the template in the console.

Note

The template name cannot contain commas.

descInfo

String

Yes

Template description

The description of the template.

title

String

Yes

Template title

If the title is a placeholder, it must be wrapped in # characters, such as #title#.

content

String

Yes

Template content

The value. If it is a placeholder, it must be enclosed in # characters, such as #content#.

uri

String

No

mpaas://landing/startLand

The redirection URL.

variables

String

No

title,content

The placeholder fields. Separate multiple fields with commas.

showStyle

long

No

0

Specifies whether to use silence mode.

  • 0: No (default)

  • 1: Yes

imageUrls

String

No

{"defaultUrl": "http://111"}

When `pushStyle` is 2, this parameter specifies the URL of the large image. The value must be in JSON format. By default, the value of `defaultUrl` is used. To specify URLs for different vendors, you can change the key to `oppoUrl`, `miuiUrl`, `hmsUrl`, `honorUrl`, `harmonyosUrl`, and so on.

iconUrls

String

No

{"defaultUrl": "http://111"}

When `pushStyle` is 2, this parameter specifies the URL of the icon. The value must be in JSON format. By default, the value of `defaultUrl` is used. To specify URLs for different vendors, you can change the key to `iosUrl`, `oppoUrl`, `miuiUrl`, and so on.

pushStyle

int

No

0

The display style.

  • 0: Normal text (default)

  • 1: Large text

  • 2: Image and text

jumpAction

int

No

0

The action type after a click.

  • 0: Web page (default)

  • 1. Client Customization

Output parameters

Data

Parameter

Type

Example

Description

data

String

8346

The template ID.

Examples

import com.alibaba.fastjson.JSON;
import com.aliyun.mpaas20201028.Client;
import com.aliyun.mpaas20201028.models.CreateTemplateRequest;
import com.aliyun.mpaas20201028.models.CreateTemplateResponse;
import com.aliyun.teaopenapi.models.Config;

public static void main(String[] args) throws Exception {
    // An Alibaba Cloud account AccessKey has full permissions for all APIs. We recommend that you use a RAM user for API calls and daily O&M.
    // We strongly recommend that you do not hard-code the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all your resources.
    // This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
    // We recommend that you configure the environment variables first.
    Config config = new Config();
    // Required. Your AccessKey ID.
    config.setAccessKeyId(System.getenv("MPAAS_AK_ENV"));
    // Required. Your AccessKey secret.
    config.setAccessKeySecret(System.getenv("MPAAS_SK_ENV"));
    // The REGION_ID and Endpoint of mPaaS. This example uses the China (Hangzhou) region.
    config.setRegionId("cn-hangzhou");
    config.setEndpoint("mpaas.cn-hangzhou.aliyuncs.com");
    Client client = new Client(config);

    CreateTemplateRequest request = new CreateTemplateRequest();
    request.setAppId("ONEX570DA89211721");
    request.setWorkspaceId("test");
    request.setTenantId("xxx");
    request.setTemplateName("CreateTestTemplate");
    request.setContent("Test template content");
    request.setTitle("Test template title");
    request.setDescInfo("Test template description");
    CreateTemplateResponse response = client.createTemplate(request);
    System.out.println("response==>"+JSON.toJSONString(response));
}

Delete a template

Input parameters

Parameter

Type

Required

Example

Description

templateId

String

No

8346

Specify either `templateId` or `templateName`. `templateId` has a higher priority.

templateName

String

No

Test

Specify either `templateName` or `templateId`.

Output parameters

The `Data` field is null.

Examples

import com.alibaba.fastjson.JSON;
import com.aliyun.mpaas20201028.Client;
import com.aliyun.mpaas20201028.models.DeleteTemplateRequest;
import com.aliyun.mpaas20201028.models.DeleteTemplateResponse;
import com.aliyun.teaopenapi.models.Config;

public static void main(String[] args) throws Exception {
    // An Alibaba Cloud account AccessKey has full permissions for all APIs. We recommend that you use a RAM user for API calls and daily O&M.
    // We strongly recommend that you do not hard-code the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all your resources.
    // This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
    // We recommend that you configure the environment variables first.
    Config config = new Config();
    // Required. Your AccessKey ID.
    config.setAccessKeyId(System.getenv("MPAAS_AK_ENV"));
    // Required. Your AccessKey secret.
    config.setAccessKeySecret(System.getenv("MPAAS_SK_ENV"));
    // The REGION_ID and Endpoint of mPaaS. This example uses the China (Hangzhou) region.
    config.setRegionId("cn-hangzhou");
    config.setEndpoint("mpaas.cn-hangzhou.aliyuncs.com");
    Client client = new Client(config);

    DeleteTemplateRequest request = new DeleteTemplateRequest();
    request.setAppId("ONEX570DA89211721");
    request.setWorkspaceId("test");
    request.setTenantId("xxx");
    request.setTemplateName("CreateTestTemplate");
    DeleteTemplateResponse response = client.deleteTemplate(request);
    System.out.println("response==>"+JSON.toJSONString(response));
}

Paged query

Input parameters

Parameter

Type

Required

Example

Description

currentPage

int

No

1

The current page number. Default value: 1.

pageSize

int

No

100

The number of records per page. Default value: 100.

Output parameters

The `Data` type is `List<Template>`.

Template

Parameter

Type

Example

Description

id

String

8346

The template ID.

name

String

Test

The template name.

descInfo

String

Template description

The template description.

title

String

Template title

The title.

content

String

Template content

The content.

uri

String

mpaas://landing/startLand

The redirection URL.

variables

String

title,content

The placeholder fields.

showStyle

String

0

Indicates whether silence mode is used.

imageUrls

String

{"defaultUrl": "http://111"}

The large image URL.

iconUrls

String

{"defaultUrl": "http://111"}

The icon URL.

pushStyle

String

0

The display style.

action

String

0

The action type after a click.

gmtCreate

String

1587376706000

The creation time.

gmtModified

String

1587376706000

The modification time.

Examples

import com.alibaba.fastjson.JSON;
import com.aliyun.mpaas20201028.Client;
import com.aliyun.mpaas20201028.models.ListTemplatePageRequest;
import com.aliyun.mpaas20201028.models.ListTemplatePageResponse;
import com.aliyun.teaopenapi.models.Config;

public static void main(String[] args) throws Exception {
    // An Alibaba Cloud account AccessKey has full permissions for all APIs. We recommend that you use a RAM user for API calls and daily O&M.
    // We strongly recommend that you do not hard-code the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all your resources.
    // This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
    // We recommend that you configure the environment variables first.
    Config config = new Config();
    // Required. Your AccessKey ID.
    config.setAccessKeyId(System.getenv("MPAAS_AK_ENV"));
    // Required. Your AccessKey secret.
    config.setAccessKeySecret(System.getenv("MPAAS_SK_ENV"));
    // The REGION_ID and Endpoint of mPaaS. This example uses the China (Hangzhou) region.
    config.setRegionId("cn-hangzhou");
    config.setEndpoint("mpaas.cn-hangzhou.aliyuncs.com");
    Client client = new Client(config);

    ListTemplatePageRequest request = new ListTemplatePageRequest();
    request.setAppId("ONEX570DA89211721");
    request.setWorkspaceId("test");
    request.setTenantId("xxx");
    request.setCurrentPage(1);
    request.setPageSize(2);
    ListTemplatePageResponse response = client.listTemplatePage(request);
    System.out.println("response==>"+JSON.toJSONString(response));
}

Single query

Input parameters

Parameter

Type

Required

Example

Description

templateId

String

No

8346

Specify either `templateId` or `templateName`. `templateId` has a higher priority.

templateName

String

No

Test

Specify either `templateName` or `templateId`.

Output parameters

The `Data` type is `Template`.

Template

Parameter

Type

Example

Description

id

String

8346

The template ID.

name

String

Test

The template name.

descInfo

String

Template description

The template description.

title

String

Template title

The title.

content

String

Template content

The content.

uri

String

mpaas://landing/startLand

The redirection URL.

variables

String

title,content

The placeholder fields.

showStyle

String

0

Indicates whether silence mode is used.

imageUrls

String

{"defaultUrl": "http://111"}

The large image URL.

iconUrls

String

{"defaultUrl": "http://111"}

The icon URL.

pushStyle

String

0

The display style.

action

String

0

The action type after a click.

gmtCreate

String

1587376706000

The creation time.

gmtModified

String

1587376706000

The modification time.

Examples

import com.alibaba.fastjson.JSON;
import com.aliyun.mpaas20201028.Client;
import com.aliyun.mpaas20201028.models.GetTemplateRequest;
import com.aliyun.mpaas20201028.models.GetTemplateResponse;
import com.aliyun.teaopenapi.models.Config;

public static void main(String[] args) throws Exception {
    // An Alibaba Cloud account AccessKey has full permissions for all APIs. We recommend that you use a RAM user for API calls and daily O&M.
    // We strongly recommend that you do not hard-code the AccessKey ID and AccessKey secret in your project code. Otherwise, the AccessKey pair may be leaked and threaten the security of all your resources.
    // This example shows how to store the AccessKey ID and AccessKey secret in environment variables. You can also store them in a configuration file as needed.
    // We recommend that you configure the environment variables first.
    Config config = new Config();
    // Required. Your AccessKey ID.
    config.setAccessKeyId(System.getenv("MPAAS_AK_ENV"));
    // Required. Your AccessKey secret.
    config.setAccessKeySecret(System.getenv("MPAAS_SK_ENV"));
    // The REGION_ID and Endpoint of mPaaS. This example uses the China (Hangzhou) region.
    config.setRegionId("cn-hangzhou");
    config.setEndpoint("mpaas.cn-hangzhou.aliyuncs.com");
    Client client = new Client(config);

    GetTemplateRequest request = new GetTemplateRequest();
    request.setAppId("ONEX570DA89211721");
    request.setWorkspaceId("test");
    request.setTenantId("xxx");
    request.setTemplateName("TestTemplate");
    GetTemplateResponse response = client.getTemplate(request);
    System.out.println("response==>"+JSON.toJSONString(response));
}