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.0
  • 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';

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

TypeFieldDescription
numberstatusCodeStatus code of the response
numbererrorCodeInternal error code
stringstatusReasonInfo message of the response
stringcallIdInternal call ID
anydataThis field contain the data required based on the request
Date / numbertimeTimestamp

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

TypeFieldDescription
string*errorMessageError message
stringerrorDetailsError message details
number*statusCodeStatus code of the response
number*errorCodeInternal error code
string*statusReasonInfo message of the response
string*callIdInternal call ID
Date / number*timeTimestamp
*required field

Candidates

import { Candidates } from '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

TypeFieldDescription
string*job_idID of the job
objectcommunicationQuery object
string arrayquery.idsids of candidates you need
stringquery.emailemail of candidate you need
stringquery.statusstatus of the candidate enum (pending, clicked, completed, cancelled)
stringquery.usernameusername of candidate you need
numberquery.skipPagination
numberquery.limitPagination
*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

TypeFieldDescription
string*job_idID of the job to connect the candidate
booleancommunicationFlag to send mails with the creation
Date / string / numberdeadlineDateDeadline date for the candidate/s
stringtimezoneForInviteTimezone for the deadline
Array of candidate object*candidatesArray 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

TypeFieldDescription
string*idID of the candidate
stringstatusStatus of the candidate
stringusernameUsername of the candidate
Date / string / numberdeadlineDeadline date for the candidate/s
stringtimezoneForInviteTimezone for the deadline
*required field

Companies

import { Companies } from '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

TypeFieldDescription
string*idID of the company template
booleanhideQuestionshideQuestions flag
string*nameName of the template
stringintroVideoUrl of the introduction video on the application page
Array of job questions*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

TypeFieldDescription
string*idID of the company template
booleanhideQuestionshideQuestions flag
stringnameName of the template
stringintroVideoUrl of the introduction video on the application page
Array of job questions*questionsArray of job questions objects definition is above in the interface
*required field

Jobs

import { Jobs } from '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

TypeFieldDescription
string*titleTitle of the job
stringlanguageLanguage of the job
stringoverlayOverlay of the of the application page (Value in Color Hexa #000000)
stringtermsUrlUrl of the Terms of Service
stringprivacyUrlUrl of the Privacy
stringbackgroundImageBackground Image of the of the application page
stringtranscriptLanguageLanguage of the transcript video
Config Object*configConfiguration object definition is above in the interface
Date / string / numberdeadlineDateDeadline date for the job
stringexperienceexperience of the job
stringjobDescriptionJob description
stringlogoLogo
Array of job questions*questionsArray of job questions objects definition is above in the interface
Array of stringskillsskills
stringintroVideointroduction 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

TypeFieldDescription
string*template_idID of the template
stringtitleTitle of the job
stringlanguageLanguage of the job
stringoverlayOverlay of the of the application page (Value in Color Hexa #000000)
stringtermsUrlUrl of the Terms of Service
stringprivacyUrlUrl of the Privacy
stringbackgroundImageBackground Image of the of the application page
stringtranscriptLanguageLanguage of the transcript video
Config ObjectconfigConfiguration object definition is above in the interface
Date / string / numberdeadlineDateDeadline date for the job
stringexperienceexperience of the job
stringjobDescriptionJob description
stringlogoLogo
Array of stringskillsskills
stringintroVideointroduction 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

TypeFieldDescription
string*titleTitle of the job
Array of job questions*questionsArray of job questions objects definition is above in the interface
stringlanguageLanguage of the job
stringoverlayOverlay of the of the application page (Value in Color Hexa #000000)
stringtermsUrlUrl of the Terms of Service
stringprivacyUrlUrl of the Privacy
stringbackgroundImageBackground Image of the of the application page
stringtranscriptLanguageLanguage of the transcript video
Config ObjectconfigConfiguration object definition is above in the interface
Date / string / numberdeadlineDateDeadline date for the job
stringexperienceexperience of the job
stringjobDescriptionJob description
stringlogoLogo
Array of stringskillsskills
stringintroVideointroduction 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

TypeFieldDescription
string*job_idID of the job
stringtitleTitle of the job
stringlanguageLanguage of the job
stringoverlayOverlay of the of the application page (Value in Color Hexa #000000)
stringtermsUrlUrl of the Terms of Service
stringprivacyUrlUrl of the Privacy
stringbackgroundImageBackground Image of the of the application page
stringtranscriptLanguageLanguage of the transcript video
Config ObjectconfigConfiguration object definition is above in the interface
Date / string / numberdeadlineDateDeadline date for the job
stringexperienceexperience of the job
stringjobDescriptionJob description
stringlogoLogo
Array of job questionsquestionsArray of job questions objects definition is above in the interface
Array of stringskillsskills
stringintroVideointroduction video for application page
*required field

Videos

import { Videos } from 'myinterview';

getVideo

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

const res = await Videos.getVideo(body);

const video = res.data;

getVideoParams

getVideoBody

TypeFieldDescription
string*video_idID of the Video
booleanaiadd ai object to the video object
booleantranscriptadd 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

TypeFieldDescription
booleanaiadd ai object to the video object
booleantranscriptadd transcript object to the video object
stringusernameget with specific username
stringemailget with specific email
numberskipfor pagination
numberlimitfor 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

TypeFieldDescription
string*job_idID of the job
Query ObjectqueryQuery object definition is above in the interface
*required field

getVideoPersonality

const id: string;

const res = await Videos.getVideoPersonality(id);

const personality = res.data;

Webhooks

import { Webhooks } from 'myinterview';

testWebhook

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

const res = await Webhooks.testWebhook(body);

testWebhook Params

testWebhookBody

TypeFieldDescription
string*urlwebhook url
*required field

createWebhook

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

const res = await Webhooks.createWebhook(body);

createWebhook Params

createWebhookBody

TypeFieldDescription
string*urlwebhook 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