Follow

Configuring Notifications via API

Event-based notifications can also be triggered by making an API call from your side to the Capriza service. This article details the information you will need from Capriza and collect internally as well as how to execute the API call.

 

Assets Provided by Capriza

 

Please contact your Customer Success Manager to obtain the following information:

  1. Org API Access Key (e.g. _access_key_hhgasd88887999asdd)

  2. Notification URL: For WorkSimple and a given Zapp a unique notification URL is provided (e.g. https://api.capriza.com/catalog/api_notifications/hgT76FXkl)

Required Internal Assets

  1. Notification Title: e.g. “you have {{X}} new approvals”. This field is optional. If not set up, a title should be provided in each API call.

  2. Notification subTitle:  e.g. “please review discount request for opportunity {{OPPPRTUNITY_NAME}}”. This field is optional. If not set up, a title should be provided in each API call or left blank.

  3. Zapp Name: This field is optional. If not provided, Store notifications will be triggered.

  4. Zapp URL suffix: For direct-link start URL. (e.g. #zapp_param_oppid={{OPPID}}&zapp_start_url=1) This field is optional and should only be filled out if the Zapp name is provided.

How to Trigger an Event-Based Push Notification

 

Triggering a notification is done by posting an API call to the Capriza Service.

 

The notifications API parameters are:

  • Users: List of users to send the notification to (users should be signed up for the Capriza service).

  • Data: All parameters are optional (see Required Assets).
    • Title - if not defined at setup
    • subTitle - if not defined at setup
    • Dynamic variables as required (for title, subTitle, url suffix) - if so defined at setup

Example 1

 

An example of a notification (Note: Title and subTitle were not defined at setup):

var sendData = {
    users:  ["john.smith@domain.com", "jane.cohen@domain.com"],
    data:   {
        "title"     : "Approval Waiting",
        "subTitle" : "click for more details"
    }
};

var apiUrl = "https://api.capriza.com/catalog/api_notifications/hgT76FXkl/send_notification.json?auth_token=_access_key_hhgasd88887999asdd";

 

Ways to call the API:

 

Option 1:

 

$.ajax({
    type : 'post',
    url  : apiUrl,
    data : sendData
}).done(function(data, statusText, xhr){
    var status = xhr.status;
    // data ==> {"success":true,"errors":""}
    // status ==> 200
});

 

Option 2:

 

$.post(apiUrl, sendData, function(data, status) {
    // data ==> {"success":true,"errors":""}
    // status ==> “successful”
});

 

Option 3:

 

curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"users":
["jhon.smith@domain.com"],"data":{"title":"Approval Waiting","subTitle":"click for more details"}}' 
 https://api.capriza.com/catalog/api_notifications/gy6d50x/send_notification.json?auth_token=_access_key_06k81-5b2e-4bfd-9c
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.