Skip to content

Latest commit

 

History

History
34 lines (26 loc) · 984 Bytes

customer-preferences.md

File metadata and controls

34 lines (26 loc) · 984 Bytes

Customer Preferences

Create or Update a Customer Preference

Save a customer preference using customer id.

const notihub = new Notihub({ ...yourKeys });

notihub.customerContacts.createOrUpdate({ 
        customerId: 'customer-id',
        templateGroupId: 'template-group-id',
        mechanisms: ['EMAIL', 'PUSH'] // Values can be EMAIL, PUSH and/or SMS. NONE is used to turn off.
    }).then(customerPreference => { // Successful response
        console.log(customerPreference.templateGroupId);
    }).catch(error => { // Catch error here.
        console.error(error)
    });

Get a Customer Preference

Retrieve a customer preference by customer id.

const notihub = new Notihub({ ...yourKeys });

notihub.customerContacts.get('customer-id')
    .then(customerPreference => { // Successful response
        console.log(customerPreference.templateGroupId);
    }).catch(error => { // Catch error here.
        console.error(error)
    });