with Phemex and Google Calendar?
Emit new event based on a time interval before an upcoming event in the calendar.
Emit new event when a Google Calendar events is created or updated (does not emit cancelled events)
Emit new event when a Google Calendar event is created that matches a search
Emit new event when a Google Calendar event is cancelled or deleted
Add attendees to an existing event. See the documentation
Create a quick event to the Google Calendar. See the documentation
Create an event in a Google Calendar. See the documentation
Delete an event from a Google Calendar. See the documentation
Retrieve information about the authenticated Google Calendar account, including the primary calendar (summary, timezone, ACL flags), a list of accessible calendars, user-level settings (timezone, locale, week start), and the color palette that controls events and calendars. Ideal for confirming which calendar account is in use, customizing downstream scheduling, or equipping LLMs with the user’s context (timezones, available calendars) prior to creating or updating events. See the documentation
import crypto from "crypto";
import { axios } from "@pipedream/platform";
// Helper function to generate HMAC SHA256 signature
function generateSignature(secret, path, queryString, expiry, body = "") {
// Concatenate according to Phemex rules: Path + QueryString + Expiry + Body
const signedString = `${path}${queryString}${expiry}${body}`;
return crypto.createHmac("sha256", secret).update(signedString).digest("hex");
}
export default defineComponent({
props: {
phemex: {
type: "app",
app: "phemex",
}
},
async run({ steps, $ }) {
const path = "/accounts/accountPositions"; //Your Phemex API URL Path, QueryString, and body as needed
const queryString = "currency=BTC";
const body = ""; // For GET requests, no body
// Expiry: current Unix time + 60 seconds
const expiry = Math.floor(Date.now() / 1000) + 60;
// Generate signature
const signature = generateSignature(
this.phemex.$auth.api_secret,
path,
queryString,
expiry,
body
);
// Build headers
const headers = {
"x-phemex-access-token": this.phemex.$auth.api_key,
"x-phemex-request-expiry": expiry,
"x-phemex-request-signature": signature,
};
// Construct full URL
const url = `${this.phemex.$auth.api_url}${path}?${queryString}`;
// Make request
return await axios($, {
method: "GET", //Change the HTTP method accordingly, add body if needed
url,
headers,
});
},
})
The Google Calendar API lets you dip into the powerhouse of scheduling, allowing for the reading, creation, and manipulation of events and calendars directly from your applications. Through Pipedream, you can seamlessly integrate Google Calendar into a myriad of workflows, automating event management, syncing with other services, setting up custom reminders, or even collating data for reporting. The key here is to streamline your calendar-related processes, ensuring that your time management is as efficient and automated as possible.
import { axios } from "@pipedream/platform"
export default defineComponent({
props: {
google_calendar: {
type: "app",
app: "google_calendar",
}
},
async run({steps, $}) {
return await axios($, {
url: `https://www.googleapis.com/oauth2/v1/userinfo`,
headers: {
Authorization: `Bearer ${this.google_calendar.$auth.oauth_access_token}`,
},
})
},
})
