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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wa-ma/react

v0.1.2

Published

React context providers and stateful hooks for integrating WAMA (WhatsApp Multi-Agent) client messaging in React and Next.js applications.

Readme

@wa-ma/react

WAMA WhatsApp Messaging hooks and context providers for React and Next.js applications.


Prerequisites

To use this integration library, you must first register an account and retrieve your WhatsApp instance API key from the WAMA Portal.


Installation

npm install @wa-ma/react @wa-ma/sdk

Features

  • React Context Provider: Supply the WAMA API key at the root of your application.
  • Client Component Compatibility: Bundles are packaged with the "use client"; directive, ensuring they compile cleanly in Next.js App Router projects.
  • Stateful Hook (useWama): Automatically tracks the loading, success, error, and messageId states for seamless UI updates.

Usage

1. Configure the Provider

Wrap your React root or Next.js App layout in the WamaProvider:

import React from "react";
import { WamaProvider } from "@wa-ma/react";

export default function App() {
  return (
    <WamaProvider apiKey="YOUR_WHATSAPP_API_KEY">
      <MessageSender />
    </WamaProvider>
  );
}

2. Use the Hooks

Retrieve the client and send messages from child components:

import React, { useState } from "react";
import { useWama } from "@wa-ma/react";

export function MessageSender() {
  const { sendMessage, loading, success, error } = useWama();
  const [recipient, setRecipient] = useState("");
  const [message, setMessage] = useState("");

  const handleSend = async () => {
    await sendMessage(recipient, message);
  };

  return (
    <div>
      <input 
        placeholder="Recipient Number" 
        value={recipient} 
        onChange={(e) => setRecipient(e.target.value)} 
      />
      <textarea 
        placeholder="Message content" 
        value={message} 
        onChange={(e) => setMessage(e.target.value)} 
      />
      
      <button onClick={handleSend} disabled={loading}>
        {loading ? "Sending..." : "Send Message"}
      </button>

      {success === true && <p>Message queued successfully!</p>}
      {error && <p style={{ color: "red" }}>Error: {error}</p>}
    </div>
  );
}

3. Inline Initialization (Without Provider)

You can optionally bypass the context provider and pass the token directly to the hook:

import { useWama } from "@wa-ma/react";

function SimpleButton() {
  // Configures the hook directly for one-off actions
  const { sendMessage } = useWama("YOUR_WHATSAPP_API_KEY");
  
  return (
    <button onClick={() => sendMessage("+966501234567", "Quick Hello!")}>
      Quick Send
    </button>
  );
}