Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@freeday-ai/chat-widget

Package Overview
Dependencies
Maintainers
2
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@freeday-ai/chat-widget

Freeday chat widget

  • 0.0.7
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
2
Weekly downloads
 
Created
Source

@freeday-ai/chat-widget

Freeday chat widget

NPM Downloads JavaScript Style Guide

Demo

Available at https://chat-widget.freeday.chat

portal-chat-demo

Install

npm install --save @freeday-ai/chat-widget

Usage

First, sign up at https://freeday.me/register to get your account token. Your account token is what you will use to pass in as the token prop below.

Using in HTML

Paste the code below between your <head> and </head> tags:

<script>
  window.Freeday = {
    config: {
      // Pass in your Freeday account token here after signing up
      token: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx',
      title: 'Welcome to Freeday!',
      subtitle: 'Ask us anything in the chat window below 😊',
      // Optionally render inside a different theme
      theme: "freeday_v2"
      primaryColor: '#13c2c2',
      // Optionally pass in a default greeting
      greeting: 'Hi there! How can I help you?',
      // Optionally specify the base URL
      baseUrl: 'https://beta-webchat.freeday.chat',
    },
  };
</script>
<script
  type="text/javascript"
  async
  defer
  src="https://chat-widget.freeday.chat/widget.js"
></script>

Using in React

Place the code below in any pages on which you would like to render the widget. If you'd like to render it in all pages by default, place it in the root component of your app.

import React from 'react';

import {ChatWidget} from '@freeday-ai/chat-widget';

// You can also import the following
// import {ChatWidget, ChatWindow, Freeday} from '@freeday-ai/chat-widget';
//
// The `ChatWindow` component allows you to embed the chat however you want,
// and the `Freeday` object provides access to functions that can programmatically
// open/close the chat widget, e.g.:
//
// `Freeday.open()` // => opens the chat widget
// `Freeday.close()` // => closes the chat widget
// `Freeday.toggle()` // => toggles (opens or closes) the chat widget

const ExamplePage = () => {
  return (
    <>
      {/*
        Put <ChatWidget /> at the bottom of whatever pages you would
        like to render the widget on, or in your root/router component
        if you would like it to render on every page
      */}
      <ChatWidget
        // Pass in your Freeday account token here after signing up
        token='xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxx'
        title='Welcome to Freeday!'
        subtitle='Ask us anything in the chat window below 😊'
        primaryColor='#13c2c2'
        theme='freeday_v2'
      />
    </>
  );
};

Options

These are the props you can pass into your <ChatWidget /> React component, or the fields you can specify in your Freeday.config:

PropTypeValueDefault
tokenstringYour Freeday account tokenN/A
titlestringThe title in the header of your chat widgetWelcome!
subtitlestringThe subtitle in the header of your chat widgetHow can we help you?
primaryColorstringThe theme color of your chat widget1890ff
avatarstringAn optional An optional initial image url to be used as avatarN/A
iframeUrlOverridestringAn override of the iframe URL we use to render the chat, if you have a custom intergration
isOpenByDefaultbooleanIf you want the chat widget to open as soon as it loadsfalse
persistOpenStatebooleanPersists the open state of the chat across pagesfalse
hideToggleButtonbooleanHides the toggle button in case you want to open/close programmaticallyfalse
customIconUrlstringA link to a custom icon image URLN/A
iconVariant'outlined' | 'filled'The style of the default iconoutlined
position'right' | 'left'The position of the chat on the pageright
stylesobjectInline style overrides for chatContainer, toggleContainer, and toggleButton{}
onChatLoaded({open, close, identify}) => voidCallback fired when chat is loaded, returning some utility functionsN/A
onChatOpened() => voidCallback fired when chat is openedN/A
onChatClosed() => voidCallback fired when chat is closedN/A

Development

To build the project, run npm start in the root directory. (If you're running it for the first time, you'll have to run npm install first.)

npm install
npm start

To test it out, use the /example directory:

cd example
npm install
npm start

This will start a development server on http://localhost:3000 by default, and open up the example app in your browser.

Important notes

By default, the example widget points at development servers for the Freeday API (which runs at http://localhost:4000). These values are set with the iframeUrlOverride props respectively.

If you want to develop against your account in production, you can update these values to the following:

  • iframeUrlOverride: https://chat-widget.freeday.chat

(Note that you can also simply remove these props, since the values above are the defaults.)

You'll also want to update your account token to point to your own account. If you haven't already, create a free account at https://freeday.me/register to get started.

Once you have your account token, update the token prop to point at yours.

Questions?

If you're having any trouble getting started or just want to say hi, ask Beaudinn add Slack.

FAQs

Package last updated on 03 Nov 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc