Skip to content

Sync Alerts

Request URL

POST /alerts

Description

Synchronize a set of alerts with the corresponding alerts on the user's device, to be sure the local device and the server have the latest alerts. The request body is an array containing alert objects to sync.

Schema

Array table for alerts

Array containing Description Required Schema
alerts items alerts items Array of alerts objects

Property table for alerts object

Property Description Required Schema
alertTypeId Name of alert type Yes {
  "type": "string"
}
category The entity category No {
  "type": "string",
  "nullable": true
}
name Name of the entity No {
  "type": "string",
  "nullable": true
}
isEnabled true if enabled No {
  "type": "boolean",
  "nullable": true
}
parameters An object containing additional parameters No {
  "type": "object",
  "nullable": true
}

Request Body

[{
    "alertTypeId": "alert1",
    "category": "general",
    "name": "Credit",
    "isEnabled": true
}]

Snippet Examples

javascript

const axios = require('axios');
const data = [{
    "alertTypeId": "alert1",
    "category": "general",
    "name": "Credit",
    "isEnabled": true
}];
const config = {
  method: 'POST',
  url: '${AMPLIFI_BASE_URL}/alerts',
  headers: {
    'Content-Type': "application/json",
    'token': "A long random string token received from /token request"
  },
  data
};

let result;
try {
  result = await axios.request(config);
  if (result.status === 200) {
    console.log(JSON.stringify(result.data));
  }
} catch (err) {
  console.log({
    errCode: err.code,
    responseStatus: err.response && err.response.status,
    data: err.response && JSON.stringify(err.response.data)
  });
}

cURL

curl --location "AMPLIFI_BASE_URL/alerts" --data "[{    \"alertTypeId\":\"alert1\",   \"category\":\"general\",   \"name\":\"Credit\",   \"isEnabled\":true}]" --header "Content-Type: application/json" --header "token: A long random string token received from /token request" 

Successful Response Examples

200 ALERTS SUCCESSFUL RESPONSE SYNCING KNOWN ALERTTYPEID

HEADERS

Header Value
Content-Type application/json
token A long random string token received from /token request

REQUEST BODY

[{
    "alertTypeId": "alert4",
    "category": "general",
    "name": "Loans due",
    "isEnabled": false
}]

RESPONSE BODY

{
    "alerts": [
        {
            "alertTypeId": "alert1",
            "category": "general",
            "name": "Credit",
            "isEnabled": true,
            "descriptionOn": "On every incoming transfer",
            "descriptionOff": "On every incoming transfer"
        },
        {
            "alertTypeId": "alert2",
            "category": "general",
            "name": "Purchase",
            "isEnabled": true,
            "descriptionOn": "When any card is used at a store",
            "descriptionOff": "When any card is used at a store"
        },
        {
            "alertTypeId": "alert21",
            "category": "general",
            "name": "Debit",
            "isEnabled": false,
            "descriptionOn": "When money leaves my account",
            "descriptionOff": "When money leaves my account"
        },
        {
            "alertTypeId": "alert4",
            "name": "Loans due",
            "category": "general",
            "isEnabled": false,
            "descriptionOn": "When loans are due",
            "descriptionOff": "When loans are due",
            "dtsModified": "2023-12-15T13:43:07.145Z"
        },
        {
            "alertTypeId": "summaryReportsMonthly",
            "name": "Monthly",
            "category": "summaryReports",
            "isEnabled": false
        },
        {
            "alertTypeId": "summaryReportsQuarterly",
            "name": "Quarterly",
            "category": "summaryReports",
            "isEnabled": false
        },
        {
            "alertTypeId": "summaryReportsAnnually",
            "name": "Annually",
            "category": "summaryReports",
            "isEnabled": true
        }
    ],
    "success": true
}

200 ALERTS SUCCESSFUL RESPONSE SYNCED ALERT IS NOT ONE OF THE KNOWN ALERTTYPEIDS (NO CHANGES)

HEADERS

Header Value
Content-Type application/json
token A long random string token received from /token request

REQUEST BODY

[{
    "alertTypeId": "alert54"
}]

RESPONSE BODY

{
    "alerts": [
        {
            "alertTypeId": "alert1",
            "category": "general",
            "name": "Credit",
            "isEnabled": true,
            "descriptionOn": "On every incoming transfer",
            "descriptionOff": "On every incoming transfer"
        },
        {
            "alertTypeId": "alert2",
            "category": "general",
            "name": "Purchase",
            "isEnabled": true,
            "descriptionOn": "When any card is used at a store",
            "descriptionOff": "When any card is used at a store"
        },
        {
            "alertTypeId": "alert21",
            "category": "general",
            "name": "Debit",
            "isEnabled": false,
            "descriptionOn": "When money leaves my account",
            "descriptionOff": "When money leaves my account"
        },
        {
            "alertTypeId": "alert4",
            "name": "Loans due",
            "category": "general",
            "isEnabled": true,
            "descriptionOn": "When loans are due",
            "descriptionOff": "When loans are due"
        },
        {
            "alertTypeId": "summaryReportsMonthly",
            "name": "Monthly",
            "category": "summaryReports",
            "isEnabled": false
        },
        {
            "alertTypeId": "summaryReportsQuarterly",
            "name": "Quarterly",
            "category": "summaryReports",
            "isEnabled": false
        },
        {
            "alertTypeId": "summaryReportsAnnually",
            "name": "Annually",
            "category": "summaryReports",
            "isEnabled": true
        }
    ],
    "success": true
}