Skip to content

Instantly share code, notes, and snippets.

@birinder-lobana
Created May 3, 2022 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save birinder-lobana/ebfd2b6477eec5133cc4612e10b70964 to your computer and use it in GitHub Desktop.
Save birinder-lobana/ebfd2b6477eec5133cc4612e10b70964 to your computer and use it in GitHub Desktop.
Create a new SMS template. This allows you to send SMS to any Openscreen contact containing a valid phone number.
// 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(){
const smsTemplate = await os.project(projectId).smsTemplates().create({
body: "SMS Template Text body",
smsTemplateName: "firstTemplate",
responseUrl: "httpe://myapp/sms-response",
statusUrl: "httpe://myapp/sms-status",
});
console.log('created smsTemplate:', smsTemplate)
}
main().catch((err) => {
console.error(err);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment