Socket
Socket
Sign inDemoInstall

react-whatsapp-chat-widget

Package Overview
Dependencies
0
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    react-whatsapp-chat-widget

WhatsApp chat widget for react app


Version published
Weekly downloads
76
decreased by-54.22%
Maintainers
1
Install size
28.6 kB
Created
Weekly downloads
 

Readme

Source

react-whatsapp-chat-widget

npm version   License: MIT

This is a Whatsapp Chat Widget for react where you can use as a plugin in your react project with full customization of your own.

Getting Started

npm install react-whatsapp-chat-widget
# or
yarn add react-whatsapp-chat-widget

⚠️ If you get "Uncaught SyntaxError: Cannot use import statement outside a module" when importing ECMAScript 6, then your app must be SSR enabled like in NextJS. To resolve the issue in nextJS visit here

For demo

Visit our site to see react-whatsapp-chat-widget live performance

Usage

import React from "react";

import WhatsAppWidget from "react-whatsapp-chat-widget";
import "react-whatsapp-chat-widget/index.css";

const ReactApp = () => {
	return (
		<WhatsAppWidget
			phoneNo="919884098840"
			position="right"
			widgetWidth="300px"
			widgetWidthMobile="260px"
			autoOpen={true}
			autoOpenTimer={5000}
			messageBox={true}
			messageBoxTxt="Hi Team, is there any related service available ?"
			iconSize="40"
			iconColor="white"
			iconBgColor="tomato"
			headerIcon="https://www.pdapps.net.in/_next/static/media/android-chrome-192x192.9a39c2c7.png"
			headerIconColor="pink"
			headerTxtColor="black"
			headerBgColor="tomato"
			headerTitle="John Doe"
			headerCaption="Online"
			bodyBgColor="#bbb"
			chatPersonName="Support"
			chatMessage={<>Hi there 👋 <br /><br /> How can I help you?</>}
			footerBgColor="#999"
			placeholder="Type a message.."
			btnBgColor="yellow"
			btnTxt="Start Chat"
			btnTxtColor="black"
		/>
	);
};

export default ReactApp;

⚠️ The phoneNo is a full phone number in international format. Omit any zeroes, brackets, or dashes when adding the phone number in international format.

Example: 919884098840 where 91 is the International code for India.

PropertyTypeDefaultDescription
phoneNostring''WhatsApp international no. which will receive the message.
positionstring'right'Position the widget to left bottom or right bottom (Enum 'left', 'right')
widgetWidthstring'300px'Width of the entire widget for devices more than '360px' width
widgetWidthMobilestring'260px'Width of the entire widget for devices less than '360px' width like mobile devices
autoOpenboolean'false'Open the chat box automatically
autoOpenTimerstring, number3000 in millisecondsSet timer to open the chat box automatically
messageBoxbooleanfalseMessage box is hidden by default, so you can enable it if needed
messageBoxTxtstring''If Message box is enabled, you can put the default text for the user to start up with the conversation
iconSizestring'52'Fix the size of the chat icon
iconColorstring'rgb(37, 211, 102)'Chat icon color (HexCode, RGB format)
iconBgColorstring'#ffffff'Chat icon background color (HexCode, RGB format)
headerIconstringreactNode svg iconProfile icon in the header as a profile image or use the default svg icon (image uri see the example above)
headerIconColorstring'rgb(100, 100, 100)'Profile icon color in the header (this works only when default svg icon is used)
headerTxtColorstring'rgb(255, 255, 255)'Header text color
headerBgColorstring'rgb(7, 94, 84)'Header background color
headerTitlestring'Customer Support'Header title
headerCaptionstringOnlineHeader caption
bodyBgColorstring'rgb(227, 220, 213)'Chat body background color
chatPersonNamestring'Support'Person name in the chat bubble
chatMessagereactNode<>Hi there 👋 <br /><br /> How can I help you?</>Message text in the chat bubble
footerBgColorstring'rgb(255, 255, 255)'Footer background color
placeholderstringType a message..Placeholder for text input
btnBgColorstring'rgb(79, 206, 93)'Start chat button background color
btnTxtstring'rgb(255, 255, 255)'Start chat button text
btnTxtColorstring'rgb(255, 255, 255)'Start chat button text color

License

MIT

Created by

Proficient Designers proficientdesigners.com

Keywords

FAQs

Last updated on 05 Feb 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc