Code Monkey home page Code Monkey logo

react-whatsapp-widget's Introduction

react-whatsapp-widget

WhatsApp chat widget for your website

NPM JavaScript Style Guide

Custom settings

What is this?

This is a very simple floating WhatsApp button widget. Due to the impact of covid-19 in 2020, most small businesses had to move to an online presence. One of the wey to improve communication with your customers is using a widget like this.

It adds a floating-like button to your site that calls the WhatsApp Chat API.

It will automatically begin a WhatsApp chat to the number you configure and the text the user writes.

All texts are fully customizable and also you can provide an icon/logo.

Install

npm install --save react-whatsapp-widget

Usage

import React from 'react';
// This is the way to import an SVG file and then pass it as a props
import { ReactComponent as CompanyIcon } from './assets/crown.svg';

import { WhatsAppWidget } from 'react-whatsapp-widget';
import 'react-whatsapp-widget/dist/index.css';

const App = () => {
    return (
        <WhatsAppWidget CompanyIcon={CompanyIcon} phoneNumber="XXXXXXXXXX" />
    );
};

โš ๏ธ Where the phoneNumber is a full phone number in international format. Omit any zeroes, brackets, or dashes when adding the phone number in international format.

Example: 541112222222 where 54 is the Argentina internacional code.

Customization

option value default description
phoneNumber string '' WhatsApp intenational number which will receive the message.
CompanyIcon Component BiSupport Your company SVG icon
companyName string 'Support' Your company name
replyTimeText string 'Typically replies within a day'
message string 'Hello! ๐Ÿ‘‹๐Ÿผ \n\nWhat can we do for you?' With \n you can create a break-line.
sendButtonText string 'Send' Text inside the send button
inputPlaceHolder string 'Type a message' Placeholder text of the message input
open boolean false If true the chatbox will be open as default

Contributing

After cloning the repository, you have to run the following commands in two different terminal tabs to start the development environment.

cd react-whatsapp-widget
npm install
npm start
cd react-whatsapp-widget/example
npm install
npm start

The first command watches the src/ and recompiles it into the dist/ folder when you make changes.

The second command runs the example app that links to your local package.

๐Ÿš€ Pull requests are welcome!

License

MIT ยฉ ann0nip

react-whatsapp-widget's People

Contributors

ann0nip avatar karlosq avatar bre7 avatar vitorregisrr avatar kmalaver avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.