Created
May 3, 2022 16:09
-
-
Save birinder-lobana/780ac506604df6fb013a2f6942f8d564 to your computer and use it in GitHub Desktop.
Create a batch of dynamic QR codes
This file contains hidden or 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'; | |
async function main(){ | |
// Create multiple assets that each represent a different billboard. Each of these billboards will direct a user to the same listing at 123 Cherry Street. | |
const bulkAssets = await os.project(projectId).assetsBatch().create([{ | |
name: 'Billboard 1', | |
description: 'Billboard at Yonge and Eglington for 123 Cherry Street Listing', | |
qrCodes: [ | |
{ | |
intent: 'https://jaydeenrealty.com/123cherry/', | |
intentType: 'DYNAMIC_REDIRECT' | |
}, | |
] | |
},{ | |
name: 'Billboard 2', | |
description: 'Billboard at Yonge and Lawrence for 123 Cherry Street Listing', | |
qrCodes: [ | |
{ | |
intent: 'https://jaydeenrealty.com/123cherry/', | |
intentType: 'DYNAMIC_REDIRECT' | |
}, | |
] | |
},{ | |
name: 'Billboard 3', | |
description: 'Billboard at Mt. Pleasant and Eglington for 123 Cherry Street Listing', | |
qrCodes: [ | |
{ | |
intent: 'https://jaydeenrealty.com/123cherry/', | |
intentType: 'DYNAMIC_REDIRECT' | |
}, | |
] | |
}]); | |
console.log('Bulk Assets:', JSON.stringify(bulkAssets, '',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