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

react-native-genesys-chat

v1.0.0

Published

RN wrapper of genesys cloud SDK

Downloads

9

Readme

react-native-genesys-chat

A React Native plugin to integrate Genesys Chat SDK into your mobile applications, allowing you to manage chat sessions, send messages, and listen to events such as incoming messages, typing notifications, and more.

Features

  • Initialize chat sessions with Genesys.
  • Send messages to the Genesys chat service.
  • Listen for events like incoming messages and typing notifications.
  • Clean up and disconnect chat sessions.

Installation

To install the plugin, run:

npm install react-native-genesys-chat

Linking

If you are using React Native 0.60 or above, the package should be automatically linked. For older versions, you may need to link the package manually:

react-native link react-native-genesys-chat

Installation

For iOS, make sure to run:

  1. Add these sources to your Podfile:
source 'https://github.com/MyPureCloud/gc-sdk-specs'
source 'https://github.com/CocoaPods/Specs'
  1. Then, run:
cd ios/
pod install

This ensures that you have the correct sources configured for the genesys pod installation.

Usage

import React, { useEffect, useState } from "react";
import {
  setupMessengerTransport,
  genesysChatEventEmitter,
  sendMessage,
  disconnectAndCleanup,
} from "react-native-genesys-chat";
import { View } from "react-native";

const ChatComponent = () => {
  const [chats, setChats] = useState([]);
  const [isAgentCompanion, setIsAgentCompanion] = useState(false);
  const attributes = {};

  useEffect(() => {
    // Initialize the SDK with your deployment and domain details
    setupMessengerTransport(
      "PROD", // Deployment environment, e.g., 'PROD'
      "usw2.pure.cloud" // Domain
    );

    // Start chat session
    sendMessage("init chat", attributes); // 'attributes' is a additional options

    // Event listeners
    const genMsgSubscription = genesysChatEventEmitter.addListener(
      "onGenesysMessage",
      (message) => {
        if (!isAgentCompanion && message.from === "human") {
          setIsAgentCompanion(true);
        }
        setChats((prevChats) => [...prevChats, message]);
      }
    );

    const genEventsSubscription = genesysChatEventEmitter.addListener(
      "onTyping",
      (events) => {
        console.log("Typing Event:", events);
      }
    );

    return () => {
      disconnectAndCleanup();
      genMsgSubscription.remove();
      genEventsSubscription.remove();
    };
  }, []);

  return <View>{/* Render chats or other UI components here */}</View>;
};

export default ChatComponent;

API

setupMessengerTransport(deploymentId: string, domain: string, attributes?: { [key: string]: string }, logging: boolean = false)

Sets up the messaging transport for the chat SDK.

Parameters:

  • deploymentId: The deployment environment (e.g., 'PROD').
  • domain: The domain for your Genesys environment (e.g., 'usw2.pure.cloud').
  • attributes: Optional attributes to send with the session.
  • logging: Optional boolean for enabling logging (default is false).

sendMessage(query: string, attributes?: { [key: string]: string })

Sends a message to the Genesys chat service.

Parameters:

  • query: The message you want to send.
  • attributes: Optional custom attributes to attach to the message.

disconnectAndCleanup()

Disconnects and cleans up the chat session when finished.

Parameters: None.

Events

The package exposes several events that you can listen to using the genesysChatEventEmitter.

onGenesysMessage

  • Description: Triggered when a new message is sent or received from the chat service.
  • Callback Signature: (message: Message) => void
    • message: The message object containing details like from, text, etc.

onTyping

  • Description: Triggered when a user is typing a message in the chat.
  • Callback Signature: (state: TypingState) => void
    • state: The typing state object containing:
      • isTyping: A boolean indicating whether the user is typing.
      • durationInMilliseconds: (optional) The duration in milliseconds that the user has been typing.

onMessengerState

  • Description: Triggered when the messenger state changes (e.g., started, ended).
  • Callback Signature: (state: MessengerState) => void
    • state: The messenger state object containing:
      • state: The current state of the messenger, which can be 'started' or 'ended'.

onMessengerError

  • Description: Triggered when an error occurs within the messenger.
  • Callback Signature: (error: unknown) => void
    • error: The error object containing the details of the issue.

Contributing

Contributions are welcome! Please feel free to fork this repository, create a branch, and submit pull requests. For any issues or feature requests, please open an issue in the GitHub repository.

License

This project is licensed under the MIT License - see the LICENSE file for details.