Message Push provides software development kits (SDKs) for Java, Python, Node.js, and PHP. Install the SDK for your language before sending push messages.
Java
The latest version of the Message Push V2.0 SDK is 5.0.2 for users in non-finance regions. For users in finance regions, the latest version is 2.1.11.
Add the following dependencies to your Maven project:
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>mpaas20201028</artifactId>
<version>5.0.1</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>tea-openapi</artifactId>
<version>0.3.6</version>
</dependency>
Python
Run the following commands to install the SDK:
# Alibaba Cloud SDK
pip install aliyun-python-sdk-core
# mPaaS SDK
pip install aliyun-python-sdk-mpaas
Node.js
Run the following command to install the SDK:
npm i @alicloud/mpaas20190821
PHP
Run the following command to install the SDK using Composer:
composer require alibabacloud/sdk
Environment variable configuration
Set the MPAAS_AK_ENV and MPAAS_SK_ENV environment variables to authenticate the SDK with your AccessKey credentials.
-
On Linux and macOS, run:
export MPAAS_AK_ENV=<access_key_id> export MPAAS_SK_ENV=<access_key_secret>NoteReplace
access_key_idwith your AccessKey ID andaccess_key_secretwith your AccessKey secret. -
On Windows:
Create the
MPAAS_AK_ENVandMPAAS_SK_ENVenvironment variables and set their values to your AccessKey ID and AccessKey secret.Restart Windows.