Avatar

singpolyma

Joined November 2, 2024
Public vals
4
singpolyma avatar
singpolyma
jmpblog2lemmy
Cron
An interactive, runnable TypeScript val by singpolyma
0
singpolyma avatar
singpolyma
sendxmpp
Script
Simple API wrapper for sending a message over XMPP to any Jabber ID on the federated network. import sendxmpp from "https://esm.town/v/singpolyma/sendxmpp"; await sendxmpp("someone@example.com", "Hello!");
0
singpolyma avatar
singpolyma
sendxmppapi
HTTP
Simple API for sending a message over XMPP to any Jabber ID on the federated network. For a wrapper to use in vals see https://www.val.town/v/singpolyma/sendxmpp await fetch("https://singpolyma-sendxmppapi.web.val.run", { method: "POST", body: JSON.stringify({ target: "someone@example.com", body: "Hello!" }) })
0
singpolyma avatar
singpolyma
sendxmpplib
Script
Simple helper for sending a message over XMPP. For an API that doesn't require your own bot setup see https://www.val.town/v/singpolyma/sendxmpp import sendxmpp from "https://esm.town/v/singpolyma/sendxmpplib"; await sendxmpp("someone@example.com", "Hello!"); Also supports optional keepalive to send multiple messages with one connection: import sendxmpp from "https://esm.town/v/singpolyma/sendxmpplib"; await sendxmpp("someone@example.com", "1", true); await sendxmpp("someone@example.com", "2", true); await sendxmpp("someone@example.com", "3); Or even manual disconnect: import sendxmpp from "https://esm.town/v/singpolyma/sendxmpplib"; await sendxmpp("someone@example.com", "1", true); await sendxmpp("someone@example.com", "2", true); const stop = sendxmpp("someone@example.com", "3", true); stop(); Environment variables needed for your bot: XMPP_URI=wss://example.com XMPP_DOMAIN=example.com XMPP_USERNAME=bot XMPP_PASSWORD=password Only websockets or direct tls (xmpps://) connections are supported until https://github.com/denoland/deno/issues/26685 is fixed
0
Next