0.5.0 • Published 3 years ago
@arrebole/mms v0.5.0
Multimedia Messaging Service
install
npm install @arrebole/mms
example
build mms
const { MultimediaMessage } = requir('@arrebole/mms');
const multimediaMessage = new MultimediaMessage({
title: '[upyun 测试]',
frames: [
{
duration: 5,
files: [
{ mediaType: 'txt', media: Buffer.from('测试测试') }
],
},
{
duration: 6,
files: [
{ mediaType: 'txt', media: Buffer.from('测试测试2') }
],
},
],
});
// => 5,txt|测试测试;6,txt|测试测试2
console.log(multimediaMessage.content);
send mms
const { RundaPlatform } = requir('@arrebole/mms');
const rundaPlatform = new RundaPlatform({
appId: APPID,
appKey: TEST_APPKEY,
});
async function sendMMS() {
const multimediaMessage = new MultimediaMessage({
title: '[upyun 测试]',
frames: [
{
duration: 5,
files: [{ mediaType: 'txt', media: Buffer.from('测试测试') }],
},
],
});
// create template
const createTemplateResult = await rundaPlatform.create(multimediaMessage);
// send message
const sendMMSResult = await rundaPlatform.send({
templateId: createTemplateResult.taskId,
phone: '181066XXXXX'
});
}