/bolt.new-ai-integrations

Bolt.new AI and Expensify integration: Step-by-Step Guide 2025

Integrate Bolt.new AI with Expensify effortlessly. Follow our step-by-step guide to streamline expense management and gain AI-driven insights.

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 Expensify?

 

Setting Up the Package.json with Dependencies

 
  • Create a new file named package.json in the root of your Bolt.new AI project.
  • Copy and paste the following code snippet into package.json. This provides the necessary dependency (axios) for making HTTP requests to Expensify’s API:

{
  "name": "bolt-expensify-integration",
  "version": "1.0.0",
  "dependencies": {
    "axios": "^0.27.2"
  },
  "scripts": {
    "start": "tsc && node dist/index.js"
  }
}
  • Since Bolt.new AI does not have a terminal, simply adding this file enables the platform’s dependency management.

 

Creating the Expensify Client Module

 
  • Create a new file in your project named expensifyClient.ts. This module will handle all communications with Expensify’s API.
  • Paste the following TypeScript code into expensifyClient.ts. This sample code includes a function to create an expense in Expensify by posting the required payload:

import axios from 'axios';

const EXPENSIFYAPIURL = 'https://integrations.expensify.com/Integration-Server/ExpensifyIntegrations';

interface Expense {
  merchant: string;
  total: number;
  currency: string;
  // Add other expense properties as needed
}

interface ExpensifyCredentials {
  partnerUserID: string;
  partnerUserSecret: string;
}

// Replace these with your actual credentials
const credentials: ExpensifyCredentials = {
  partnerUserID: 'yourpartneruser_id',
  partnerUserSecret: 'yourpartneruser_secret'
};

export async function createExpense(expense: Expense): Promise {
  try {
    // Prepare the payload as required by Expensify’s API.
    const payload = {
      requestJobDescription: {
        type: 'create',
        credentials: credentials,
        inputSettings: {
          type: 'expense',
          merchant: expense.merchant,
          total: expense.total,
          currency: expense.currency
          // Map additional fields if necessary
        }
      }
    };

    // Make a POST request to Expensify
    const response = await axios.post(EXPENSIFYAPIURL, payload, {
      headers: {
        'Content-Type': 'application/json'
      }
    });

    return response.data;
  } catch (error) {
    // Handle and rethrow errors for further processing in your app
    throw error;
  }
}
  • This module imports axios and defines the interface for the expense object. It sends a POST request to Expensify’s API endpoint with the required credentials and expense data.

 

Integrating the Expensify Client into Your Main Application

 
  • Locate your main TypeScript file (for example, index.ts or app.ts) within your Bolt.new AI project.
  • At the top of the file, import the createExpense function from your newly created expensifyClient.ts module:

import { createExpense } from './expensifyClient';
  • You can now call createExpense wherever needed in your code. For a simple test, add the following code snippet in your main file to invoke the Expensify integration:

async function testExpensifyIntegration() {
  const expense = {
    merchant: 'Sample Merchant',
    total: 100.50,
    currency: 'USD'
    // Include additional fields as required
  };

  try {
    const result = await createExpense(expense);
    console.log('Expense created successfully:', result);
  } catch (error) {
    console.error('Error creating expense:', error);
  }
}

// Call the test function (you can eventually trigger this on a button click or other event)
testExpensifyIntegration();
  • This snippet defines an asynchronous function that creates a sample expense and logs the result or any error encountered during the API call.

 

Finalizing Your Integration

 
  • Review all your changes to ensure that package.json, expensifyClient.ts, and your main application file have been saved.
  • Since Bolt.new AI builds your project automatically, when you trigger your application (for example, via a button click or page load), the testExpensifyIntegration function will run and integrate with Expensify.
  • Monitor the console logs to verify that the expense is created successfully or to debug any errors.

 

Notes and Customization

 
  • Replace yourpartneruserid and yourpartnerusersecret in expensifyClient.ts with your actual Expensify API credentials.
  • If your project grows, consider handling errors and API responses more gracefully (for example, retry logic or user notifications).
  • Customize the Expense interface and payload mapping in the createExpense function according to your specific use-case and the Expensify API documentation.

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