Create a notification subscription
curl --request POST \
--url https://app.demand-iq.com/api/notifications/subscriptions \
--header 'Content-Type: application/json' \
--cookie session= \
--data '
{
"name": "Slack — new presentation",
"eventType": "presentation.opened",
"channelConfig": {},
"deckId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isActive": true
}
'import requests
url = "https://app.demand-iq.com/api/notifications/subscriptions"
payload = {
"name": "Slack — new presentation",
"eventType": "presentation.opened",
"channelConfig": {},
"deckId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isActive": True
}
headers = {
"cookie": "session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Slack — new presentation',
eventType: 'presentation.opened',
channelConfig: {},
deckId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
isActive: true
})
};
fetch('https://app.demand-iq.com/api/notifications/subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.demand-iq.com/api/notifications/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Slack — new presentation',
'eventType' => 'presentation.opened',
'channelConfig' => [
],
'deckId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'isActive' => true
]),
CURLOPT_COOKIE => "session=",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.demand-iq.com/api/notifications/subscriptions"
payload := strings.NewReader("{\n \"name\": \"Slack — new presentation\",\n \"eventType\": \"presentation.opened\",\n \"channelConfig\": {},\n \"deckId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isActive\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "session=")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.demand-iq.com/api/notifications/subscriptions")
.header("cookie", "session=")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Slack — new presentation\",\n \"eventType\": \"presentation.opened\",\n \"channelConfig\": {},\n \"deckId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isActive\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.demand-iq.com/api/notifications/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Slack — new presentation\",\n \"eventType\": \"presentation.opened\",\n \"channelConfig\": {},\n \"deckId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isActive\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"eventType": "<string>",
"channel": "webhook",
"channelConfig": {},
"isActive": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deckId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Notifications
Create a notification subscription
Subscribes to an event type via a delivery channel (webhook, email, or console).
POST
/
api
/
notifications
/
subscriptions
Create a notification subscription
curl --request POST \
--url https://app.demand-iq.com/api/notifications/subscriptions \
--header 'Content-Type: application/json' \
--cookie session= \
--data '
{
"name": "Slack — new presentation",
"eventType": "presentation.opened",
"channelConfig": {},
"deckId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isActive": true
}
'import requests
url = "https://app.demand-iq.com/api/notifications/subscriptions"
payload = {
"name": "Slack — new presentation",
"eventType": "presentation.opened",
"channelConfig": {},
"deckId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"isActive": True
}
headers = {
"cookie": "session=",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {cookie: 'session=', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Slack — new presentation',
eventType: 'presentation.opened',
channelConfig: {},
deckId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
isActive: true
})
};
fetch('https://app.demand-iq.com/api/notifications/subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.demand-iq.com/api/notifications/subscriptions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Slack — new presentation',
'eventType' => 'presentation.opened',
'channelConfig' => [
],
'deckId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'isActive' => true
]),
CURLOPT_COOKIE => "session=",
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.demand-iq.com/api/notifications/subscriptions"
payload := strings.NewReader("{\n \"name\": \"Slack — new presentation\",\n \"eventType\": \"presentation.opened\",\n \"channelConfig\": {},\n \"deckId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isActive\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("cookie", "session=")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.demand-iq.com/api/notifications/subscriptions")
.header("cookie", "session=")
.header("Content-Type", "application/json")
.body("{\n \"name\": \"Slack — new presentation\",\n \"eventType\": \"presentation.opened\",\n \"channelConfig\": {},\n \"deckId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isActive\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.demand-iq.com/api/notifications/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["cookie"] = 'session='
request["Content-Type"] = 'application/json'
request.body = "{\n \"name\": \"Slack — new presentation\",\n \"eventType\": \"presentation.opened\",\n \"channelConfig\": {},\n \"deckId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"isActive\": true\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"organizationId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"eventType": "<string>",
"channel": "webhook",
"channelConfig": {},
"isActive": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"deckId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}Authorizations
Session cookie obtained from POST /api/auth/login.
Body
application/json
Example:
"Slack — new presentation"
Example:
"presentation.opened"
Available options:
webhook, email, console Channel-specific config. Webhook: { url }. Email: { toEmails: ["a@b.com"] }.
Scope to a specific deck (optional)
Response
Subscription created
Available options:
webhook, email, console Channel-specific configuration (e.g. URL for webhook, toEmails for email)