Notifications

Notifications

The devices that get push notifications.

An SDK signs every request with your key: Authentication. To sign one yourself, see Calling the API without an SDK.

On this page
  1. push.list
  2. push.remove
  3. push.test

push.list

List the devices that get push notifications.

POST/v1/push.list

API token

Parameters

It takes no input: send an empty object.

Returns

data is a list of objects, each with:

  • idstring
  • namestring
  • serviceenum

    One ofGoogleAppleMozillaOther

  • timeZonestring
  • currentboolean
  • createdAtnumber
  • lastSentAtnullable number

In the CLIErrors

import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.push.list();
console.log(answer);
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.push.list()
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	answer, err := client.Push.List(ctx)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.push.list
p answer
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->push->list();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.PushDevice;
import java.util.List;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

List<PushDevice> answer = mailset.push().list();
System.out.println(answer);
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset.push().list().await?;
println!("{answer:?}");
curl https://mailset.app/v1/push.list \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset push list
Response
{
  "ok": true,
  "data": [
    {
      "id": "out_3f9a1c0e7b2d",
      "name": "Acme API",
      "service": "Google",
      "timeZone": "text",
      "current": true,
      "createdAt": 1796048940000,
      "lastSentAt": 1796048940000
    }
  ]
}

push.remove

Stop push to a device.

POST/v1/push.remove

API token

Parameters

  • idstringrequired

    The device’s id, from push list.

Returns

data is an object with:

  • removedboolean

In the CLIErrors

import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.push.remove({
	id: "ps_7c2e9a4f1b6d3058e1a4c9b3",
});
console.log(answer);
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.push.remove(
    {"id": "ps_7c2e9a4f1b6d3058e1a4c9b3"}
)
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	params := &mailset.PushRemoveParams{
		ID: "ps_7c2e9a4f1b6d3058e1a4c9b3",
	}
	answer, err := client.Push.Remove(ctx, params)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.push.remove(
  id: 'ps_7c2e9a4f1b6d3058e1a4c9b3'
)
p answer
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->push->remove([
    'id' => 'ps_7c2e9a4f1b6d3058e1a4c9b3',
]);
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.PushRemoveParams;
import app.mailset.model.PushRemoveResult;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

var params = PushRemoveParams.builder()
        .id("ps_7c2e9a4f1b6d3058e1a4c9b3")
        .build();
PushRemoveResult answer = mailset.push().remove(params);
System.out.println(answer);
use mailset::types::PushRemoveParams;

// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer = mailset
    .push()
    .remove(PushRemoveParams {
        id: "ps_7c2e9a4f1b6d3058e1a4c9b3".into(),
    })
    .await?;
println!("{answer:?}");
curl https://mailset.app/v1/push.remove \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{"id":"ps_7c2e9a4f1b6d3058e1a4c9b3"}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset push remove ps_7c2e9a4f1b6d3058e1a4c9b3
Response
{
  "ok": true,
  "data": {
    "removed": true
  }
}

push.test

Send a test notification to your devices, or one with id.

POST/v1/push.test

API token

Parameters

  • idstringoptional

    Only this device, by its id from push list. Left out: all of yours.

Returns

data is an object with:

  • sentnumber
  • failednumber
  • removednumber

    Devices the push service no longer knows, now forgotten.

In the CLIErrors

import { Mailset } from 'mailset';

// Reads MAILSET_TOKEN from the environment.
const mailset = new Mailset();

const answer = await mailset.push.test();
console.log(answer);
from mailset import Mailset

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset()

answer = mailset.push.test()
print(answer)
package main

import (
	"context"
	"fmt"
	"log"

	mailset "mailset.app/go"
)

func main() {
	// Reads MAILSET_TOKEN from the environment.
	client, err := mailset.NewClient()
	if err != nil {
		log.Fatal(err)
	}
	ctx := context.Background()
	answer, err := client.Push.Test(ctx, nil)
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(answer)
}
require 'mailset'

# Reads MAILSET_TOKEN from the environment.
mailset = Mailset::Client.new

answer = mailset.push.test
p answer
<?php

require 'vendor/autoload.php';

// Reads MAILSET_TOKEN from the environment.
$mailset = new Mailset\Client();

$answer = $mailset->push->test();
echo json_encode($answer, JSON_PRETTY_PRINT), PHP_EOL;
import app.mailset.Mailset;
import app.mailset.model.PushTest;

// Reads MAILSET_TOKEN from the environment.
Mailset mailset = Mailset.fromEnv();

PushTest answer = mailset.push().test();
System.out.println(answer);
// Reads MAILSET_TOKEN from the environment.
let mailset = mailset::Client::from_env()?;

let answer =
    mailset.push().test(Default::default()).await?;
println!("{answer:?}");
curl https://mailset.app/v1/push.test \
  -H "Authorization: Bearer $TOKEN" \
  -H "ms-time: $MS_TIME" \
  -H "ms-proof: $MS_PROOF" \
  -H "Content-Type: application/json" \
  -d '{"input":{}}'

curl can’t sign a request. $TOKEN is your credential’s token, and $MS_TIME and $MS_PROOF sign this exact body: Calling the API without an SDK shows how.

mailset push test
Response
{
  "ok": true,
  "data": {
    "sent": 12,
    "failed": 1,
    "removed": 1
  }
}