2025-02-16 08:21:31 -05:00
2023-11-02 14:06:30 -04:00
2023-11-07 07:54:02 -05:00
2025-02-16 08:21:31 -05:00
2025-02-16 08:21:08 -05:00
2023-11-02 14:06:30 -04:00
2025-01-31 19:12:55 -05:00
2025-01-31 19:12:55 -05:00
2025-02-02 13:58:29 -05:00

NostrSMS

NostrSMS is a bridge between XMPP and Nostr, allowing users to send and receive messages through Nostr via an XMPP bot. This bot connects to an XMPP server and listens for messages from authorized users, posting them to Nostr and fetching recent global posts.

Features

  • Connects to an XMPP server with configured credentials.
  • Posts messages received from XMPP/SMS to Nostr.
  • Fetches recent global posts from Nostr and returns them to users.
  • Allows only authorized users to interact with the bot.
  • Supports simple commands such as !help and !g.

Requirements

  • Node.js
  • A configured XMPP account
  • A Nostr private key for signing events
  • A valid config.ini file (see Configuration)

Installation

  1. Clone the repository or download the script.
  2. Install dependencies:
    npm install
    
  3. Ensure you have a valid config.ini file in the appropriate location for your operating system (see below).
  4. Run the bot:
    node index.js
    

Configuration

Create a config.ini file in the appropriate location:

  • Windows: %APPDATA%/nostrsms/config.ini
  • macOS: ~/Library/Application Support/nostrsms/config.ini
  • Linux: ~/.config/nostrsms/config.ini

Example config.ini:

[nostr]
pkhex=your_private_key

[xmpp]
host=your_xmpp_host
user=your_xmpp_username
domain=your_xmpp_domain
password=your_xmpp_password
; optional (will default to nostrsms-bot)
resource=nostrsms-bot

[relays]
read=wss://relay.example.com
write=wss://relay.example.com

[authorized_users]
users=user1@xmpp.server,user2@xmpp.server

Usage

  • !help: Returns a help link.
  • !g: Fetches the latest 10 global posts from Nostr.
  • Any other message: Posts the message to Nostr.

Error Handling

  • If config.ini is missing or invalid, an error message is displayed, and the program exits.
  • XMPP errors are logged to the console.
  • If the bot receives a message from an unauthorized user, it responds with "Not authorized".

Stopping the Bot

To stop the bot, press CTRL+C. The bot will cleanly disconnect from XMPP before exiting.

License

This project is licensed under the MIT License.

Support

For setup and troubleshooting, visit the wiki.

//README generated by ChatGPT.//

Description
Languages
JavaScript 98.9%
Dockerfile 1.1%