Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

myinterview

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

myinterview

Build and integrate myInterview with ease via our node.js npm package and connect to the myInterview API.

  • 1.0.202
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

MyInterview-node

The documentation for the myInterview API can be found here.

Prerequisites

This project requires NodeJS (version 14 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

$ npm -v && node -v
6.14.15
v14.18.1

Install

npm i myinterview

:warning: Do not use this Node.js library in a front-end application. Doing so can expose your myInterview credentials to end-users as part of the bundled HTML/JavaScript sent to their browser.

Usage

Basic configuration

import { MyInterviewApi } from 'myinterview';
// or 
const { MyInterviewApi } = require('myinterview');

MyInterviewApi.setConfig({
  secret: 'yoursecret',
  companyId: 'yourcompanyid',
  accessKey: 'youraccesskey',
});

To use the SDK you have to set the configuration with the keys provided by myinterview prior use of the classes.

Responses (Regular/Error)

Standard Response

IApiResponseObj

FieldTypeDescription
statusCodenumberStatus code of the response
errorCodenumberInternal error code
statusReasonstringInfo message of the response
callIdstringInternal call ID
dataanyThis field contain the data required based on the request
timeDate / numberTimestamp

This is the response object you will receive from the SDK the content of data will change based on your request.

Standard Error Response

IApiResponseObj

FieldTypeDescription
*errorMessagestringError message
errorDetailsstringError message details
*statusCodenumberStatus code of the response
*errorCodenumberInternal error code
*statusReasonstringInfo message of the response
*callIdstringInternal call ID
*timeDate / numberTimestamp
*required field

Candidates

import { Candidates } from 'myinterview';
// or 
const { Candidates } = require('myinterview');

getCandidate

const res =  await Candidates.getCandidate('candidate_id');

const candidate = res.data;

getJobCandidates

const body = {
  job_id: "job_id",
  query: {
    ids: ['candidate_id1', 'candidate_id2'],
    email: 'email@email.com',
    status: 'pending',
    username: 'username',
    skip: 0,
    limit: 20,
  }
};

const res = await Candidates.getJobCandidates(body);

const candidates = res.data;

getJobCandidates Params

getJobCandidatesBody

FieldTypeDescription
*job_idstringID of the job
communicationobjectQuery object
query.idsstring arrayids of candidates you need
query.emailstringemail of candidate you need
query.statusstringstatus of the candidate enum (pending, clicked, completed, cancelled)
query.usernamestringusername of candidate you need
query.skipnumberPagination
query.limitnumberPagination
*required field

createBulkCandidates

const body = {
  job_id: "job_id",
  communication: false,
  deadlineDate: "2021-10-20T08:42:59.537+00:00",
  timezoneForInvite: "Australia/Sydney",
  candidates: [{
    username: "username", 
    email: "email@email.com",
    jobTitle: "Job title",
  }]
};

await Candidates.createBulkCandidates(body);

createBulkCandidates Params

createBulkCandidatesBody

FieldTypeDescription
*job_idstringID of the job to connect the candidate
communicationbooleanFlag to send mails with the creation
deadlineDateDate / string / numberDeadline date for the candidate/s
timezoneForInvitestringTimezone for the deadline
*candidatesArray of candidate objectArray of candidate objects definition is above in the interface
*required field

This call will create one or more candidates and connect them to your Job.

updateCandidate

const body = {
  id: "candidate_id", // You have to provide the id of the candidate
  username: "username",
  email: "email@email.com",
  jobTitle: "Job title",
};

await Candidates.updateCandidate(body);

updateCandidate Params

updateCandidateBody

FieldTypeDescription
*idstringID of the candidate
statusstringStatus of the candidate
usernamestringUsername of the candidate
deadlineDate / string / numberDeadline date for the candidate/s
timezoneForInvitestringTimezone for the deadline
*required field

Companies

import { Companies } from 'myinterview';
// or 
const { Companies } = require('myinterview')

getCompanyInfo

const res = await Companies.getCompanyInfo();

const companyInfo = res.data;

getCompanyTemplates

const res = await Companies.getCompanyTemplates();

const templates = res.data;

createCompanyTemplateBulk

const body = [{
  id: "template_id",
  name: "template_name",
  questions: [{
    numOfRetakes: 1,
    partDuration: 30,
    question: "How are you today?"
  }],
  introVideo: 'youtube.com/watch'
  },
  {
  id: "template_id",
  name: "template_name",
  questions: [{
    numOfRetakes: 1,
    partDuration: 30,
    question: "How are you today?"
  }],
  introVideo: 'youtube.com/watch'
}]

await Companies.createCompanyTemplateBulk(body);

createCompanyTemplateBulk Params

createCompanyTemplateBulkBody

FieldTypeDescription
*idstringID of the company template
hideQuestionsbooleanhideQuestions flag
*namestringName of the template
introVideostringUrl of the introduction video on the application page
*questionsArray of job questionsArray of job questions objects definition is above in the interface
*required field

updateCompanyTemplate

const body = {
  id: "template_id",
  name: "template_name",
  questions: [{
    numOfRetakes: 1,
    partDuration: 30,
    question: "How are you today?"
  }],
  introVideo: 'youtube.com/watch'
  };

await Companies.updateCompanyTemplate(body);

updateCompanyTemplate Params

updateCompanyTemplateBody

FieldTypeDescription
*idstringID of the company template
hideQuestionsbooleanhideQuestions flag
namestringName of the template
introVideostringUrl of the introduction video on the application page
*questionsArray of job questionsArray of job questions objects definition is above in the interface
*required field

Jobs

import { Jobs } from 'myinterview';
// or 
const { Jobs } = require('myinterview')

getCompanyInfo

const res = await Jobs.getJobs();

const jobs = res.data;

getJobsWithIds

const ids = ['id1', "id2"]

const res = await Jobs.getJobsWithIds(ids);

const jobs = res.data;

getJob

const id = "id"

const res = await Jobs.getJob(id);

const job = res.data;

createJob

const body = {
  title: "job_title",
  language: 'en',
  overlay: '#000000',
  config: {
    hideQuestions: true,
    practice: true
  },
  jobDescription: 'jobDescription',
  logo: "logo.url.com",
  questions: [{
      numOfRetakes: 1,
      partDuration: 30,
      question: "How are you today?"
  }],
}

await Jobs.createJob(body);

createJob Params

createJobBody

FieldTypeDescription
*titlestringTitle of the job
languagestringLanguage of the job
overlaystringOverlay of the of the application page (Value in Color Hexa #000000)
termsUrlstringUrl of the Terms of Service
privacyUrlstringUrl of the Privacy
backgroundImagestringBackground Image of the of the application page
transcriptLanguagestringLanguage of the transcript video
*configConfig ObjectConfiguration object definition is above in the interface
deadlineDateDate / string / numberDeadline date for the job
experiencestringexperience of the job
jobDescriptionstringJob description
logostringLogo
*questionsArray of job questionsArray of job questions objects definition is above in the interface
skillsArray of stringskills
introVideostringintroduction video for application page
*required field

createJobCandidatesWithTemplate

const body = {
  template_id: 'template_id',
  title: "job_title",
  language: 'en',
  overlay: '#000000',
  config: {
    practice: true
  },
  jobDescription: 'jobDescription',
  logo: "logo.url.com",
  candidates: {
    communication: true,
    deadlineDate: "2021-10-20T08:42:59.537+00:00",
    timezoneForInvite: "Australia/Sydney",
    candidates: [{
      username: "username",
      email: "email@email.com",
    }]
  }
}

await Jobs.createJobCandidatesWithTemplate(body);

createJobCandidatesWithTemplate Params

createJobCandidatesWithTemplateBody

FieldTypeDescription
*template_idstringID of the template
titlestringTitle of the job
languagestringLanguage of the job
overlaystringOverlay of the of the application page (Value in Color Hexa #000000)
termsUrlstringUrl of the Terms of Service
privacyUrlstringUrl of the Privacy
backgroundImagestringBackground Image of the of the application page
transcriptLanguagestringLanguage of the transcript video
configConfig ObjectConfiguration object definition is above in the interface
deadlineDateDate / string / numberDeadline date for the job
experiencestringexperience of the job
jobDescriptionstringJob description
logostringLogo
skillsArray of stringskills
introVideostringintroduction video for application page
*required field

createJobWithCandidates

const body = {
  title: "job_title",
  language: 'en',
  overlay: '#000000',
  config: {
    practice: true
  },
  jobDescription: 'jobDescription',
  logo: "logo.url.com",
  candidates: {
    communication: true,
    deadlineDate: "2021-10-20T08:42:59.537+00:00",
    timezoneForInvite: "Australia/Sydney",
    candidates: [{
      username: "username",
      email: "email@email.com",
    }]
  }
}

await Jobs.createJobWithCandidates(body);

createJobWithCandidates Params

createJobWithCandidatesBody

FieldTypeDescription
*titlestringTitle of the job
*questionsArray of job questionsArray of job questions objects definition is above in the interface
languagestringLanguage of the job
overlaystringOverlay of the of the application page (Value in Color Hexa #000000)
termsUrlstringUrl of the Terms of Service
privacyUrlstringUrl of the Privacy
backgroundImagestringBackground Image of the of the application page
transcriptLanguagestringLanguage of the transcript video
configConfig ObjectConfiguration object definition is above in the interface
deadlineDateDate / string / numberDeadline date for the job
experiencestringexperience of the job
jobDescriptionstringJob description
logostringLogo
skillsArray of stringskills
introVideostringintroduction video for application page
*required field

updateJob

const body = {
  job_id: 'job_id',
  title: "job_title",
  language: 'en',
  overlay: '#000000',
  config: {
    hideQuestions: true,
    practice: true
  },
  jobDescription: 'jobDescription',
  logo: "logo.url.com",
  questions: [{
    numOfRetakes: 1,
    partDuration: 30,
    question: "How are you today?"
  }],
}

await Jobs.updateJob(body);

updateJob Params

updateJobBody

FieldTypeDescription
*job_idstringID of the job
titlestringTitle of the job
languagestringLanguage of the job
overlaystringOverlay of the of the application page (Value in Color Hexa #000000)
termsUrlstringUrl of the Terms of Service
privacyUrlstringUrl of the Privacy
backgroundImagestringBackground Image of the of the application page
transcriptLanguagestringLanguage of the transcript video
configConfig ObjectConfiguration object definition is above in the interface
deadlineDateDate / string / numberDeadline date for the job
experiencestringexperience of the job
jobDescriptionstringJob description
logostringLogo
questionsArray of job questionsArray of job questions objects definition is above in the interface
skillsArray of stringskills
introVideostringintroduction video for application page
*required field

Videos

import { Videos } from 'myinterview';
// or 
const { Videos } = require('myinterview')

getVideo

const body = {
    video_id: 'video_id',
    ai: true,
    transcript: true
}

const res = await Videos.getVideo(body);

const video = res.data;

getVideoParams

getVideoBody

FieldTypeDescription
*video_idstringID of the Video
aibooleanadd ai object to the video object
transcriptbooleanadd transcript object to the video object
*required field

getVideos

const body = {
    ai: true,
    transcript: true,
    username: 'any username',
    email: "email@example.com",
    skip: 0,
    limit: 20
}

const res = await Videos.getVideos(body);

const videos = res.data;

getVideosParams

getVideosBody

FieldTypeDescription
aibooleanadd ai object to the video object
transcriptbooleanadd transcript object to the video object
usernamestringget with specific username
emailstringget with specific email
skipnumberfor pagination
limitnumberfor pagination
*required field

getJobVideos

const body = {
  job_id: 'job_id',
  query: { // This object is not mandatory
    apiKey: 'apiKey',
    clicked: true,
    uploaded: true,
    completed: true,
    email: "email@example.com",
    username: "exemple",
    candidate_id: "candidate_id",
    language: "en",
    skip: 20,
    limit: 20
  }
}

const res = await Videos.getJobVideos(body);

const videos = res.data;

getJobVideos Params

getJobVideosBody

FieldTypeDescription
*job_idstringID of the job
queryQuery ObjectQuery object definition is above in the interface
*required field

Webhooks

import { Webhooks } from 'myinterview';
// or 
const { Webhooks } = require('myinterview');

testWebhook

const body = {
  url: 'https://webhook.test',
}

const res = await Webhooks.testWebhook(body);

testWebhook Params

testWebhookBody

FieldTypeDescription
*urlstringwebhook url
*required field

createWebhook

const body = {
  url: 'https://webhook.io',
}

const res = await Webhooks.createWebhook(body);

createWebhook Params

createWebhookBody

FieldTypeDescription
*urlstringwebhook url
*required field

Error Handling

You can catch the error the same way you catch error normally.

Async/Await
try {
  const res = await Videos.getVideoPersonality("");
} catch (error) {
  // The error will be of type IApiErrorObj the definition is above.
  console.log(error)
}
Callback
Videos.getVideoPersonality("").then((res) => {
    // Type IApiResponseObj 
}).catch((error) => {
    // The error will be of type IApiErrorObj the definition is above.
    console.log(error)
})

Authentication Helper for API

populateHeaders

This call will populate the headers you need to connect to the global API service it will return an object that you can use in you request. In order to authenticate to the API you need to populate the headers (x-myinterview-timestamp, x-myinterview-key, x-myinterview-signed) the populateHeaders method will return an object that you need to include in the headers config.

import { MyInterviewApi } from 'myinterview';

MyInterviewApi.populateHeaders({
  secret: 'yoursecret',
  companyId: 'yourcompanyid',
  accessKey: 'youraccesskey',
});

It will return:

{
    'x-myinterview-timestamp': 'headTimestamp', 
    'x-myinterview-key': 'headKey',
    'x-myinterview-signed': 'headSigned'
}

Authors

  • Dvd1109 (David Sellam)

Keywords

FAQs

Package last updated on 26 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc