Create a notification alert for the customer
1 min
POST
https://app.amberflo.io/customer-portal/notification
Query Parameters
- sessionTokenstringrequiredDescription
Body Parameters
- bodynotification-post-request
- namestringrequiredDescriptionDefaultToo many api calls
- descriptionstringDescriptionDefaultAlert on too many api calls
- notificationTypestring<usage | invoice | prepaid | product-item-units | product-item-price | undefined-meter | undefined-customer>Defaultusage
- meterIdstringDescriptionDefault24ad0b40-a217-11eb-b01a-19ff91d9370d
- cronstringDescription
- frequencystringDescriptionDefaultevery 1h
- webhookUrlstringDescriptionDefaulthttps://hooks.slack.com/services/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
- webhookHeadersstringDescription
- webhookPayloadstringDescription
- emailstring[]DescriptionDefault
- customSubjectstringDescription
- thresholdConditionstring<less-than | greater-than | equals | percent-change | always-true | less-than-percent | greater-than-percent>Defaultgreater-than
- thresholdValuenumberDescriptionDefault1000
- rangestring<hour | day | week | month>DescriptionDefaultday
- productPlanIdstringDescription
- enabledbooleanDescriptionDefaulttrue
Responses
200
- notification-response
- objectnotification-put-request
- idstringrequiredDescription
- namestringrequiredDescriptionDefaultToo many api calls
- descriptionstringDescriptionDefaultAlert on too many api calls
- notificationTypestring<usage | invoice | prepaid | product-item-units | product-item-price | undefined-meter | undefined-customer>Defaultusage
- meterIdstringDescriptionDefault24ad0b40-a217-11eb-b01a-19ff91d9370d
- cronstringDescription
- frequencystringDescriptionDefaultevery 1h
- webhookUrlstringDescriptionDefaulthttps://hooks.slack.com/services/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
- webhookHeadersstringDescription
- webhookPayloadstringDescription
- emailstring[]DescriptionDefault
- customSubjectstringDescription
- thresholdConditionstring<less-than | greater-than | equals | percent-change | always-true | less-than-percent | greater-than-percent>Defaultgreater-than
- thresholdValuenumberDescriptionDefault1000
- rangestring<hour | day | week | month>DescriptionDefaultday
- productPlanIdstringDescription
- enabledbooleanDescriptionDefaulttrue
- object
- createTimeintegerDescription
- updateTimeintegerDescription
curl
curl --request POST \
--url 'https://app.amberflo.io/customer-portal/notification?sessionToken=string' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data-raw '{
"name": "Too many api calls",
"description": "Alert on too many api calls",
"notificationType": "usage",
"meterId": "24ad0b40-a217-11eb-b01a-19ff91d9370d",
"frequency": "every 1h",
"webhookUrl": "https://hooks.slack.com/services/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",
"email": [
"[email protected]"
],
"thresholdCondition": "greater-than",
"thresholdValue": 1000,
"range": "day",
"enabled": true
}'javascript
var myHeaders = new Headers();
myHeaders.append("accept", "application/json");
myHeaders.append("content-type", "application/json");
var raw = JSON.stringify({
"name": "Too many api calls",
"description": "Alert on too many api calls",
"notificationType": "usage",
"meterId": "24ad0b40-a217-11eb-b01a-19ff91d9370d",
"frequency": "every 1h",
"webhookUrl": "https://hooks.slack.com/services/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",
"email": [
"[email protected]"
],
"thresholdCondition": "greater-than",
"thresholdValue": 1000,
"range": "day",
"enabled": true
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://app.amberflo.io/customer-portal/notification?sessionToken=string", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));ruby
require "uri"
require "json"
require "net/http"
url = URI("https://app.amberflo.io/customer-portal/notification?sessionToken=string")
https = Net::HTTP.new(url.host, url.port)
https.use_ssl = true
request = Net::HTTP::Post.new(url)
request["accept"] = "application/json"
request["content-type"] = "application/json"
request.body = JSON.dump({
"name": "Too many api calls",
"description": "Alert on too many api calls",
"notificationType": "usage",
"meterId": "24ad0b40-a217-11eb-b01a-19ff91d9370d",
"frequency": "every 1h",
"webhookUrl": "https://hooks.slack.com/services/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",
"email": [
"[email protected]"
],
"thresholdCondition": "greater-than",
"thresholdValue": 1000,
"range": "day",
"enabled": true
})
response = https.request(request)
puts response.read_body
python
import requests
import json
url = "https://app.amberflo.io/customer-portal/notification?sessionToken=string"
payload = json.dumps({
"name": "Too many api calls",
"description": "Alert on too many api calls",
"notificationType": "usage",
"meterId": "24ad0b40-a217-11eb-b01a-19ff91d9370d",
"frequency": "every 1h",
"webhookUrl": "https://hooks.slack.com/services/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",
"email": [
"[email protected]"
],
"thresholdCondition": "greater-than",
"thresholdValue": 1000,
"range": "day",
"enabled": True
})
headers = {
'accept': 'application/json',
'content-type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
200
// Successful response
{
"id": "",
"name": "",
"description": "",
"notificationType": "",
"meterId": "",
"cron": "",
"frequency": "",
"webhookUrl": "",
"webhookHeaders": "",
"webhookPayload": "",
"email": [
""
],
"customSubject": "",
"thresholdCondition": "",
"thresholdValue": 0,
"range": "",
"productPlanId": "",
"enabled": false,
"createTime": 0,
"updateTime": 0
}