The IBM Cloud Spending Monitor API fetches spending data from IBM Cloud's Usage Reports API for a specific period of time and sends it to a telex channel every hour interval. This integration helps track cloud spending over time.
- Retrieves IBM Cloud usage data from
- Fetches spending data for each billing month (YYYY-MM format).
- Sends the data to a telex channel webhook to update user.
- Uses Express.js as the backend framework.
- Uses Axios for making HTTP requests.
- Supports environment variables for secure API authentication.
git clone https://github.com/AndreD17/ibm-cloud-spend-monitor.git
cd ibm-cloud-spend-monitor
npm install
touch .env
Add the following environment variables:
PORT=3000
IBM_ACCOUNT_ID=your_ibm_account_id
IBM_IAM_TOKEN=your_iam_token
WEBHOOK_URL=https://your-webhook-url.com
Note: Replace
your_ibm_account_id
,your_iam_token
, andyour-webhook-url.com
with your actual values.
node index.js
Fetches spending data for a stipulated time e.g a month and sends it to a specific telex channel using the webhook url provided.
📌 Example Request:
curl -X POST http://localhost:3000/send-spending
📌 Example Response:
{
"message": "Spending data sent to webhook successfully!"
}
- Node.js - JavaScript runtime
- Express.js - Backend framework
- Axios - HTTP requests
- Dotenv - Environment variable management
--- To test url's copy and paste this links to your browser, check test channel@andreub for update or any webhook channel you add for spending details.
- GET https://ibm-cloud-telex-integration.onrender.com/telexIntervalIntegration
- GET https://ibm-cloud-telex-integration.onrender.com/fetch-spending
![IBM Cloud Spending Integration]![alt text]
You can deploy this API on Render with the following steps:
Sign up at Render if you haven’t already.
- Go to Render Dashboard.
- Click on New + → Web Service.
- Connect your GitHub repository or upload your project manually.
- Select Node.js as the environment.
- Set the Build Command:
npm install
- Set the Start Command:
node index.js
- Add the necessary environment variables in the Render dashboard.
- Click Deploy.
- Once deployed, Render will provide a public URL.
- Use this URL to send requests to your API.
## 📜 License
This project is licensed under the **MIT License**.
---
## 👨💻 Author
**LAWAL DAMILARE** – [GitHub](https://github.com/AndreD17) |
Feel free to contribute, raise issues, or suggest improvements! 😊