Adding Contacts to Your Project
Openscreen Contacts are a handy way to engage customers who scan your QR Codes. Contacts should be captured against a QR code scan using the CreateContactByScanId
endpoint.
In order to send communications to an Openscreen Contact, the Contact must have a valid consent. See the Consent section below.
Requirements
A (free) Openscreen account
Locally installed Openscreen SDK
Authenticated with Openscreen SDK
An Openscreen Project
Openscreen Dynamic QR Code
A Dynamic QR Code Scan
Creating an Openscreen Contact
When an Openscreen Dynamic QR Code is scanned, a unique scanId is generated. In order to capture your audience, you should program the intent of the QR Code to lead to a webform. This is where a customer would input their information which is then used to create an Openscreen Contact. These Contacts are captured against the unique scanId and are accessible to the Openscreen Project and/or Account, depending on their Consent.
Once a customer has filled out your webform, use the following code to create a Contact:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//A scanId is generated after a Dynamic QR Code is scanned
//paste the scanId from your application below
const scanId = "xxxxxxxxxxxx-xxxxxxxxxxxxx";
async function main(){
//The fields for the contact should originate from your form
const create_contact_by_scan_id = await os.scan(scanId).contacts().create({
firstName,
lastName,
emailAddress,
cellPhone,
customAttributes: {
campaign: "Toronto June listings"
}
consent: [{
url: ["https://sidewalkqr.com/terms-and-conditions", "abc.com/terms-and-conditions"],
consentedAt: "2021-06-20 08:03:00.0",
consentStatus: "ACCEPTED",
consentType: "SMS",
projectId: projectId,
},
{
url: ["https://sidewalkqr.com/terms-and-conditions", "abc.com/terms-and-conditions"],
consentedAt: "2021-06-20 08:03:00.0",
consentStatus: "DECLINED",
consentType: "CUSTOM",
projectId: projectId,
}]
})
// View the new contact that you have created
console.log('Contact:', JSON.stringify(contact, '',2));
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#A scan_id is generated after a Dynamic QR Code is scanned
#Paste the scan_id from your application below
scanId = "xxxxxxxxxxxx-xxxxxxxxxxxxx";
#The fields for the contact should originate from your form
create_contact_by_scan_id = os.scan(scan_id).contacts().create({
"first_name": first_name,
"last_name": last_name,
"email_address": email_address,
"cell_phone": cell_phone,
custom_attributes: {
"campaign": "Toronto June listings"
}
"consent": [{
"url": ["https://sidewalkqr.com/terms-and-conditions", "abc.com/terms-and-conditions"],
"consented_at": "2021-06-20 08:03:00.0",
"consent_status": "ACCEPTED",
"consent_type": "SMS",
"project_id": project_id,
},
{
"url": ["https://sidewalkqr.com/terms-and-conditions", "abc.com/terms-and-conditions"],
"consented_at": "2021-06-20 08:03:00.0",
"consent_status": "DECLINED",
"consent_type": "CUSTOM",
"project_id": projectId,
}]
})
The Consent Object
The Consent object captures an Openscreen Contact's consent to your communications and/or data collection policies. As an application developer using Openscreen, it is your responsibility to capture appropriate consent before communications are sent.
Openscreen SDK and/or API calls to send SMS will fail if a Contact does not have a valid Consent.
The Consent object is an optional parameter of the Contact object, therefore, it can be created at the time of Contact creation (recommended). By default, the scope of the Consent Object applies at an account level, i.e., the Contact is accessible to all Projects in your Openscreen Account. You can limit the scope of the Consent to a project level by passing a projectId
in the Consent object.
In the example above, the Contact is created with a Consent to two URLs (of your terms and conditions) and the scope is limited to the project level.
See the ContactConsent entity for a complete list of attributes.