JavaScript
async function shareAlert(alertId, userId, message, email) { const url = `/api/social/v4/alerts/${alertId}/share`; const payload = { userMessage: message, alertSubscriptions: [{ subscriberId: userId, type: 'USER' }], sendEmail, metaData: {}, }; const response = await fetch(url, { body: JSON.stringify(payload), }); return await response.json();}curl --request POST \
--url https://{instance}.domo.com/api/social/v4/alerts/{alertId}/share \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userMessage": "<string>",
"alertSubscriptions": [
{}
],
"sendEmail": true,
"metaData": {}
}
'import requests
url = "https://{instance}.domo.com/api/social/v4/alerts/{alertId}/share"
payload = {
"userMessage": "<string>",
"alertSubscriptions": [{}],
"sendEmail": True,
"metaData": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{instance}.domo.com/api/social/v4/alerts/{alertId}/share",
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([
'userMessage' => '<string>',
'alertSubscriptions' => [
[
]
],
'sendEmail' => true,
'metaData' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{instance}.domo.com/api/social/v4/alerts/{alertId}/share"
payload := strings.NewReader("{\n \"userMessage\": \"<string>\",\n \"alertSubscriptions\": [\n {}\n ],\n \"sendEmail\": true,\n \"metaData\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{instance}.domo.com/api/social/v4/alerts/{alertId}/share")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"userMessage\": \"<string>\",\n \"alertSubscriptions\": [\n {}\n ],\n \"sendEmail\": true,\n \"metaData\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.domo.com/api/social/v4/alerts/{alertId}/share")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userMessage\": \"<string>\",\n \"alertSubscriptions\": [\n {}\n ],\n \"sendEmail\": true,\n \"metaData\": {}\n}"
response = http.request(request)
puts response.read_body"{ \"userMessage\": \"I think you'll find this alert useful\", \"alertSubscriptions\": [{ \"subscriberId\": 12345, \"type\": \"USER\" }], \"sendEmail\": true, \"metaData\": {}}"Alerts API
Share an alert
POST
/
api
/
social
/
v4
/
alerts
/
{alertId}
/
share
JavaScript
async function shareAlert(alertId, userId, message, email) { const url = `/api/social/v4/alerts/${alertId}/share`; const payload = { userMessage: message, alertSubscriptions: [{ subscriberId: userId, type: 'USER' }], sendEmail, metaData: {}, }; const response = await fetch(url, { body: JSON.stringify(payload), }); return await response.json();}curl --request POST \
--url https://{instance}.domo.com/api/social/v4/alerts/{alertId}/share \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"userMessage": "<string>",
"alertSubscriptions": [
{}
],
"sendEmail": true,
"metaData": {}
}
'import requests
url = "https://{instance}.domo.com/api/social/v4/alerts/{alertId}/share"
payload = {
"userMessage": "<string>",
"alertSubscriptions": [{}],
"sendEmail": True,
"metaData": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{instance}.domo.com/api/social/v4/alerts/{alertId}/share",
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([
'userMessage' => '<string>',
'alertSubscriptions' => [
[
]
],
'sendEmail' => true,
'metaData' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://{instance}.domo.com/api/social/v4/alerts/{alertId}/share"
payload := strings.NewReader("{\n \"userMessage\": \"<string>\",\n \"alertSubscriptions\": [\n {}\n ],\n \"sendEmail\": true,\n \"metaData\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{instance}.domo.com/api/social/v4/alerts/{alertId}/share")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"userMessage\": \"<string>\",\n \"alertSubscriptions\": [\n {}\n ],\n \"sendEmail\": true,\n \"metaData\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{instance}.domo.com/api/social/v4/alerts/{alertId}/share")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"userMessage\": \"<string>\",\n \"alertSubscriptions\": [\n {}\n ],\n \"sendEmail\": true,\n \"metaData\": {}\n}"
response = http.request(request)
puts response.read_body"{ \"userMessage\": \"I think you'll find this alert useful\", \"alertSubscriptions\": [{ \"subscriberId\": 12345, \"type\": \"USER\" }], \"sendEmail\": true, \"metaData\": {}}"Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The alertId
Body
application/json
- userMessage (String) Required: The message you want to send to the person
- alertSubscriptions (Object[]) Required: The entities you want to share the alert with. See above for entity params.
- sendEmail (Boolean) : Whether or not to send an email to the person once the alert is shared
- metaData (Object) :
Response
200 - application/json
Returns the parameter of success or error based on the alert id being valid.
The response is of type object.
⌘I