Skip to content

xuxucode/aliyun-openapi

Repository files navigation

aliyun-openapi

npm build status npm download

Aliyun OpenAPI

Installation

$ npm install aliyun-openapi

Open APIs

  • SMS
  • Email

Usage

SMS

import { AliyunClient, AliyunSmsOpenAPI } from 'aliyun-openapi'

const client = new AliyunClient({
  accessKeyId: 'your_access_key_id',
  accessKeySecret: 'your_access_key_secret',
  version: '2017-05-25',
  endpoint: 'dysmsapi.aliyuncs.com',
})
const openapi = new AliyunSmsOpenAPI(client)

await openapi.send('13812345678', 'TestSigner', 'SMS_12345678', { code: '123456' })

Email

import { AliyunClient, AliyunEmailOpenAPI } from 'aliyun-openapi'

const client = new AliyunClient({
  accessKeyId: 'your_access_key_id',
  accessKeySecret: 'your_access_key_secret',
  version: '2015-11-23',
  endpoint: 'dm.aliyuncs.com',
})
const openapi = new AliyunEmailOpenAPI(client)

await openapi.send('noreply@test.com', 'alice@test.com', 'Verification Code', `<h2>Verification code: 123456<h2>`)

TODO

  • Monorepo
  • Documentation

About

Aliyun OpenAPI

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published