Skip to content

Latest commit

 

History

History
183 lines (94 loc) · 8.33 KB

rss-feed-bot.md

File metadata and controls

183 lines (94 loc) · 8.33 KB

Tutorial: Creating an RSS Feed Bot

Let's create a bot that posts RSS Feed to Nostr using n8n-nodes-nostrobots.

Background

What is n8n?

It's a no-code tool. It is a workflow automation tool similar to famous no-code tools such as Zapier and IFTTT.

I quote the official explanation.

n8n - Workflow automation tool n8n is an extensible workflow automation tool. With a fair code distribution model, n8n always has source code visible, is self-hosted, and allows you to add your own custom functions, logic, and apps. n8n's node-based approach is highly versatile and allows you to connect anything to anything. (machine translation)

https://github.com/n8n-io/n8n

Workflow components that can be used in combination in n8n are called "node".

What is a community node?

It is a node that anyone can freely create and share with everyone. It can be created with Node.js.

Click here to see how to create it.

It's not that difficult since there are templates and tutorials. This time I will not introduce how to create it.

This n8n-nodes-nostrobots was also created as a community node.

Preparation

Preparation for n8n

The code for n8n is publicly available and self-hosting is also possible. The easiest way to use it is to pay or self-host.

Pay

It looks like you can use the platform for 20 euros a month.

https://n8n.io/pricing/

Self-hosted

If you are an programmer who can use Docker or Node.js, you can easily self-host it.

https://docs.n8n.io/hosting/

Also, if you are using Umbrel, the app is available in the store and can be installed with one click.

https://apps.umbrel.com/app/n8n

umbrelAppStore

How to install community nodes

There are risks when using community nodes, so be sure to read the official documentation and install at your own risk.

https://docs.n8n.io/integrations/community-nodes/

I will explain how to install n8n-nodes-nostrobots.

Move Community nodes to the page from Settings in the side menu and install it.

installDialog

Enter n8n-nodes-nostrobots in npm Package Name and run the installation.

After waiting for a while, it will be added to the Community nodes list, so the installation is complete.

installed

Installing other nodes

Install the community node n8n-nodes-rss-feed-trigger as described above.

https://github.com/joffcom/n8n-nodes-rss-feed-trigger

I have briefly checked the code, but please use the specifications at your own risk.

Workflow creation

You can add a workflow from Add Workflow on the Workflows screen.

emptyWorkflow

Creating a trigger node

First, set the trigger node. (Trigger nodes are not implemented in n8n-nodes-nostrobots yet) Click "+" to open additional menu.

We want to use n8n-nodes-rss-feed-trigger as the trigger node, so enter "rss" in the search form and RSS Feed Trigger will appear as an option, so select it.

For now, leave the Poll time at its default value.

FeedURL can be used as a test by Lorem RSS.

Please set the following URL to the Feed URL.

  • https://lorem-rss.herokuapp.com/feed?unit=second&interval=30 (Settings that allow you to obtain test feed at 30 second intervals)

rssTriggerSetting

Once the settings are complete, run the test using the Fetch test Event button.

You can get RSS Feed data for testing as shown in the image.

Create credentials

Select Credentials from the side menu. The 'Add Credential' button opens the creation modal. When you enter "nostr" in the form, "Nostrobots API" will be suggested, so please select it. By the way, if it is not displayed, the installation of the community node may not be completed.

credentialSettingDialog

The credential creation screen will open, so enter the SecretKey. Either HEX or bech32 (format starting with nsec) is fine.

We recommend that you create and use a disposable test account while you are creating your workflow.

Executing a post to Nostr

Click the "+" on the right side of the RssFeedTrigger node to add subsequent nodes.

If you search for nostr, two nodes will be displayed: Nostr Read and Nostr Write, so select Nostr Write.

AddNostrNode

When the options are displayed, select Basic Noteactions (any one is ok) and the node will be added.

The node settings screen will open, so set the values as shown below. For 'Credential to connect with', set the credentials you created earlier.

The setting values are as follows.

  • Resource: BasicNote
  • Operation: Send
  • Content: Hello nostr
  • Custom Relay: wss://nostr.mom

I set only one Custom Relay for testing. If you want to return to the default, execute Reset Value from the item's menu.

Once the settings are complete, click the Execute node button to run the node.

When execution is complete, the execution result will be displayed in OUTPUT.

NodeSetting

It is successful if an event containing content:Hello nostr is created and the sendResult is 0:[accepted]: wss://nostr.mom.

You can also check it from other clients. (The relay set as Custom Relay must be set on the client)

testnote1

Connection with RSS

The result of RSS Feed Trigger will be displayed in Schema format in INPUT. Drag the item A content and drop it on the 'Content' form of Nostr Write.

This is all you need to do to pass the data of the results of the executed nodes embedded in the content.

Let's run a test in this state and check.

testnote2

The contents of the RSS Feed have been posted.

Activation

Just enable it and run it.

Click the red Save button in the top right corner to save, then enable the toggle button to the left labeled Inactive. A confirmation modal will appear, so confirm and select Got it.

that's all.

Let's see if the client is able to post.

client

If you can post every minute, and you can post two at a time, you are successful.

Thank you for your hard work. This completes the creation of the RSS Feed bot.