/bolt.new-ai-integrations

Bolt.new AI and Smooch (now Zendesk Sunshine Conversations) integration: Step-by-Step Guide 2025

Discover a simple guide to integrate Bolt.new AI with Smooch (Zendesk Sunshine Conversations) for seamless messaging and automated customer engagement.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

How to integrate Bolt.new AI with Smooch (now Zendesk Sunshine Conversations)?

 

Step 1: Creating the Smooch Client Setup File

 
  • Create a new file in your project called smoochClient.ts (e.g. inside a folder named integrations).
  • Add the following TypeScript code to initialize the Smooch (Sunshine Conversations) client. This file sets up the connection using your API credentials. (Since Bolt.new AI does not let you run terminal commands, you include dependency import statements directly in your code. The dependency will be automatically installed if it’s defined in your project’s package configuration.)

import SmoochCore from 'smooch-core';

const smoochClient = new SmoochCore({
  keyId: process.env.SMOOCHKEYID || 'yourkeyid',
  secret: process.env.SMOOCHSECRET || 'yoursecret'
});

export default smoochClient;
  • Replace 'yourkeyid' and 'your_secret' with your actual Sunshine Conversations API credentials or set them via environment variables.

 

Step 2: Creating the Webhook Handler File

 
  • Create a new file called smoochWebhook.ts (for example, inside a folder named webhooks).
  • This file will process incoming webhook events from Sunshine Conversations. Paste the code snippet below:

import { Request, Response } from 'express';

// This function handles incoming webhook events from Smooch/Sunshine Conversations.
export const handleSmoochWebhook = async (req: Request, res: Response) => {
  try {
    // Log the incoming webhook data for debugging
    console.log('Received Smooch webhook:', req.body);

    // Process the webhook event.
    // For example, if it is a message event, you might extract details:
    const event = req.body;
    if (event && event.trigger === 'message:appUser') {
      // Extract relevant data
      const appUserId = event.appUser && event.appUser._id;
      const message = event.message && event.message.text;
      console.log(Message from app user ${appUserId}: ${message});
      
      // Add your custom logic here (e.g. send this message to Bolt.new AI for further processing)
    }

    // Respond with 200 OK to acknowledge receipt
    res.status(200).send('Webhook received');
  } catch (error) {
    console.error('Error processing Smooch webhook:', error);
    res.status(500).send('Internal Server Error');
  }
};
  • This webhook handler simply logs incoming data and can be extended to tie into any further business logic in your Bolt.new AI project.

 

Step 3: Exposing the Webhook Endpoint in Your Bolt.new AI Project

 
  • Locate your main application file (commonly index.ts or app.ts).
  • Depending on how your project is structured, you will add an endpoint so Sunshine Conversations can send webhook events to your application. Insert the following code where you register your Express routes:

import express from 'express';
import bodyParser from 'body-parser';
import { handleSmoochWebhook } from './webhooks/smoochWebhook';

const app = express();

// Middleware to parse JSON bodies
app.use(bodyParser.json());

// Define your webhook endpoint
app.post('/webhook', handleSmoochWebhook);

// Other routes and middleware may already exist here

// Start your server
const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
  console.log(Server is running on port ${PORT});
});
  • This code creates a POST endpoint at /webhook that will receive JSON data from Sunshine Conversations.

 

Step 4: Sending a Message via the Smooch Client

 
  • Create a new file named sendMessage.ts (you may put it in a services folder).
  • This file will contain a function that sends a message using the Smooch client.
  • Insert the code snippet below:

import smoochClient from './smoochClient';

export const sendMessage = async (appUserId: string, messageText: string) => {
  try {
    const response = await smoochClient.appUsers.sendMessage(appUserId, {
      type: 'text',
      text: messageText
    });
    console.log('Message sent successfully:', response);
    return response;
  } catch (error) {
    console.error('Error sending message:', error);
    throw error;
  }
};
  • You can call sendMessage from anywhere in your project. For example, integrate it in your conversational logic to respond to users.

 

Step 5: Configuring Your Environment Variables

 
  • Since Bolt.new AI does not provide a terminal, you may have to define your environment variables within your project’s configuration file (if available) or directly in your code for testing.
  • If you have an option to add environment variables in your project’s settings, add the following keys:

// Example of how you might set defaults in your code
process.env.SMOOCHKEYID = 'yourkeyid';
process.env.SMOOCHSECRET = 'yoursecret';
  • Replace the placeholder texts with your real API credentials. Be sure not to expose sensitive information in production code.

 

Step 6: Testing Your Integration

 
  • Ensure that your webhook endpoint (/webhook) is publicly accessible by Sunshine Conversations. You might need to set up an HTTPS endpoint or use a tunnel service during development.
  • Simulate a webhook event by sending a POST request with sample payload data. You can use online tools or your project’s interface to trigger and monitor responses.
  • Verify that messages are logged and that your sendMessage function sends a message as expected.

 
By following these steps, you integrate Zendesk Sunshine Conversations (formerly Smooch) into your Bolt.new AI project. Each change is contained in specific files to keep your project modular and easy to manage.

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022