Files
notify/docs/v0.1.0/classes/default.html
Continuous Integration 681fde9457 CI updated the documentation
2025-09-01 10:54:09 +00:00

88 lines
63 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html class="default" lang="en" data-base=".."><head><meta charset="utf-8"/><meta http-equiv="x-ua-compatible" content="IE=edge"/><title>default | @cis-oss/pushover</title><meta name="description" content="Documentation for @cis-oss/pushover"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="../assets/style.css"/><link rel="stylesheet" href="../assets/highlight.css"/><script defer src="../assets/main.js"></script><script async src="../assets/icons.js" id="tsd-icons-script"></script><script async src="../assets/search.js" id="tsd-search-script"></script><script async src="../assets/navigation.js" id="tsd-nav-script"></script><style>
.tsd-ext-version-select .settings-label {
margin: 0.75rem 0.75rem 0 0;
</style><link rel="stylesheet" href="../assets/typedoc-github-style.css"/></head><body><script>document.documentElement.dataset.theme = localStorage.getItem("tsd-theme") || "os";document.body.style.display="none";setTimeout(() => app?app.showPage():document.body.style.removeProperty("display"),500)</script><header class="tsd-page-toolbar"><div class="tsd-toolbar-contents container"><div class="table-cell" id="tsd-search"><div class="field"><label for="tsd-search-field" class="tsd-widget tsd-toolbar-icon search no-caption"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-search"></use></svg></label><input type="text" id="tsd-search-field" aria-label="Search"/></div><div class="field"><div id="tsd-toolbar-links"></div></div><ul class="results"><li class="state loading">Preparing search index...</li><li class="state failure">The search index is not available</li></ul><a href="../index.html" class="title">@cis-oss/pushover</a></div><div class="table-cell" id="tsd-widgets"><a href="#" class="tsd-widget tsd-toolbar-icon menu no-caption" data-toggle="menu" aria-label="Menu"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-menu"></use></svg></a></div></div></header><div class="container container-main"><div class="col-content"><div class="tsd-page-title"><ul class="tsd-breadcrumb"><li><a href="../modules.html">@cis-oss/pushover</a></li><li><a href="default.html">default</a></li></ul><h1>Class default</h1></div><section class="tsd-panel tsd-comment"><div class="tsd-comment tsd-typography"><p>Main class for interacting with the Pushover API (v1).
Provides methods for sending notifications, validating users/devices,
and managing emergency priority messages.</p>
</div><div class="tsd-comment tsd-typography"><div class="tsd-tag-param"><h4 class="tsd-anchor-link"><a id="param-token" class="tsd-anchor"></a>Param: token<a href="#param-token" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><p>Your Pushover application's API token.</p>
</div><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example" class="tsd-anchor"></a>Example<a href="#example" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-3">import</span><span class="hl-1"> { </span><span class="hl-4">Pushover</span><span class="hl-1"> } </span><span class="hl-3">from</span><span class="hl-1"> </span><span class="hl-2">&quot;@cis-oss/pushover&quot;</span><span class="hl-1">;</span><br/><br/><span class="hl-5">// Initialize the client</span><br/><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">pushover</span><span class="hl-1"> = </span><span class="hl-6">new</span><span class="hl-1"> </span><span class="hl-0">Pushover</span><span class="hl-1">(</span><span class="hl-2">&quot;YOUR_APP_API_TOKEN&quot;</span><span class="hl-1">);</span><br/><br/><span class="hl-5">// Define recipients</span><br/><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">recipients</span><span class="hl-1"> = [</span><br/><span class="hl-1"> { </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">&quot;USER_KEY_1&quot;</span><span class="hl-1"> },</span><br/><span class="hl-1"> { </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">&quot;USER_KEY_2&quot;</span><span class="hl-1">, </span><span class="hl-4">devices:</span><span class="hl-1"> [</span><span class="hl-2">&quot;DEVICE_1&quot;</span><span class="hl-1">, </span><span class="hl-2">&quot;DEVICE_2&quot;</span><span class="hl-1">] },</span><br/><span class="hl-1"> { </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">&quot;GROUP_KEY_1&quot;</span><span class="hl-1"> },</span><br/><span class="hl-1">];</span><br/><br/><span class="hl-5">// Send a basic message</span><br/><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">responses</span><span class="hl-1"> = </span><span class="hl-4">pushover</span><span class="hl-1">.</span><span class="hl-0">send</span><span class="hl-1">(</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">message:</span><span class="hl-1"> </span><span class="hl-2">&quot;Hello from the library!&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">title:</span><span class="hl-1"> </span><span class="hl-2">&quot;Test Message&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> { </span><span class="hl-4">recipients</span><span class="hl-1"> },</span><br/><span class="hl-1">);</span><br/><br/><span class="hl-4">responses</span><br/><span class="hl-1"> .</span><span class="hl-0">then</span><span class="hl-1">((</span><span class="hl-4">responses</span><span class="hl-1">) </span><span class="hl-6">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">&quot;Messages sent:&quot;</span><span class="hl-1">, </span><span class="hl-4">responses</span><span class="hl-1">);</span><br/><span class="hl-1"> })</span><br/><span class="hl-1"> .</span><span class="hl-0">catch</span><span class="hl-1">((</span><span class="hl-4">error</span><span class="hl-1">) </span><span class="hl-6">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">(</span><span class="hl-2">&quot;Failed to send messages:&quot;</span><span class="hl-1">, </span><span class="hl-4">error</span><span class="hl-1">);</span><br/><span class="hl-1"> });</span>
</code><button type="button">Copy</button></pre>
</div></div></section><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cis-oss/pushover/blob/5d223831ce363827b196d9e1016b2ae33c7d3140/src/Pushover.ts#L317">src/Pushover.ts:317</a></li></ul></aside><section class="tsd-panel-group tsd-index-group"><section class="tsd-panel tsd-index-panel"><details class="tsd-index-content tsd-accordion" open><summary class="tsd-accordion-summary tsd-index-summary"><h5 class="tsd-index-heading uppercase" role="button" aria-expanded="false" tabIndex="0"><svg width="16" height="16" viewBox="0 0 16 16" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronSmall"></use></svg> Index</h5></summary><div class="tsd-accordion-details"><section class="tsd-index-section"><h3 class="tsd-index-heading">Constructors</h3><div class="tsd-index-list"><a href="default.html#constructor" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a>
</div></section><section class="tsd-index-section"><h3 class="tsd-index-heading">Methods</h3><div class="tsd-index-list"><a href="default.html#cancelretries" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>cancel<wbr/>Retries</span></a>
<a href="default.html#cancelretriesbytag" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>cancel<wbr/>Retries<wbr/>By<wbr/>Tag</span></a>
<a href="default.html#checkreceipt" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>check<wbr/>Receipt</span></a>
<a href="default.html#send" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>send</span></a>
<a href="default.html#validate" class="tsd-index-link"><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>validate</span></a>
</div></section></div></details></section></section><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Constructors"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Constructors</h2></summary><section><section class="tsd-panel tsd-member"><a id="constructor" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>constructor</span><a href="#constructor" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="constructordefault" class="tsd-anchor"></a><span class="tsd-signature-keyword">new</span> <span class="tsd-kind-constructor-signature">default</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">token</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="default.html" class="tsd-signature-type tsd-kind-class">default</a><a href="#constructordefault" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Creates an instance of the Pushover client.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">token</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>Your Pushover application's API token. Found on your Pushover dashboard.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="default.html" class="tsd-signature-type tsd-kind-class">default</a></h4><div class="tsd-comment tsd-typography"></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cis-oss/pushover/blob/5d223831ce363827b196d9e1016b2ae33c7d3140/src/Pushover.ts#L325">src/Pushover.ts:325</a></li></ul></aside></div></li></ul></section></section></details><details class="tsd-panel-group tsd-member-group tsd-accordion" open><summary class="tsd-accordion-summary" data-key="section-Methods"><h2><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg> Methods</h2></summary><section><section class="tsd-panel tsd-member"><a id="cancelretries" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>cancel<wbr/>Retries</span><a href="#cancelretries" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="cancelretries-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">cancelRetries</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">receipt</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span> <span class="tsd-kind-parameter">verbose</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">PushoverResponse</span><span class="tsd-signature-symbol">&gt;</span><a href="#cancelretries-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Cancels the retries for an emergency priority message that has not yet been acknowledged.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">receipt</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The receipt ID of the emergency message whose retries should be cancelled.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">verbose</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Optional flag for logging.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><span class="tsd-signature-type">PushoverResponse</span><span class="tsd-signature-symbol">&gt;</span></h4><p>A Promise resolving to a basic <code>PushoverResponse</code>. Check <code>status</code> for success (1) or failure (0).</p>
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-1" class="tsd-anchor"></a>Example<a href="#example-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">receiptId</span><span class="hl-1"> = </span><span class="hl-2">&quot;RECEIPT_ID_TO_CANCEL&quot;</span><span class="hl-1">;</span><br/><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">cancelResponse</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">pushover</span><span class="hl-1">.</span><span class="hl-0">cancelRetries</span><span class="hl-1">(</span><span class="hl-4">receiptId</span><span class="hl-1">);</span><br/><span class="hl-3">if</span><span class="hl-1"> (</span><span class="hl-4">cancelResponse</span><span class="hl-1">.</span><span class="hl-4">status</span><span class="hl-1"> === </span><span class="hl-8">1</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">&quot;Successfully cancelled retries for receipt:&quot;</span><span class="hl-1">, </span><span class="hl-4">receiptId</span><span class="hl-1">);</span><br/><span class="hl-1">} </span><span class="hl-3">else</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">(</span><span class="hl-2">&quot;Failed to cancel retries:&quot;</span><span class="hl-1">, </span><span class="hl-4">cancelResponse</span><span class="hl-1">.</span><span class="hl-4">errors</span><span class="hl-1">);</span><br/><span class="hl-1">}</span>
</code><button type="button">Copy</button></pre>
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cis-oss/pushover/blob/5d223831ce363827b196d9e1016b2ae33c7d3140/src/Pushover.ts#L673">src/Pushover.ts:673</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="cancelretriesbytag" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>cancel<wbr/>Retries<wbr/>By<wbr/>Tag</span><a href="#cancelretriesbytag" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="cancelretriesbytag-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">cancelRetriesByTag</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">tag</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">verbose</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/PushoverTagCancellationResponse.html" class="tsd-signature-type tsd-kind-interface">PushoverTagCancellationResponse</a><span class="tsd-signature-symbol">&gt;</span><a href="#cancelretriesbytag-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Cancels the retries for all emergency priority messages associated with a specific tag
that have not yet been acknowledged.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">tag</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The tag associated with the emergency messages (set in <code>emergencyOpts.tags</code> during send).</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">verbose</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Optional flag for logging.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/PushoverTagCancellationResponse.html" class="tsd-signature-type tsd-kind-interface">PushoverTagCancellationResponse</a><span class="tsd-signature-symbol">&gt;</span></h4><p>A Promise resolving to a <code>PushoverTagCancellationResponse</code> indicating the number of messages cancelled.</p>
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-2" class="tsd-anchor"></a>Example<a href="#example-2" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">tagName</span><span class="hl-1"> = </span><span class="hl-2">&quot;critical-db-alert&quot;</span><span class="hl-1">;</span><br/><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">cancelByTagResponse</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">pushover</span><span class="hl-1">.</span><span class="hl-0">cancelRetriesByTag</span><span class="hl-1">(</span><span class="hl-4">tagName</span><span class="hl-1">);</span><br/><span class="hl-3">if</span><span class="hl-1"> (</span><span class="hl-4">cancelByTagResponse</span><span class="hl-1">.</span><span class="hl-4">status</span><span class="hl-1"> === </span><span class="hl-8">1</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">`Successfully cancelled </span><span class="hl-6">${</span><span class="hl-4">cancelByTagResponse</span><span class="hl-9">.</span><span class="hl-4">canceled</span><span class="hl-6">}</span><span class="hl-2"> messages with tag: </span><span class="hl-6">${</span><span class="hl-4">tagName</span><span class="hl-6">}</span><span class="hl-2">`</span><span class="hl-1">,</span><br/><span class="hl-1"> );</span><br/><span class="hl-1">} </span><span class="hl-3">else</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">(</span><span class="hl-2">&quot;Failed to cancel by tag:&quot;</span><span class="hl-1">, </span><span class="hl-4">cancelByTagResponse</span><span class="hl-1">.</span><span class="hl-4">errors</span><span class="hl-1">);</span><br/><span class="hl-1">}</span>
</code><button type="button">Copy</button></pre>
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cis-oss/pushover/blob/5d223831ce363827b196d9e1016b2ae33c7d3140/src/Pushover.ts#L705">src/Pushover.ts:705</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="checkreceipt" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>check<wbr/>Receipt</span><a href="#checkreceipt" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="checkreceipt-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">checkReceipt</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">receipt</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">verbose</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/PushoverReceiptResponse.html" class="tsd-signature-type tsd-kind-interface">PushoverReceiptResponse</a><span class="tsd-signature-symbol">&gt;</span><a href="#checkreceipt-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Checks the status of an emergency priority message using its receipt ID.
Allows querying whether the message has been acknowledged, expired, or if the callback was triggered.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">receipt</span>: <span class="tsd-signature-type">string</span></span><div class="tsd-comment tsd-typography"><p>The receipt ID obtained from the <code>PushoverMessageResponse</code> when sending an emergency message.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li><span><code class="tsd-tag">Optional</code><span class="tsd-kind-parameter">verbose</span>: <span class="tsd-signature-type">boolean</span></span><div class="tsd-comment tsd-typography"><p>Optional flag for logging.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/PushoverReceiptResponse.html" class="tsd-signature-type tsd-kind-interface">PushoverReceiptResponse</a><span class="tsd-signature-symbol">&gt;</span></h4><p>A Promise resolving to a <code>PushoverReceiptResponse</code> object containing the status details.</p>
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-3" class="tsd-anchor"></a>Example<a href="#example-3" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">receiptId</span><span class="hl-1"> = </span><span class="hl-2">&quot;RECEIPT_ID_FROM_SEND_RESPONSE&quot;</span><span class="hl-1">;</span><br/><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">status</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">pushover</span><span class="hl-1">.</span><span class="hl-0">checkReceipt</span><span class="hl-1">(</span><span class="hl-4">receiptId</span><span class="hl-1">);</span><br/><span class="hl-3">if</span><span class="hl-1"> (</span><span class="hl-4">status</span><span class="hl-1">.</span><span class="hl-4">status</span><span class="hl-1"> === </span><span class="hl-8">1</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">`Acknowledged: </span><span class="hl-6">${</span><span class="hl-4">status</span><span class="hl-9">.</span><span class="hl-4">acknowledged</span><span class="hl-6">}</span><span class="hl-2"> by </span><span class="hl-6">${</span><span class="hl-4">status</span><span class="hl-9">.</span><span class="hl-4">acknowledged_by</span><span class="hl-6">}</span><span class="hl-2">`</span><span class="hl-1">,</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">`Expired: </span><span class="hl-6">${</span><span class="hl-4">status</span><span class="hl-9">.</span><span class="hl-4">expired</span><span class="hl-6">}</span><span class="hl-2">`</span><span class="hl-1">);</span><br/><span class="hl-1">} </span><span class="hl-3">else</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">(</span><span class="hl-2">&quot;Failed to check receipt:&quot;</span><span class="hl-1">, </span><span class="hl-4">status</span><span class="hl-1">.</span><span class="hl-4">errors</span><span class="hl-1">);</span><br/><span class="hl-1">}</span>
</code><button type="button">Copy</button></pre>
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cis-oss/pushover/blob/5d223831ce363827b196d9e1016b2ae33c7d3140/src/Pushover.ts#L642">src/Pushover.ts:642</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="send" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>send</span><a href="#send" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="send-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">send</span><span class="tsd-signature-symbol">(</span><br/>    <span class="tsd-kind-parameter">message</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-symbol">{</span><br/>        <span class="tsd-kind-property">emergencyOpts</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">{</span><br/>            <span class="tsd-kind-property">callback</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/>            <span class="tsd-kind-property">expire</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/>            <span class="tsd-kind-property">retry</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/>            <span class="tsd-kind-property">tags</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">html</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">link</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><br/>        <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">url</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">message</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">monospace</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">priority</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">0</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">1</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">2</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">-2</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">-1</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">sound</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">timestamp</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">ttl</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/>    <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">,</span><br/>    <span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/SendOptions.html" class="tsd-signature-type tsd-kind-interface">SendOptions</a><span class="tsd-signature-symbol">,</span><br/><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/PushoverMessageResponse.html" class="tsd-signature-type tsd-kind-interface">PushoverMessageResponse</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span><a href="#send-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Sends a Pushover notification to one or more recipients.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">message</span>: <span class="tsd-signature-symbol">{</span><br/>    <span class="tsd-kind-property">emergencyOpts</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-symbol">{</span><br/>        <span class="tsd-kind-property">callback</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">expire</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">retry</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/>        <span class="tsd-kind-property">tags</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">;</span><br/>    <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">;</span><br/>    <span class="tsd-kind-property">html</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/>    <span class="tsd-kind-property">link</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><br/>    <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">url</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span><span class="tsd-signature-symbol">;</span><br/>    <span class="tsd-kind-property">message</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/>    <span class="tsd-kind-property">monospace</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">boolean</span><span class="tsd-signature-symbol">;</span><br/>    <span class="tsd-kind-property">priority</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">0</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">1</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">2</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">-2</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">-1</span><span class="tsd-signature-symbol">;</span><br/>    <span class="tsd-kind-property">sound</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/>    <span class="tsd-kind-property">timestamp</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/>    <span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span><br/>    <span class="tsd-kind-property">ttl</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span><br/><span class="tsd-signature-symbol">}</span></span><div class="tsd-comment tsd-typography"><p>A <code>PushoverMessage</code> object containing the notification details.</p>
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">emergencyOpts</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">callback</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">expire</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">retry</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">tags</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span> <span class="tsd-signature-symbol">}</span></h5><div class="tsd-comment tsd-typography"><p>Emergency priority options, required when <code>priority</code> is 2.</p>
</div><div class="tsd-comment tsd-typography"></div><ul class="tsd-parameters"><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">callback</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>An optional callback URL that Pushover servers will send a request to when the notification has been acknowledged.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">expire</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>Specifies how long (in seconds) the notification will continue to be resent.
Maximum value is 10800 seconds (3 hours).</p>
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">retry</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>Specifies how often (in seconds) the Pushover servers will send the same notification to the user.
Minimum value is 30 seconds.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">tags</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">[]</span></h5><div class="tsd-comment tsd-typography"><p>Optional tags for emergency notifications. Helps with cancelling retries.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">html</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><p>If set to true, the message content will be treated as HTML.
Mutually exclusive with <code>monospace</code>.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">link</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-symbol">{</span> <span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?:</span> <span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">;</span> <span class="tsd-kind-property">url</span><span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span> <span class="tsd-signature-symbol">}</span></h5><div class="tsd-comment tsd-typography"><p>An optional link attached to the message.
Can be either a simple URL string or an object containing the URL and an optional display title.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><span class="tsd-kind-property">message</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>The message content sent to the user. Must be at least 3 characters long.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">monospace</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">boolean</span></h5><div class="tsd-comment tsd-typography"><p>If set to true, the message content will be displayed using a monospace font.
Mutually exclusive with <code>html</code>.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">priority</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">0</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">1</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">2</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">-2</span> <span class="tsd-signature-symbol">|</span> <span class="tsd-signature-type">-1</span></h5><div class="tsd-comment tsd-typography"><p>Sets the notification priority for the message.
Defaults to 0 (normal priority).</p>
<ul>
<li>-2: Message only, no notification sound/vibration. May increment the notification bubble.</li>
<li>-1: Silent notification (no sound/vibration).</li>
<li>0: Default notification behavior.</li>
<li>1: High priority, ignores user's quiet hours.</li>
<li>2: Emergency priority, requires acknowledgement. Requires <code>emergencyOpts</code>.</li>
</ul>
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">sound</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>The name of one of the predefined Pushover sounds or a custom sound uploaded by the user to be played for the notification.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">timestamp</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>An optional Unix timestamp representing the message's date and time to display to the user, rather than the time Pushover received it.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">title</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span></h5><div class="tsd-comment tsd-typography"><p>An optional title for the message.</p>
</div><div class="tsd-comment tsd-typography"></div></li><li class="tsd-parameter"><h5><code class="tsd-tag">Optional</code><span class="tsd-kind-property">ttl</span><span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">number</span></h5><div class="tsd-comment tsd-typography"><p>Time To Live in seconds. Specifies how long the message will be kept until disappearing.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></li><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/SendOptions.html" class="tsd-signature-type tsd-kind-interface">SendOptions</a></span><div class="tsd-comment tsd-typography"><p>A <code>SendOptions</code> object specifying the recipients and optional settings.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/PushoverMessageResponse.html" class="tsd-signature-type tsd-kind-interface">PushoverMessageResponse</a><span class="tsd-signature-symbol">[]</span><span class="tsd-signature-symbol">&gt;</span></h4><p>A Promise resolving to an array of <code>PushoverMessageResponse</code> objects, one for each recipient.
Rejects if message validation fails or if there's a fundamental issue sending to all recipients.
Individual recipient failures are indicated within their respective response objects (<code>status: 0</code>).</p>
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-4" class="tsd-anchor"></a>Example<a href="#example-4" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-5">// Send a message to a specific user and device</span><br/><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">userRecipient</span><span class="hl-1">: </span><span class="hl-10">PushoverRecipient</span><span class="hl-1"> = { </span><span class="hl-4">id:</span><span class="hl-1"> </span><span class="hl-2">&quot;user-key&quot;</span><span class="hl-1">, </span><span class="hl-4">devices:</span><span class="hl-1"> [</span><span class="hl-2">&quot;phone&quot;</span><span class="hl-1">] };</span><br/><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">pushover</span><span class="hl-1">.</span><span class="hl-0">send</span><span class="hl-1">(</span><br/><span class="hl-1"> { </span><span class="hl-4">message:</span><span class="hl-1"> </span><span class="hl-2">&quot;Targeted message&quot;</span><span class="hl-1"> },</span><br/><span class="hl-1"> { </span><span class="hl-4">recipients:</span><span class="hl-1"> [</span><span class="hl-4">userRecipient</span><span class="hl-1">] },</span><br/><span class="hl-1">);</span><br/><br/><span class="hl-5">// Send an emergency priority message and handle the receipt</span><br/><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">responses</span><span class="hl-1"> = </span><span class="hl-4">pushover</span><span class="hl-1">.</span><span class="hl-0">send</span><span class="hl-1">(</span><br/><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">message:</span><span class="hl-1"> </span><span class="hl-2">&quot;Emergency alert!&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">priority:</span><span class="hl-1"> </span><span class="hl-8">2</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">emergencyOpts:</span><span class="hl-1"> { </span><span class="hl-4">retry:</span><span class="hl-1"> </span><span class="hl-8">30</span><span class="hl-1">, </span><span class="hl-4">expire:</span><span class="hl-1"> </span><span class="hl-8">3600</span><span class="hl-1"> },</span><br/><span class="hl-1"> },</span><br/><span class="hl-1"> { </span><span class="hl-4">recipients:</span><span class="hl-1"> [</span><span class="hl-4">userRecipient</span><span class="hl-1">] },</span><br/><span class="hl-1">);</span><br/><br/><span class="hl-4">responses</span><br/><span class="hl-1"> .</span><span class="hl-0">then</span><span class="hl-1">((</span><span class="hl-4">responses</span><span class="hl-1">) </span><span class="hl-6">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">`Emergency message sent. Receipts: </span><span class="hl-6">${</span><span class="hl-4">responses</span><span class="hl-9">.</span><span class="hl-0">map</span><span class="hl-9">((</span><span class="hl-4">response</span><span class="hl-9">) </span><span class="hl-6">=&gt;</span><span class="hl-9"> </span><span class="hl-4">response</span><span class="hl-9">.</span><span class="hl-4">receipt</span><span class="hl-9">).</span><span class="hl-0">join</span><span class="hl-9">(</span><span class="hl-2">&quot;, &quot;</span><span class="hl-9">)</span><span class="hl-6">}</span><span class="hl-2">`</span><span class="hl-1">,</span><br/><span class="hl-1"> );</span><br/><span class="hl-1"> </span><span class="hl-5">// Store the receipt to check status or cancel later</span><br/><span class="hl-1"> })</span><br/><span class="hl-1"> .</span><span class="hl-0">catch</span><span class="hl-1">((</span><span class="hl-4">error</span><span class="hl-1">) </span><span class="hl-6">=&gt;</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">(</span><span class="hl-2">&quot;Failed to send emergency message:&quot;</span><span class="hl-1">, </span><span class="hl-4">error</span><span class="hl-1">);</span><br/><span class="hl-1"> });</span>
</code><button type="button">Copy</button></pre>
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cis-oss/pushover/blob/5d223831ce363827b196d9e1016b2ae33c7d3140/src/Pushover.ts#L369">src/Pushover.ts:369</a></li></ul></aside></div></li></ul></section><section class="tsd-panel tsd-member"><a id="validate" class="tsd-anchor"></a><h3 class="tsd-anchor-link"><span>validate</span><a href="#validate" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h3><ul class="tsd-signatures"><li class=""><div class="tsd-signature tsd-anchor-link"><a id="validate-1" class="tsd-anchor"></a><span class="tsd-kind-call-signature">validate</span><span class="tsd-signature-symbol">(</span><span class="tsd-kind-parameter">options</span><span class="tsd-signature-symbol">:</span> <a href="../interfaces/ValidateOptions.html" class="tsd-signature-type tsd-kind-interface">ValidateOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">:</span> <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/PushoverValidationResponse.html" class="tsd-signature-type tsd-kind-interface">PushoverValidationResponse</a><span class="tsd-signature-symbol">&gt;</span><a href="#validate-1" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></div><div class="tsd-description"><div class="tsd-comment tsd-typography"><p>Validates a Pushover user key and optionally a specific device name associated with that user.
Useful for verifying recipient details before sending messages.</p>
</div><div class="tsd-parameters"><h4 class="tsd-parameters-title">Parameters</h4><ul class="tsd-parameter-list"><li><span><span class="tsd-kind-parameter">options</span>: <a href="../interfaces/ValidateOptions.html" class="tsd-signature-type tsd-kind-interface">ValidateOptions</a></span><div class="tsd-comment tsd-typography"><p>A <code>ValidateOptions</code> object containing the <code>user</code> key and optional <code>deviceName</code>.</p>
</div><div class="tsd-comment tsd-typography"></div></li></ul></div><h4 class="tsd-returns-title">Returns <a href="https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise" class="tsd-signature-type external" target="_blank">Promise</a><span class="tsd-signature-symbol">&lt;</span><a href="../interfaces/PushoverValidationResponse.html" class="tsd-signature-type tsd-kind-interface">PushoverValidationResponse</a><span class="tsd-signature-symbol">&gt;</span></h4><p>A Promise resolving to a <code>PushoverValidationResponse</code> object.
Check the <code>status</code> field (1 for valid, 0 for invalid) and <code>errors</code> for details on failure.
On success, <code>devices</code> and <code>licenses</code> may be populated.</p>
<div class="tsd-comment tsd-typography"><div class="tsd-tag-example"><h4 class="tsd-anchor-link"><a id="example-5" class="tsd-anchor"></a>Example<a href="#example-5" aria-label="Permalink" class="tsd-anchor-icon"><svg viewBox="0 0 24 24" aria-hidden="true"><use href="../assets/icons.svg#icon-anchor"></use></svg></a></h4><pre><code class="typescript"><span class="hl-5">// Validate a user key</span><br/><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">validation</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">pushover</span><span class="hl-1">.</span><span class="hl-0">validate</span><span class="hl-1">({ </span><span class="hl-4">user:</span><span class="hl-1"> </span><span class="hl-2">&quot;user-key&quot;</span><span class="hl-1"> });</span><br/><span class="hl-3">if</span><span class="hl-1"> (</span><span class="hl-4">validation</span><span class="hl-1">.</span><span class="hl-4">status</span><span class="hl-1"> === </span><span class="hl-8">1</span><span class="hl-1">) {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><br/><span class="hl-1"> </span><span class="hl-2">&quot;User is valid. Devices:&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">validation</span><span class="hl-1">.</span><span class="hl-4">devices</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-2">&quot;, Licenses:&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">validation</span><span class="hl-1">.</span><span class="hl-4">licenses</span><span class="hl-1">,</span><br/><span class="hl-1"> );</span><br/><span class="hl-1">} </span><span class="hl-3">else</span><span class="hl-1"> {</span><br/><span class="hl-1"> </span><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">error</span><span class="hl-1">(</span><span class="hl-2">&quot;Validation failed:&quot;</span><span class="hl-1">, </span><span class="hl-4">validation</span><span class="hl-1">.</span><span class="hl-4">errors</span><span class="hl-1">);</span><br/><span class="hl-1">}</span><br/><br/><span class="hl-5">// Validate a user and device</span><br/><span class="hl-6">const</span><span class="hl-1"> </span><span class="hl-7">deviceValidation</span><span class="hl-1"> = </span><span class="hl-3">await</span><span class="hl-1"> </span><span class="hl-4">pushover</span><span class="hl-1">.</span><span class="hl-0">validate</span><span class="hl-1">({</span><br/><span class="hl-1"> </span><span class="hl-4">user:</span><span class="hl-1"> </span><span class="hl-2">&quot;user-key&quot;</span><span class="hl-1">,</span><br/><span class="hl-1"> </span><span class="hl-4">deviceName:</span><span class="hl-1"> </span><span class="hl-2">&quot;phone&quot;</span><span class="hl-1">,</span><br/><span class="hl-1">});</span><br/><span class="hl-4">console</span><span class="hl-1">.</span><span class="hl-0">log</span><span class="hl-1">(</span><span class="hl-2">&quot;Device validation status:&quot;</span><span class="hl-1">, </span><span class="hl-4">deviceValidation</span><span class="hl-1">.</span><span class="hl-4">status</span><span class="hl-1">);</span>
</code><button type="button">Copy</button></pre>
</div></div><aside class="tsd-sources"><ul><li>Defined in <a href="https://github.com/cis-oss/pushover/blob/5d223831ce363827b196d9e1016b2ae33c7d3140/src/Pushover.ts#L605">src/Pushover.ts:605</a></li></ul></aside></div></li></ul></section></section></details></div><div class="col-sidebar"><div class="page-menu"><div class="tsd-ext-version-select"><label class="settings-label" for="plugin-versions-select">Version</label><select id="plugin-versions-select" name="versions"></select></div><div class="tsd-navigation settings"><details class="tsd-accordion"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Settings</h3></summary><div class="tsd-accordion-details"><div class="tsd-filter-visibility"><span class="settings-label">Member Visibility</span><ul id="tsd-filter-options"><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-protected" name="protected"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Protected</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-inherited" name="inherited" checked/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>Inherited</span></label></li><li class="tsd-filter-item"><label class="tsd-filter-input"><input type="checkbox" id="tsd-filter-external" name="external"/><svg width="32" height="32" viewBox="0 0 32 32" aria-hidden="true"><rect class="tsd-checkbox-background" width="30" height="30" x="1" y="1" rx="6" fill="none"></rect><path class="tsd-checkbox-checkmark" d="M8.35422 16.8214L13.2143 21.75L24.6458 10.25" stroke="none" stroke-width="3.5" stroke-linejoin="round" fill="none"></path></svg><span>External</span></label></li></ul></div><div class="tsd-theme-toggle"><label class="settings-label" for="tsd-theme">Theme</label><select id="tsd-theme"><option value="os">OS</option><option value="light">Light</option><option value="dark">Dark</option></select></div></div></details></div><details open class="tsd-accordion tsd-page-navigation"><summary class="tsd-accordion-summary"><h3><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>On This Page</h3></summary><div class="tsd-accordion-details"><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Constructors"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Constructors</summary><div><a href="#constructor" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Constructor"><use href="../assets/icons.svg#icon-512"></use></svg><span>constructor</span></a></div></details><details open class="tsd-accordion tsd-page-navigation-section"><summary class="tsd-accordion-summary" data-key="section-Methods"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" aria-hidden="true"><use href="../assets/icons.svg#icon-chevronDown"></use></svg>Methods</summary><div><a href="#cancelretries" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>cancel<wbr/>Retries</span></a><a href="#cancelretriesbytag" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>cancel<wbr/>Retries<wbr/>By<wbr/>Tag</span></a><a href="#checkreceipt" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>check<wbr/>Receipt</span></a><a href="#send" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>send</span></a><a href="#validate" class=""><svg class="tsd-kind-icon" viewBox="0 0 24 24" aria-label="Method"><use href="../assets/icons.svg#icon-2048"></use></svg><span>validate</span></a></div></details></div></details></div><div class="site-menu"><nav class="tsd-navigation"><a href="../modules.html">@cis-oss/pushover</a><ul class="tsd-small-nested-navigation" id="tsd-nav-container"><li>Loading...</li></ul></nav></div></div></div><footer><p><p class="tsd-generator" style="display: inline-flex; flex-direction: row; justify-content: space-around; width: 100%;"> <span> Made with ❤ by <a href="https://b00tload.space">Alix von Schirp</a> @ <a href="https://github.com/cis-oss">CISLabs OSS</a> </span> <span> <a href="https://github.com/cis-oss/pushover" target="_blank">GitHub</a> | <a href="https://github.com/cis-oss/pushover/issues" target="_blank">Issues</a> | <a href="https://github.com/cis-oss/pushover/blob/main/LICENSE" target="_blank">License</a> </span> <span>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc </a> with <a href="https://github.com/JulianWowra/typedoc-github-theme" target="_blank">typedoc-github-theme</a></span></p></p></footer><div class="overlay"></div><script src="../assets/versionsMenu.js" type="module"></script></body></html>