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

myinterview

Package Overview
Dependencies
Maintainers
4
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.205
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
114
decreased by-6.56%
Maintainers
4
Weekly downloads
 
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

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

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

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

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

FieldTypeDescription
*job_idstringID of the job
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: true,
  reminders: true,
  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

FieldTypeDescription
*job_idstringID of the job to connect the candidate
communicationbooleanFlag to send mail to invited candidates (default = false)
remindersbooleanFlag to activate reminders mails
deadlineDateISO Date stringDeadline date for the candidate/s
timezoneForInvitestringTimezone for the deadline
*candidatesArray of candidate objectArray of candidate objects
*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

FieldTypeDescription
*idstringID of the candidate
statusstringStatus of the candidate
usernamestringUsername of the candidate
deadlineISO Date stringDeadline date for the candidate/s
timezoneForInvitestringTimezone for the deadline
*required field

Companies

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

FieldTypeDescription
*idstringID of the company template
hideQuestionsbooleanquestions will not be displayed upfront
*namestringName of the template
introVideostringUrl of the introduction video on the application page
*questionsArray of job questionsArray of job questions objects
*required field

updateCompanyTemplate

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

await Companies.updateCompanyTemplate(body);

updateCompanyTemplate Params

FieldTypeDescription
*idstringID of the company template
hideQuestionsbooleanquestions will not be displayed upfront
namestringName of the template
introVideostringUrl of the introduction video on the application page
*questionsArray of job questionsArray of job questions objects
*required field

Jobs

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

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
deadlineDateISO Date stringDeadline date for the job
experiencestringexperience of the job
jobDescriptionstringJob description
logostringLogo
*questionsArray of job questionsArray of job questions objects
skillsArray of stringskills
introVideostringintroduction video for application page
*required field

createJobWithCandidates

const body = {
  template_id: 'template_id', // If provided the questions will be taken from template
  title: "job_title",
  language: 'en',
  overlay: '#000000',
  config: {
    practice: true
  },
  jobDescription: 'jobDescription',
  logo: "logo.url.com",
  questions: [{
    numOfRetakes: 1,
    partDuration: 30,
    question: "How are you today?"
  }],
  candidates: {
    communication: true,
    reminders: 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

FieldTypeDescription
template_idstringIf the template ID is given you will create your job with the template questions
*titlestringTitle of the job
questionsArray of job questionsArray of job questions objects is required if you don't provide template_id
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
deadlineDateISO Date stringDeadline 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

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
deadlineDateISO Date stringDeadline date for the job
experiencestringexperience of the job
jobDescriptionstringJob description
logostringLogo
questionsArray of job questionsArray of job questions objects
skillsArray of stringskills
introVideostringintroduction video for application page
*required field

Videos

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

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: 'fullname',
    email: "email@example.com",
    skip: 0,
    limit: 20
}

const res = await Videos.getVideos(body);

const videos = res.data;

getVideosParams

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: { // Optional
    email: "email@example.com",
    username: "fullname",
    candidate_id: "candidate_id",
    skip: 20,
    limit: 20
  }
}

const res = await Videos.getJobVideos(body);

const videos = res.data;

getJobVideos Params

FieldTypeDescription
*job_idstringID of the job
queryQuery ObjectQuery object
*required field
const id = "video_id"

const res = await Videos.getShareLink(id);

const shareLink = res.data.shareLink;

Shares

const { Shares } = require('myinterview');

getShortlistUrl

const body = {
  candidate_videos: [
    {
      id: 'video_id',
    },
  ],
  job_id: 'job_id',
  anonymised: true,
  share_personality: true,
  recipients: [
    {
      recipient_email: 'mail@myinterview.com',
      recipient_name: 'Harry Potter',
    },
  ],
};

const res = await Shares.getShortlistUrl(body);

const shortlistUrl = res.data.shortlistUrl;

getShortlistUrl Params

FieldTypeDescription
*candidate_videosArray of ObjectIds of the videos you want to share
*job_idstringID of the job
anonymisedbooleanFlag to anonymised the candidates name
share_personalitybooleanFlag to add AI Insights
recipientsArray of ObjectArray of recipients (recruiters) if you add some they will receive a mail with the link to comment the videos
*required field

Intelligence

const { Intelligence } = require('myinterview');

updateJobIntelligence

const body = {
  job_id: 'job_id',
  intelligence: [
    {
      name: 'Creative',
      order: 1,
    },
    {
      name: 'Persuasive',
      order: 2,
    },
    {
      name: 'Assertive',
      order: 3,
    },
    {
      name: 'Optimism',
      order: 4,
    },
    {
      name: 'Outgoing',
      order: 5,
    },
  ],
};

const res = await Intelligence.updateJobIntelligence(body);

updateJobIntelligence Params

FieldTypeDescription
*job_idstringjob_id
*intelligence.ordernumberorder from 1 to 5
*intelligence.namestringtrait name need to be one of these values: Creative,Strategic,Disciplined,Driven,Friendly,Outgoing,Assertive,Persuasive,Stress Tolerant,Optimism
*required field

Webhooks

const { Webhooks } = require('myinterview');

testWebhook

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

const res = await Webhooks.testWebhook(body);

testWebhook Params

FieldTypeDescription
*urlstringwebhook url
*required field

createWebhook

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

const res = await Webhooks.createWebhook(body);

createWebhook Params

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 16 Jan 2022

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