This is a recipe for triggering an event on a website that causes a message to be sent to a new user.
When you run the web server included with this sample code, a website will be served with a Smooch Web messenger instance and a button element that triggers a server-side event. The web server listens for this event and sends a message to the Smooch user when triggered. If no user exists already one is created on the client before triggering the event.
- Create a .env file and fill in the environment variables based on the contents of .env.example.
- Run
npm install
. - Run
npm start
. - Visit
http://localhost:<the_port_you_configured>
in your browser.