myinterview
v1.2.12
Published
Build and integrate myInterview with ease via our node.js npm package and connect to the myInterview API.
Downloads
931
Readme
MyInterview-node
The documentation for the myInterview API can be found here.
Prerequisites
This project requires NodeJS (version 8 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.13.4
v8.17.0
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
| Field | Type | Description | |--------------| --- | --- | | statusCode | number | Status code of the response | | errorCode | number | Internal error code | | statusReason | string | Info message of the response | | callId | string | Internal call ID | | data | any | This field contain the data required based on the request | | time | Date / number | Timestamp |
This is the response object you will receive from the SDK the content of data will change based on your request.
Standard Error Response
| Field | Type | Description | | --- | --- | --- | | *errorMessage | string | Error message | | errorDetails | string | Error message details | | *statusCode | number | Status code of the response | | *errorCode | number | Internal error code | | *statusReason | string | Info message of the response | | *callId | string | Internal call ID | | *time | Date / number | Timestamp | *required field
TestMode
The test mode is not connected to any Database all the call are just checking if the payload or the url are correct if you try to create or update nothing will be saved as all the response are mock data.
Getting Started with the API
This guide provides an overview of the basic flow for using the API, from creating a job and inviting candidates to receiving and viewing completed video interviews.
1. Create Job
Start by creating a Job Model, which serves as the foundation for your video interviews. Use the createJob
or createJobWithCandidates
API endpoints to define various aspects of the interview, such as questions, link appearance, and description.
2. Invite Candidates
Next, invite candidates to participate in the video interview. Create a Candidate Model for each candidate, associating it with the Job Model you created earlier. Utilize the candidate information to generate a personalized myInterview video interview link and send it to the candidates.
3. Monitor Video Status
Once candidates have been invited, monitor the status of their video interviews using the Video Model. Set up a webhook to receive real-time notifications when candidates complete their interviews. Configure the webhook by providing a URL where POST requests will be sent upon video completion.
4. Retrieve Completed Videos
After candidates have completed their video interviews, use the API to access the videos in JSON format, which includes signed URLs for all video questions. Alternatively, obtain a sleek share link that can be opened anywhere by calling the getShareLink
API endpoint.
API Flow
- Create Job: Configure a Job Model using the
createJob
orcreateJobWithCandidates
API endpoints. - Invite Candidates: Create a Candidate Model for each candidate, associate it with the Job Model, and send personalized interview links.
- Wait for Video: Monitor the status of candidate video interviews using the Video Model and webhook notifications.
- Get the Video: Access completed video interviews using the API or the share link obtained from the
getShareLink
API endpoint.
By following this simple flow, you can efficiently manage and monitor video interviews, streamlining the recruitment process and helping you identify the best talent for your organization.
Note: This guide outlines a basic flow for using the API, but it is not the only possible workflow. Clients can choose and customize the flow that best suits their specific needs, taking advantage of the API's flexibility and adaptability.
Jobs
const { Jobs } = require('myinterview')
Description
The Job Model serves as the starting point for setting up video interviews. It allows you to configure various aspects of the interview, such as questions, link appearance, description, and more.
Note: To invite a candidate for a myInterview video interview, a Job Model must be set up first.
There are several ways to create a Job Model:
- Use the
createJob
API endpoint to create a Job Model with the required information. - Use the
createJobWithCandidates
API endpoint to create a Job Model along with associated candidate(s) by providing the necessary information in the request. - Obtain a secure, updated URL to access a sleek and user-friendly interface in myInterview by using the
getJobUpdateUrl
API endpoint, or by adding the option increateJob
. This allows for easy updates to your created Job Model. For more details, refer to the documentation below.
Once the Job Model is set up, you can manage and monitor the progress of your video interviews. You can view the status of individual candidates, review completed interviews, and make informed decisions based on the candidates' responses. The Job Model ensures a streamlined and efficient interview process, enabling you to find the best talent for your organization.
Note: When creating a job, there are two ways to invite a candidate:
- Explicitly create a candidate and send a personalized invitation.
- Obtain the direct link from the response, which can be sent to any candidate without a formal invitation.
getJobs
const res = await Jobs.getJobs();
const jobs = res.data;
getJobsByIds
const ids = ['id1', "id2"]
const res = await Jobs.getJobsByIds(ids);
const jobs = res.data;
getJob
You can obtain the new update URL to access a sleek and user-friendly interface in myInterview, which makes it easy to update your created job. If you add the options object with the flag getUpdateUrl.
const id = "job_id"
const options = { getUpdateUrl: true };
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?",
description: "This is a description",
thinkingTime: 30
}],
// fields available: (cvUrl,phoneNumber,document,coverLetter,socialProfile,website,linkedin,address)
jobInputFields: [
{
fieldName: 'cvUrl',
required: true
},
{
fieldName: 'phoneNumber',
},
{
fieldName: 'additionalFile',
required: false
},
],
template_id: 'any-template-id'
};
await Jobs.createJob(body);
createJob Params
| Field | Type | Description | |----------------------------|------------------------|------------------------------------------------------------------------------------------------------------------------------| | *title | string | Title of the job | | template_id | string | If the template ID is given you will create your job with the template questions | | language | string | Language of the job | | overlay | string | Overlay of the of the application page (Value in Color Hexa #000000) | | termsUrl | string | Url of the Terms of Service | | privacyUrl | string | Url of the Privacy | | backgroundImage | string | Background Image of the of the application page | | transcriptLanguage | string | Language of the transcript video | | config | Config Object | Configuration object | | deadlineDate | ISO Date string | Deadline date for the job | | experience | string | experience of the job | | jobDescription | string | Job description | | logo | string | Logo | | questions | Array of job questions | Array of job questions objects | | skills | Array of string | skills | | introVideo | string | introduction video for application page | | jobInputFields | array | list of document that you will ask the candidate for. (Maximum length is 3 elements) | | jobInputFields..fieldName | string | name of document need to be in the following (cvUrl,phoneNumber,additionalFile,coverLetter,socialProfile,website,linkedin,address) | | jobInputFields..required | boolean | flag indicating if the document is required | *required field
Comment: Setting up the AI for a job including its persona qualities is made via “Configure job's candidates qualities“ endpoint. You can find it under jobs section.
createJobWithCandidates
This call will create for you the job, candidate and will send an invite email to the candidate.
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?",
description: "This is a description",
thinkingTime: 30
}],
// fields available: (cvUrl,phoneNumber,document,coverLetter,socialProfile,website,linkedin,address)
jobInputFields: [
{
fieldName: 'cvUrl',
required: true
},
{
fieldName: 'phoneNumber',
},
{
fieldName: 'additionalFile',
required: false
},
],
candidates: {
communication: true,
reminders: true,
deadlineDate: "2021-10-20T08:42:59.537+00:00",
timezoneForInvite: "Australia/Sydney",
candidates: [{
username: "username",
email: "[email protected]",
}]
}
}
await Jobs.createJobWithCandidates(body);
createJobWithCandidates Params
| Field | Type | Description | | --- |------------------------|----------------------------------------------------------------------------------| | template_id | string | If the template ID is given you will create your job with the template questions | | title | string | Title of the job | | questions | Array of job questions | Array of job questions objects is required if you don't provide template_id | | language | string | Language of the job | | overlay | string | Overlay of the of the application page (Value in Color Hexa #000000) | | termsUrl | string | Url of the Terms of Service | | privacyUrl | string | Url of the Privacy | | backgroundImage | string | Background Image of the of the application page | | transcriptLanguage | string | Language of the transcript video | | config | Config Object | Configuration object | | deadlineDate | ISO Date string | Deadline date for the job | | experience | string | experience of the job | | jobDescription | string | Job description | | logo | string | Logo | | skills | Array of string | skills | | introVideo | string | introduction video for application page | | jobInputFields | array | list of document that you will ask the candidate for. (Maximum length is 3 elements) | | jobInputFields..fieldName | string | name of document need to be in the following (cvUrl,phoneNumber,additionalFile,coverLetter,socialProfile,website,linkedin,address) | | jobInputFields.*.required | boolean | flag indicating if the document is required | *required field
Comment: Setting up the AI for a job including its persona qualities is made via “Configure job's candidates qualities“ endpoint. You can find it under jobs section.
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?",
description: "This is a description",
thinkingTime: 30
}],
// fields available: (cvUrl,phoneNumber,document,coverLetter,socialProfile,website,linkedin,address)
jobInputFields: [
{
fieldName: 'cvUrl',
required: true
},
{
fieldName: 'phoneNumber',
},
{
fieldName: 'additionalFile',
required: false
},
],
}
await Jobs.updateJob(body);
updateJob Params
| Field | Type | Description | | --- |------------------------|------------------------------------------------------------------------------| | job_id | string | ID of the job | | template_id | string | If the template ID is given you will update your job with the template questions | | title | string | Title of the job | | language | string | Language of the job | | overlay | string | Overlay of the of the application page (Value in Color Hexa #000000) | | termsUrl | string | Url of the Terms of Service | | privacyUrl | string | Url of the Privacy | | backgroundImage | string | Background Image of the of the application page | | transcriptLanguage | string | Language of the transcript video | | config | Config Object | Configuration object | | deadlineDate | ISO Date string | Deadline date for the job | | experience | string | experience of the job | | jobDescription | string | Job description | | logo | string | Logo | | questions | Array of job questions | Array of job questions objects | | skills | Array of string | skills | | introVideo | string | introduction video for application page | | jobInputFields | array | list of document that you will ask the candidate for. (Maximum length is 3 elements) | | jobInputFields..fieldName | string | name of document need to be in the following (cvUrl,phoneNumber,additionalFile,coverLetter,socialProfile,website,linkedin,address) | | jobInputFields.*.required | boolean | flag indicating if the document is required | *required field
updateJobIntelligence
Create/Edit the top 5 qualities in the ideal candidate. candidates will be scored according to that.
const body = {
job_id: 'job_id',
intelligence: [
{
name: 'Creative',
order: 1,
},
{
name: 'Persuasive',
order: 2,
},
{
name: 'Assertive',
order: 3,
},
{
name: 'Optimistic',
order: 4,
},
{
name: 'Outgoing',
order: 5,
},
],
};
const res = await Jobs.updateJobIntelligence(body);
updateJobIntelligence Params
| Field | Type | Description | |---------------------|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| | *job_id | string | job_id | | *intelligence.order | number | order from 1 to 5 | | *intelligence.name | string | trait name needs to be one of the following values: Creative, Strategic, Disciplined, Driven, Friendly, Outgoing, Assertive, Persuasive, Stress Tolerant, Optimistic | *required field
getJobUpdateUrl
You can obtain the new update URL to access a sleek and user-friendly interface in myInterview, which makes it easy to update your created job.
const id = "job_id"
const res = await Jobs.getJobUpdateUrl(id);
const url = res.data.url;
Candidates
const { Candidates } = require('myinterview');
Description
The Candidate Model is designed to facilitate inviting a candidate for a job interview. It stores all necessary information for generating an invitation and must be linked to a pre-existing job. This information is used to invite the candidate and generate a personalized myInterview video interview link.
Within the Candidate Model, there is a status field that indicates the current state of the invitation.
Note: The Candidate Model itself is not the video; the video refers to the actual video interview that can be played back.
Upon the Candidate Model's status changing to "completed," a video_id will be assigned to both the Candidate Model and the associated video. This identifier can be utilized to access the video interview for playback.
getCandidate
Get candidate details by id.
const res = await Candidates.getCandidate('candidate_id');
const candidate = res.data;
getJobCandidates
Lists all candidates of a job including their created date, their invite status and personal details like name and email.
const body = {
job_id: "job_id",
query: {
ids: ['candidate_id1', 'candidate_id2'],
email: '[email protected]',
status: 'pending',
username: 'username',
skip: 0,
limit: 20,
}
};
const res = await Candidates.getJobCandidates(body);
const candidates = res.data;
getJobCandidates Params
| Field | Type | Description | |----------------|--------------|-----------------------------------------------------------------------| | *job_id | string | ID of the job | | query.ids | string array | ids of candidates you need | | query.email | string | email of candidate you need | | query.status | string | status of the candidate enum (pending, clicked, completed, cancelled) | | query.username | string | username of candidate you need | | query.skip | number | Pagination | | query.limit | number | Pagination | *required field
createBulkCandidates
Create one or more candidates.
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 protected]",
jobTitle: "Job title",
}]
};
await Candidates.createBulkCandidates(body);
createBulkCandidates Params
| Field | Type | Description | | --- |---------------------------|-----------------------------------------------------------| | *job_id | string | ID of the job to connect the candidate | | communication | boolean | Flag to send mail to invited candidates (default = false) | | reminders | boolean | Flag to activate reminders mails | | deadlineDate | ISO Date string | Deadline date for the candidate/s | | timezoneForInvite | string | Timezone for the deadline | | *candidates | Array of candidate object | Array of candidate objects | *required field
This call will create one or more candidates and connect them to your Job.
updateCandidate
Update candidates details, deadline change is optional.
const body = {
id: "candidate_id", // You have to provide the id of the candidate
username: "username",
email: "[email protected]",
jobTitle: "Job title",
};
await Candidates.updateCandidate(body);
updateCandidate Params
| Field | Type | Description | | --- |------------| --- | | *id | string | ID of the candidate | | status | string | Status of the candidate | | username | string | Username of the candidate | | deadline | ISO Date string | Deadline date for the candidate/s | | timezoneForInvite | string | Timezone for the deadline | *required field
deleteBulkCandidates
Delete candidates bulk by ids.
const body = {
candidateIds: ["candidate_id", "candidate_id1", "candidate_id2"]// You have to provide the id of the candidate
};
await Candidates.deleteBulkCandidates(body);
deleteBulkCandidates Params
| Field | Type | Description | | --- |-----------------|----------------------------------| | *candidateIds | string array | IDs of the candidates |
*required field
Videos
const { Videos } = require('myinterview')
Description
The Video Model represents the final stage of the typical workflow when a candidate has completed their video recording.
Note: To remove a video from your job kanban, you must delete the video, not the candidate, using the
deleteBulkVideos
API endpoint.
There are two options to view the video:
- Use the API to obtain the video in JSON format, which includes signed URLs for all video questions.
- Obtain a sleek share link that can be opened anywhere by calling the
getShareLink
API endpoint.
getVideo
Get the video information including the video playable url and transcript and AI results. (according to your subscription)
const body = {
video_id: 'video_id',
ai: true,
transcript: true
}
const res = await Videos.getVideo(body);
const video = res.data;
getVideoParams
| Field | Type | Description | | --- |----------|---------------------------------------------------| | *video_id | string | ID of the Video | | ai | boolean | add ai object to the video object | | transcript | boolean | add transcript object to the video object | *required field
getVideos
Get all videos, including the video playable url and transcript and AI results. (according to your subscription)
const body = {
ai: true,
transcript: true,
username: 'fullname',
email: "[email protected]",
skip: 0,
limit: 20
}
const res = await Videos.getVideos(body);
const videos = res.data;
getVideosParams
| Field | Type | Description | |------------|---------|------------------------------------------| | ai | boolean | add ai object to the video object | | transcript | boolean | add transcript object to the video object | | username | string | get with specific username | | incomplete | boolean | video is incomplete | | email | string | get with specific email | | skip | number | for pagination | | limit | number | for pagination | *required field
getJobVideos
Get the videos of the candidates who applied to a job.
const body = {
job_id: 'job_id',
query: { // Optional
email: "[email protected]",
username: "fullname",
candidate_id: "candidate_id",
skip: 20,
limit: 20
}
}
const res = await Videos.getJobVideos(body);
const videos = res.data;
getJobVideos Params
| Field | Type | Description | | --- | --- | --- | | *job_id | string | ID of the job | | query | Query Object | Query object | *required field
getShareLink
Get the candidate/video recording share url. With this video url you can watch and review the application on myinterview share page without login.
const id = "video_id"
const res = await Videos.getShareLink(id);
const shareLink = res.data.shareLink;
deleteBulkVideos
Delete videos bulk by ids.
const body = {
videoIds: ["video_id", "video_id1", "video_id2"]// You have to provide the id of the candidate
};
await Candidates.deleteBulkVideos(body);
deleteBulkVideos Params
| Field | Type | Description | |-----------|-----------------|-------------------| | *videoIds | string array | IDs of the videos |
*required field
Companies
const { Companies } = require('myinterview')
Description
The Company Model consolidates all information about your company, making it an excellent starting point for retrieving your company's details in JSON format using the getCompanyInfo
API endpoint.
Additionally, you can set up templates to avoid rewriting questions repeatedly. Simply use the template_id when creating a job. For an example, refer to the Job Model section.
Note: You can also configure templates within the myInterview dashboard and reuse them by calling the
getCompanyTemplates
API endpoint.
getCompanyInfo
const res = await Companies.getCompanyInfo();
const companyInfo = res.data;
getCompanyTemplates
Returns an array of job questionnaire templates.
const res = await Companies.getCompanyTemplates();
const templates = res.data;
createCompanyTemplateBulk
Create job questionnaire templates. These questions will be displayed to the candidates when they apply during the video recording session.
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?",
description: "This is a description",
thinkingTime: 30
}],
introVideo: 'youtube.com/watch'
}]
await Companies.createCompanyTemplateBulk(body);
createCompanyTemplateBulk Params
| Field | Type | Description | | --- | --- |-------------------------------------------------------| | *id | string | ID of the company template | | hideQuestions | boolean | questions will not be displayed upfront | | *name | string | Name of the template | | introVideo | string | Url of the introduction video on the application page | | *questions | Array of job questions | Array 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: "This is a description",
thinkingTime: 30
}],
introVideo: 'youtube.com/watch'
};
await Companies.updateCompanyTemplate(body);
updateCompanyTemplate Params
| Field | Type | Description | | --- | --- |-------------------------------------------------------| | *id | string | ID of the company template | | hideQuestions | boolean | questions will not be displayed upfront | | name | string | Name of the template | | introVideo | string | Url of the introduction video on the application page | | *questions | Array of job questions | Array of job questions objects | *required field
Shares
const { Shares } = require('myinterview');
Description
The Share Model provides a method for generating a personalized URL containing the video_id(s) you want to share with others. For example, if you have several video candidates you'd like to share with a colleague or another party, you can use the getShortlistUrl
API endpoint to obtain a URL featuring the selected videos and comments on the candidates.
This feature makes it easy to collaborate with team members, hiring managers, or other stakeholders involved in the recruitment process. By sharing a single URL, you can provide access to specific candidate videos, enabling efficient evaluation and discussion. The Share Model simplifies the process of sharing candidate information and streamlines decision-making, helping your organization identify the best talent.
getShortlistUrl
Create shortlist of selected candidates and share it with your teammates.
- recipients email is optional
const body = {
candidate_videos: [
{
id: 'video_id',
},
],
job_id: 'job_id',
anonymised: true,
share_personality: true,
recipients: [
{
recipient_email: '[email protected]',
recipient_name: 'Harry Potter',
},
],
};
const res = await Shares.getShortlistUrl(body);
const shortlistUrl = res.data.shortlistUrl;
getShortlistUrl Params
| Field | Type | Description | |--------------------|-----------------|---------------------------------------------------------------------------------------------------------------| | *candidate_videos | Array of Object | Ids of the videos you want to share | | *job_id | string | ID of the job | | anonymised | boolean | Flag to anonymised the candidates name | | share_personality | boolean | Flag to add AI Insights | | recipients | Array of Object | Array of recipients (recruiters) if you add some they will receive a mail with the link to comment the videos | *required field
Webhooks
const { Webhooks } = require('myinterview');
Description
You can configure a webhook to receive notifications each time one of your candidates completes a video interview. To set up a webhook, provide a URL where a POST request will be sent with the following payload (example data):
{
"videoID": "599bfd33-9f46-478d-be96-0490d59b2cbc",
"candidate_email": "[email protected]",
"candidate_name": "Candidate's Name",
"interview_URL": "https://share.myinterview.com/video/EMySrUICZPlVFYlR2ry4UKZxEDirhK53t923",
"interview_date": "2021-10-28T09:42:22.959Z",
"candidateID": "369b0d23-9f46-408d-be96-0490d8kds63gw",
"jobID": "k99b0po0-2w46-4pdd-b106-049338kds9ojdw",
"jobTitle": "Webhook Job Test",
"firstname": "John",
"lastname": "Doe",
"embed_video": "https://share.myinterview.com/embed/EMySrUICZPlVFYlR2ry4UKZxEDirhK53t923",
"jobTitle": "Sales Manager",
"phoneNumber": "+61 123 456 789",
"thumbnail": "https://any.thumbnail"
}
By implementing a webhook, you can automate the process of receiving updates about candidate video completions, making it easier to track and manage your recruitment process. This helps you stay informed of candidates' progress in real-time, enabling you to take timely actions, such as evaluating their interviews or moving them to the next stage of the hiring process. The webhook also allows for seamless integration with your existing recruitment tools and platforms, streamlining your workflow and improving overall efficiency.
testWebhook
const body = {
url: 'https://webhook.test',
}
const res = await Webhooks.testWebhook(body);
testWebhook Params
| Field | Type | Description | | --- |--------| --- | | *url | string | webhook url | *required field
createWebhook
const body = {
url: 'https://webhook.io',
}
const res = await Webhooks.createWebhook(body);
createWebhook Params
| Field | Type | Description | | --- |--------| --- | | *url | string | webhook url | *required field
TimezoneForInvite
You can get the list of timezones on this link
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
- dvd90 (David Sellam)