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

zalo-api-service

v1.4.6

Published

A wrapper library to help integrate with Zalo API.

Downloads

2

Readme

Zalo API

Integrate with Zalo API easily. Support typescript with types of request and response following Zalo documentation.

Getting started

Install with npm

npm i zalo-api

or yarn

yarn add zalo-api

Zalo API mapping

| Zalo docs | This library | Status | |:-|:-|:-:| | Social API | | Get access token | Social.access_token() | :white_check_mark: | | Send message to friend | Social.message() | :white_check_mark: | | Invite friend | Social.app_request() | :white_check_mark: | Post feed | Social.feed() | :white_check_mark: | | List friends | Social.friends() | :white_check_mark: | | Invitable friends | Social.invitable_friends() | :white_check_mark: | | Get profile | Social.profile() | :white_check_mark: | | Official Account API | | Reply follower's message | OA.reply_message() | :white_check_mark: | | Send message | OA.message() Shortcut APIs: OA.text_message() OA.media_message() OA.list_message() OA.request_info_message() | :white_check_mark: | | Broadcast | OA.broadcast() | :white_check_mark: | | Update follower info | OA.update_follower_info() | :white_check_mark: | | Manage IP | OA.register_ip()OA.remove_ip() | :white_check_mark: | | Get infos | OA.get_followers()OA.get_profile()OA.get_info()OA.get_recent_chat()OA.get_conversation() | :white_check_mark: | | Upload image/file | OA.upload_image()OA.upload_gif()OA.upload_file() | :white_check_mark: | | Get/assign/remove tags | OA.list_tags()OA.assign_tag()OA.remove_follower_tag()OA.delete_tag() | :white_check_mark: | | Shop API| | Attributes type CRUD | | :white_square_button: | | Upload photo | | :white_square_button: | | Get industry | | :white_square_button: | | Category | | :white_square_button: | | Create order | | :white_square_button: | | Manage order | | :white_square_button: | | Products | | :white_square_button: | | Article API| | Create article | | :white_square_button: | | Upload video for article | | :white_square_button: | | Get article ID | | :white_square_button: | | Get article details | | :white_square_button: | | Get list articles | | :white_square_button: | | Delete article | | :white_square_button: | | Update article | | :white_square_button: |

Using Zalo API integration

Social API

Get access token

Parameters

{
  app_id: string,
  app_secret: string,
  code: string,
  redirect_uri?: string
}

Return

{
  access_token: string,
  expires_in: number
}

Example

import { Social } from 'zalo-api';

const access_token = Social.access_token({
  app_id: 'your_app_id', // process.env.zalo_app_id
  app_secret: 'your_app_secret', // process.env.zalo_app_secret
  code: 'your_oauth_code', // refer document here https://developers.zalo.me/docs/api/social-api/tham-khao/user-access-token-post-4316
})

Official Account API

OA Message

Send generic message with all available parameters Parameters

{
  access_token: string,
  recipient: {
    message_id?: string,
    user_id?: string,
    target?: {}
  },
  message: {
    text?: string,
    attachment?: {
      type: 'template' | 'file',
      payload: {
        template_type?: 'list' | 'media' | 'request_user_info'
        elements?: {} //Depends on types
        buttons?: {}
        ...
      } 
    }
  }
}

Return (same for all message API)

{
  error?: number,
  message: string,
  data?: {
    message_id: string
  }
}

Example

import { OA } from 'zalo-api';

const access_token = OA.message({
  access_token: 'your_oa_access_token', // https://developers.zalo.me/docs/api/official-account-api/phu-luc/official-account-access-token-post-4307
  recipient: {
    user_id: 'user_id'
  }
  message: {
    text: 'Hello Zalo API'
  }
})