Created
May 3, 2022 17:44
-
-
Save birinder-lobana/958d01b5b7a94b83be4906bffedf2fa5 to your computer and use it in GitHub Desktop.
Creating a contact with a phone-number.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Initiate the Openscreen node SDK and include the project ID that you recieved using the Openscreen dashboard | |
const { Openscreen } = require("@openscreen/sdk"); | |
require('dotenv').config(); | |
const os = new Openscreen().config({key: process.env.OS_API_KEY, secret: process.env.OS_API_SECRET}); | |
const projectId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'; | |
const scanId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx'; | |
async function main(){ | |
// Create a new contact | |
const contact = await os.project(projectId).contacts().create({ | |
firstName: "Brian", | |
lastName: "Smith", | |
// Phone number you will be sending SMS to | |
cellPhone: "+14166144161", | |
}); | |
// View the new contact that you have created | |
console.log('Contact:', JSON.stringify(contact, '',2)); | |
} | |
main().catch((err) => { | |
console.error(err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment