Discover how to seamlessly integrate v0 with Planoly. Follow our step-by-step guide to set up, optimize, and elevate your planning workflow effortlessly.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
planoly.ts.
planoly.ts. This code defines a PlanolyClient class that includes functions to get scheduled posts and to create a new post via the Planoly API.
export class PlanolyClient {
private apiKey: string;
private apiSecret: string;
private baseUrl: string;
constructor(apiKey: string, apiSecret: string) {
this.apiKey = apiKey;
this.apiSecret = apiSecret;
// Base URL for the Planoly API (adjust if necessary)
this.baseUrl = "https://api.planoly.com";
}
async getScheduledPosts(): Promise {
const endpoint = ${this.baseUrl}/v1/scheduled;
const response = await fetch(endpoint, {
method: "GET",
headers: {
"Authorization": Bearer ${this.apiKey},
"Content-Type": "application/json"
}
});
if (!response.ok) {
throw new Error("Error fetching scheduled posts");
}
return response.json();
}
async createPost(postData: any): Promise {
const endpoint = ${this.baseUrl}/v1/posts;
const response = await fetch(endpoint, {
method: "POST",
headers: {
"Authorization": Bearer ${this.apiKey},
"Content-Type": "application/json"
},
body: JSON.stringify(postData)
});
if (!response.ok) {
throw new Error("Error creating post");
}
return response.json();
}
}
your-planoly-api-key and your-planoly-api-secret with your actual Planoly API credentials (set in the next step).
index.ts) where you want to use the Planoly integration.PlanolyClient defined in planoly.ts as shown in the code snippet below:
import { PlanolyClient } from "./planoly";
const API_KEY = "your-planoly-api-key"; // Replace with your actual Planoly API key
const API_SECRET = "your-planoly-api-secret"; // Replace with your Planoly API secret
const planolyClient = new PlanolyClient(APIKEY, APISECRET);
async function displayScheduledPosts() {
try {
const posts = await planolyClient.getScheduledPosts();
console.log("Scheduled Posts:", posts);
} catch (error) {
console.error("Failed to fetch scheduled posts:", error);
}
}
// Call the function to test the integration
displayScheduledPosts();
PlanolyClient with your credentials, then calls getScheduledPosts to fetch and log the scheduled posts.
fetch API. If your project runs in an environment where fetch is not available, add a polyfill by including it directly in your HTML file.<script> tag in your main HTML file before any other scripts are loaded:
// For browsers that do not support fetch, include this polyfill
if (!window.fetch) {
document.write('');
}
planoly.ts and your main application file (like index.ts) are saved.displayScheduledPosts function gets executed and fetches data from the Planoly API.When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.