Dean Lofts
08/08/2022, 4:01 AMDean Lofts
08/08/2022, 7:16 AMvar request = require('request');
var headers = {
    'Authorization': 'my-api-key',
    'Content-Type': 'application/json'
};
var options = {
    url: '<https://calendar.heyyep.com/api/channel>',
    method: 'POST',
    headers: headers
};
function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
        console.log(body);
    }
}
request(options, callback);Peer
Dean Lofts
08/08/2022, 10:36 AMDean Lofts
08/08/2022, 10:37 AMDean Lofts
08/08/2022, 11:16 AM.env files and fill them out from the example (I know it is beginner stuff) and what is actually required to get up and running from there.Dean Lofts
08/08/2022, 11:18 AM.env
# Configure SMTP settings (@see <https://nodemailer.com/smtp/>).
# Note: The below configuration for Office 365 has been verified to work.
EMAIL_SERVER_HOST='<http://smtp.office365.com|smtp.office365.com>'
EMAIL_SERVER_PORT=587
EMAIL_SERVER_USER='<office365_emailAddress>'
# Keep in mind that if you have 2FA enabled, you will need to provision an App Password.
EMAIL_SERVER_PASSWORD='<office365_password>'
# The following configuration for Gmail has been verified to work.
# EMAIL_SERVER_HOST='<http://smtp.gmail.com|smtp.gmail.com>'
# EMAIL_SERVER_PORT=465
# EMAIL_SERVER_USER='<gmail_emailAddress>'
## You will need to provision an App Password.
## @see <https://support.google.com/accounts/answer/185833>
# EMAIL_SERVER_PASSWORD='<gmail_app_password>'
# **********************************************************************************************************Dean Lofts
08/08/2022, 11:19 AMSMTP servers don't require users to authenticate, and will accept anything based on IP range.Dean Lofts
08/08/2022, 11:19 AMDean Lofts
08/08/2022, 11:22 AMNEXTAUTH_URL=<http://localhost:3000> had to be set to run locally too, not just for running on Vercel.Dean Lofts
08/08/2022, 11:29 AMDean Lofts
08/08/2022, 12:03 PMimport type { PartialReference } from "@calcom/types/EventManager";
import type { VideoApiAdapter, VideoCallData } from "@calcom/types/VideoApiAdapter";
const JitsiVideoApiAdapter = (): VideoApiAdapter => {
  return {
    getAvailability: () => {
      return Promise.resolve([]);
    },
    // Create request to establish a call
    createMeeting: async (): Promise<VideoCallData> => {
      const request = require("request");
      const headers = {
        Authorization: "temp-api-key",
        "Content-Type": "application/json",
      };
      const options = {
        url: "<https://calendar.heyyep.com/api/channel>",
        method: "POST",
        headers: headers,
      };
      function callback(error, response, body) {
        if (!error && response.statusCode == 200) {
          console.log(body);
        }
      }
      request(options, callback);
      // set channelURL, channelId, sessionId and userCount as properties of the returned object
      // return {
      //   channelURL: "",
      //   channelId: "",
      //   sessionId: "",
      //   userCount: 0,
      // };
      // I'm not quite sure how to get the results of this function into the meeting object
      return Promise.resolve({
        type: "jitsi_video",
        id: channelId,
        password: "",
        url: channelURL,
      });
    },
    deleteMeeting: async (): Promise<void> => {
      Promise.resolve();
    },
    updateMeeting: (bookingRef: PartialReference): Promise<VideoCallData> => {
      return Promise.resolve({
        type: "jitsi_video",
        id: bookingRef.meetingId as string,
        password: bookingRef.meetingPassword as string,
        url: bookingRef.meetingUrl as string,
      });
    },
  };
};
export default JitsiVideoApiAdapter;Dean Lofts
08/08/2022, 12:04 PMDean Lofts
08/08/2022, 12:06 PM// return {
      //   channelURL: "<https://calendar.heyyep.com/channel/uZJjG3i1gOHWEZLCc0Ns>",
      //   channelId: "uZJjG3i1gOHWEZLCc0Ns",
      //   sessionId: "1_MX40NjkzODMzNH5-MTY1OTk1OTg0Mzg1N353R2kxV256ak93YjIzNDhNVFAyNHVPRTd-fg",
      //   userCount: 0,
      // };Dean Lofts
08/08/2022, 12:06 PMDean Lofts
08/08/2022, 12:09 PMHariom Balhara
08/08/2022, 12:34 PMfetch  as it's available in Node.js versions we support.Dean Lofts
08/08/2022, 1:27 PMnode-fetch so I'll just have to translate it from there.Dean Lofts
08/08/2022, 1:28 PMconst fetch = require("node-fetch");
const url = "<https://calendar.heyyep.com/api/channel>";
const method = "POST";
const headers = {
  Authorization: "tmp-api-key",
  "Content-Type": "application/json",
};
// write a function using node-fetch to send a POST request to the url above using the headers above
function postRequest() {
  fetch(url, { method, headers })
    .then((res) => res.json())
    .then((json) => console.log(json));
}
postRequest();Dean Lofts
08/08/2022, 1:33 PMfetch different to node-fetch?zomars
08/08/2022, 4:41 PMnode-fetch is a replacement for fetch where the first isn't availableDean Lofts
08/09/2022, 4:30 AMfetch over node-fetch? I wrote a test.js file to see if what I was doing would work from within the calcom directory, and node-fetch appeared to be available.zomars
08/09/2022, 11:39 AMfetch globally and it should work.Dean Lofts
08/09/2022, 11:39 AMDean Lofts
08/09/2022, 11:40 AMDean Lofts
08/09/2022, 11:40 AM