Skip to main content
POST
/
v2
/
{appId}
/
send-batch
Send Batch Alerts
curl --request POST \
  --url https://alerts-api.dial.to/v2/{appId}/send-batch \
  --header 'Content-Type: application/json' \
  --header 'x-dialect-api-key: <api-key>' \
  --data '
{
  "alerts": [
    {
      "channels": [],
      "message": {
        "title": "Alert Title",
        "body": "Alert body",
        "image": "https://dialect-file-storage.s3.us-west-2.amazonaws.com/avatars/dialect-logo.png",
        "actions": [
          {
            "type": "link",
            "label": "Open Link",
            "url": "https://dialect.to"
          }
        ]
      },
      "recipient": {
        "type": "subscriber",
        "walletAddress": "6CxnSjtasq5Tzwb4b93AhLofXtiDvMpQ2vTkWdSZqTH7"
      },
      "topicId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
      "data": {
        "type": "transaction",
        "transactionId": "123",
        "amount": "100"
      },
      "push": {}
    }
  ]
}
'
import requests

url = "https://alerts-api.dial.to/v2/{appId}/send-batch"

payload = { "alerts": [
{
"channels": [],
"message": {
"title": "Alert Title",
"body": "Alert body",
"image": "https://dialect-file-storage.s3.us-west-2.amazonaws.com/avatars/dialect-logo.png",
"actions": [
{
"type": "link",
"label": "Open Link",
"url": "https://dialect.to"
}
]
},
"recipient": {
"type": "subscriber",
"walletAddress": "6CxnSjtasq5Tzwb4b93AhLofXtiDvMpQ2vTkWdSZqTH7"
},
"topicId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"data": {
"type": "transaction",
"transactionId": "123",
"amount": "100"
},
"push": {}
}
] }
headers = {
"x-dialect-api-key": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'x-dialect-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
alerts: [
{
channels: [],
message: {
title: 'Alert Title',
body: JSON.stringify('Alert body'),
image: 'https://dialect-file-storage.s3.us-west-2.amazonaws.com/avatars/dialect-logo.png',
actions: [{type: 'link', label: 'Open Link', url: 'https://dialect.to'}]
},
recipient: {
type: 'subscriber',
walletAddress: '6CxnSjtasq5Tzwb4b93AhLofXtiDvMpQ2vTkWdSZqTH7'
},
topicId: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
data: {type: 'transaction', transactionId: '123', amount: '100'},
push: {}
}
]
})
};

fetch('https://alerts-api.dial.to/v2/{appId}/send-batch', 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://alerts-api.dial.to/v2/{appId}/send-batch",
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([
'alerts' => [
[
'channels' => [

],
'message' => [
'title' => 'Alert Title',
'body' => 'Alert body',
'image' => 'https://dialect-file-storage.s3.us-west-2.amazonaws.com/avatars/dialect-logo.png',
'actions' => [
[
'type' => 'link',
'label' => 'Open Link',
'url' => 'https://dialect.to'
]
]
],
'recipient' => [
'type' => 'subscriber',
'walletAddress' => '6CxnSjtasq5Tzwb4b93AhLofXtiDvMpQ2vTkWdSZqTH7'
],
'topicId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'data' => [
'type' => 'transaction',
'transactionId' => '123',
'amount' => '100'
],
'push' => [

]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-dialect-api-key: <api-key>"
],
]);

$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://alerts-api.dial.to/v2/{appId}/send-batch"

payload := strings.NewReader("{\n \"alerts\": [\n {\n \"channels\": [],\n \"message\": {\n \"title\": \"Alert Title\",\n \"body\": \"Alert body\",\n \"image\": \"https://dialect-file-storage.s3.us-west-2.amazonaws.com/avatars/dialect-logo.png\",\n \"actions\": [\n {\n \"type\": \"link\",\n \"label\": \"Open Link\",\n \"url\": \"https://dialect.to\"\n }\n ]\n },\n \"recipient\": {\n \"type\": \"subscriber\",\n \"walletAddress\": \"6CxnSjtasq5Tzwb4b93AhLofXtiDvMpQ2vTkWdSZqTH7\"\n },\n \"topicId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"data\": {\n \"type\": \"transaction\",\n \"transactionId\": \"123\",\n \"amount\": \"100\"\n },\n \"push\": {}\n }\n ]\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("x-dialect-api-key", "<api-key>")
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://alerts-api.dial.to/v2/{appId}/send-batch")
.header("x-dialect-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"alerts\": [\n {\n \"channels\": [],\n \"message\": {\n \"title\": \"Alert Title\",\n \"body\": \"Alert body\",\n \"image\": \"https://dialect-file-storage.s3.us-west-2.amazonaws.com/avatars/dialect-logo.png\",\n \"actions\": [\n {\n \"type\": \"link\",\n \"label\": \"Open Link\",\n \"url\": \"https://dialect.to\"\n }\n ]\n },\n \"recipient\": {\n \"type\": \"subscriber\",\n \"walletAddress\": \"6CxnSjtasq5Tzwb4b93AhLofXtiDvMpQ2vTkWdSZqTH7\"\n },\n \"topicId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"data\": {\n \"type\": \"transaction\",\n \"transactionId\": \"123\",\n \"amount\": \"100\"\n },\n \"push\": {}\n }\n ]\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://alerts-api.dial.to/v2/{appId}/send-batch")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["x-dialect-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"alerts\": [\n {\n \"channels\": [],\n \"message\": {\n \"title\": \"Alert Title\",\n \"body\": \"Alert body\",\n \"image\": \"https://dialect-file-storage.s3.us-west-2.amazonaws.com/avatars/dialect-logo.png\",\n \"actions\": [\n {\n \"type\": \"link\",\n \"label\": \"Open Link\",\n \"url\": \"https://dialect.to\"\n }\n ]\n },\n \"recipient\": {\n \"type\": \"subscriber\",\n \"walletAddress\": \"6CxnSjtasq5Tzwb4b93AhLofXtiDvMpQ2vTkWdSZqTH7\"\n },\n \"topicId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"data\": {\n \"type\": \"transaction\",\n \"transactionId\": \"123\",\n \"amount\": \"100\"\n },\n \"push\": {}\n }\n ]\n}"

response = http.request(request)
puts response.read_body
{}
{
"error": {}
}

Authorizations

x-dialect-api-key
string
header
required

API key to authorize app-level requests

Path Parameters

appId
string<uuid>
required

Application ID

Example:

"255d6163-7e25-43e9-a188-c2f8d0980a4a"

Body

application/json
alerts
object[]
required
Required array length: 1 - 500 elements

Response

Batch messages sent successfully

The response is of type object.