Backend Triggers

Use backend events to trigger surveys inside your mobile app and website. Additional properties can be passed with the backend events to add more context to users' responses.

Setting up the Backend Trigger

  • Navigate to Connections Tab > Backend Trigger on Blitzllama's dashboard

  • Click on the Backend Trigger card and then click 'Enable'.

  • Copy the URL 🔗(send backend trigger events on this URL) & the unique API Key 🔑 (add in the API header [x-api-key]).

API call

var request = require('request');

var options = {
  'method': 'POST',
  'url': 'https://events.blitzllama.com/api/v1/connections/backend/event', //copied url
  'headers': {
    'x-api-key': '<copied API Key>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
   "user_id":"user_123",
  "event_name":"item_added_to_cart",
  "properties": {
      "id": 1,
      "name": "War and Peace",
      "author": "Leo Tolstoy",
      "type": "hardcover",
      "category": "novel"
    }
  })
};

request(options, function (error, response) {
  if (error) throw new Error(error);
  console.log(response.body);
});

event_name - this is the name of the backend trigger, which will show up in the Trigger tab on Blitzllama's dashboard after the first successful API.

user_id - the unique user identifier.

properties - JSON object that will be added to each survey responses.

Sample payload

{
  "user_id":"user_123",
  "event_name":"item_added_to_cart",
  "properties": {
      "id": 1,
      "name": "War and Peace",
      "author": "Leo Tolstoy",
      "type": "hardcover",
      ...
      "category": "novel"
    }
  }  

How to trigger an in-app survey using Backend Trigger

  • In the survey editor navigate to "Configure & Launch" > "Select trigger" section

  • Click on "Activate with backend event" option

  • Choose the backend triggers (all your backend triggers will be populated in the dropdown)

  • Add event expiration time (max 100 hours). This allows you maintain relevancy of the survey questions.

  • Lastly, choose where the surveys should show up on your app or website by selecting the frontend triggers from the "Select Trigger" dropdown.

Last updated