npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@ingestkorea/client-sens

v1.5.3

Published

INGESTKOREA SDK Naver Cloud Platform SENS Client for Node.js.

Downloads

46

Readme

@ingestkorea/client-sens

npm (scoped) npm downloads build status license

Description

INGESTKOREA SDK Naver Cloud Platform SENS Client for Node.js.

Installing

npm install @ingestkorea/client-sens

Getting Started

Pre-requisites

  • Use TypeScript v5.x
  • Includes the TypeScript definitions for node.
    npm install -D typescript # save dev mode
    npm install -D @types/node # save dev mode

Support Commands

Kakao Alimtalk

  • SendAlimtalk
  • GetAlimtalkStatus
  • GetAlimtalkResult
  • GetAlimtalkTemplate
  • ListAlimtalkTemplates
  • ListAlimtalkChannels

SMS, LMS, MMS

  • SendSMS (SMS, LMS)
  • SendMMS (MMS)
  • GetSMSStatus (SMS, LMS, MMS)
  • GetSMSResult (SMS, LMS, MMS)

Import

import {
  SensClient,
  SendAlimtalkCommand,
  SendAlimtalkCommandInput,
  SendSMSCommand,
  SendSMSCommandInput,
  SendMMSCommand,
  SendMMSCommandInput,
} from "@ingestkorea/client-sens";

Usage

To send a request, you:

  • Initiate client with configuration.
  • Initiate command with input parameters.
  • Call send operation on client with command object as input.
// a client can be shared by different commands.
const client = new SensClient({
  credentials: {
    accessKey: ACCESS_KEY,
    secretKey: SECRET_KEY,
  },
  serviceId: {
    sms: "ncp:sms:kr:123456789xxx:your-service-name", // optional
    kakao: "ncp:kkobizmsg:kr:9876xxx:your-service-name", // optional
  },
});

/**
 * accessKey, secretKey: https://www.ncloud.com/mypage/manage/authkey
 * serviceId: https://console.ncloud.com/sens/project
 *
 * at least one serviceId required
 * if you call send operation without serviceId, sdk throw error
 */

SendAlimtalk

let params: SendAlimtalkCommandInput = {
  plusFriendId: PLUS_FRIEND_ID,
  templateCode: TEMPLATE_CODE,
  messages: [{ to: "01012345678", content: CONTENT }],
};
let command = new SendAlimtalkCommand(params);

SendSMS (SMS, LMS)

/**
 * Automatically set message type('SMS' | 'LMS') according to content-length(euc-kr)
 * SMS: max 90bytes
 * LMS: max 2000bytes
 */
let params: SendSMSCommandInput = {
  from: '01012345678',
  content: DEFAULT_CONTENT,
  messages: [
    { to: '0109182xxxx' },
    { to: '0104321xxxx', content?: OPTIONAL_CONTENT_01 }
    { to: '0108765xxxx', content?: OPTIONAL_CONTENT_02, subject?: OPTIONAL_SUBJECT_01 },
  ]
};
/**
 * If you do not define the subject and content within the messages,
 * it is sent with the value specified as the default subject('제목없음') and content.
 */
let command = new SendSMSCommand(params);

SendMMS (MMS)

import { readFileSync } from 'node:fs';

let params: SendMMSCommandInput = {
  from: '01012345678',
  content: DEFAULT_CONTENT,
  messages: [
    { to: '0109182xxxx' },
    { to: '0104321xxxx', content?: OPTIONAL_CONTENT_01 }
    { to: '0108765xxxx', content?: OPTIONAL_CONTENT_02, subject?: OPTIONAL_SUBJECT_01 },
  ],
  files: [ // support jpg, jpeg
    { name: '/your/absolute/path/sample-image-1.jpg' },
    {
      name: '/your/absolute/path/sample-image-2.jpg',
      body?: readFileSync('/your/absolute/path/sample-image-2.jpg', { encoding: 'base64' })
    }
  ]
};
/**
 * If you do not define the subject and content within the messages,
 * it is sent with the value specified as the default subject('제목없음') and content.
 */
let command = new SendMMSCommand(params);

Async/await

(async () => {
  try {
    const data = await client.send(command);
    console.dir(data, { depth: 4 });
  } catch (err) {
    console.dir(err, { depth: 4 });
  }
})();

Promises

client
  .send(command)
  .then((data) => console.dir(data, { depth: 4 }))
  .catch((err) => console.dir(err, { depth: 4 }));

License

This SDK is distributed under the MIT License, see LICENSE for more information.