Skip to content

Instantly share code, notes, and snippets.

@birinder-lobana
birinder-lobana / create_static_QR.js
Created May 2, 2022 20:01
Create a static QR code
// 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'
// Generate your first Static QR Code
async function main() {
// Create an asset and generate a static QR Code
@birinder-lobana
birinder-lobana / create_dynamic_batch_qr.js
Created May 3, 2022 16:09
Create a batch of dynamic QR codes
// 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.
@birinder-lobana
birinder-lobana / dynamic_batch_return.json
Last active July 13, 2022 19:05
Dynamic Batch Response
{
"assets": [
{
"assetId": "59e5c13e-8ac3-499e-8d4b-5fd4abf5b2af",
"projectId": "c166f2dd-9ea8-4a79-90d5-fa6989f885e6",
"name": "Billboard 1",
"description": "Billboard at Yonge and Eglington for 123 Cherry Street Listing",
"qrCodes": [
{
"qrCodeId": "24678051-b380-4fdb-98d6-541d8d08e850",
@birinder-lobana
birinder-lobana / get_scan_info.js
Created May 3, 2022 17:10
Retrieve details about a QR Code scan
// 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 assetId = 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx';
async function main(){
@birinder-lobana
birinder-lobana / scan_object.json
Last active May 10, 2022 18:29
Retrieve Scans response
{
"entityType": "app.scan",
"created": "2021-10-07T18:38:06.616Z",
"modified": "2021-10-07T18:38:06.616Z",
"assetId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"scanId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"projectId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"qrCodeId": "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"ipAddress": "xx.xxx.xxx.xx",
"scanTime": "2021-10-07T18:38:05.557Z",
@birinder-lobana
birinder-lobana / Creating_a_contact.js
Created May 3, 2022 17:44
Creating a contact with a 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(){
@birinder-lobana
birinder-lobana / creating_sms_template.js
Created May 3, 2022 17:48
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(){
@birinder-lobana
birinder-lobana / send_sms.js
Created May 3, 2022 17:53
Send SMS using Openscreen SDK to a contact using an SMS template.
// 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(){
@birinder-lobana
birinder-lobana / authentication.py
Created June 23, 2022 19:16
Authenticate your python application
from openscreen import Openscreen
import os
#Obtain your access key and secret from Openscreen Dashboard
ospro = Openscreen(access_key=os.environ.get('OS_ACCESS_KEY'), access_secret=os.environ.get('OS_ACCESS_SECRET'))
#Create a new project on Openscreen Dashboard. Paste the projectId below
projectId = os.environ.get('PROJECT_ID')
@birinder-lobana
birinder-lobana / create_asset_and_qr_code.py
Last active June 27, 2022 16:00
Create an Asset and a QR Code using Openscreen's python SDK
from openscreen import Openscreen
import os
#Obtain your access key and secret from Openscreen Dashboard
ospro = Openscreen(access_key=os.environ.get('OS_ACCESS_KEY'), access_secret=os.environ.get('OS_ACCESS_SECRET'))
#Create a new project on Openscreen Dashboard. Paste the projectId below
projectId = os.environ.get('PROJECT_ID')
#Create an Asset with a QR code
my_asset_response = ospro.project(projectId).assets().create({
'name': '123 Main Steet Sign',