How to create PubSub custom node consumer

Describe the problem/error/question

I am new with n8n, we using it in self-hosted mode. we need a custom node which will trigger a slack action in case when arrived are consumed.
so if we look on the high level we have service (consuming those event) and another n8n-service which will introduce a new node which listen to those events.

what will be the best approach to implement this kind of logic?

Information on your n8n setup

  • **n8n version:latest
  • **Database (default: SQLite):postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):npm
  • Operating system:

Hi @mtubul :wave: Someone like @Jon or @marcus would be best to answer your question on this one :slight_smile:

In the meantime, you can check out our documentation on node creation here, which has a few tutorials: Creating nodes | n8n Docs

@EmeraldHerald thank you, i wonder what will be the best approach to implement it.
i wonder if listen to the PubSub topic is possible, or exposing a webhook which will trigger the workflow

Hi @mtubul,
to receive events from slack we are using the Webhook node at the moment. You’ll need to configure your slack app to send events to your webhook endpoint.

We will be developing a Slack Trigger node in Q1 2024 to make it easier receiving events from Slack.

If you want to develop your own node, the best way to start would be following one of our tutorials about creating nodes. For webhook based trigger nodes that react to incoming webhook nodes you can take a look at these:

Webhook based trigger nodes implement checkExists/create/delete to register webhook callbacks with the 3rd party service. The HiveTrigger.node.ts is an example node that doesn’t actually register a webhook with a 3rd party service and just listens to webhook endpoint, in case you are not able to or don’t want to register webhook callbacks with 3rd party services.

@marcus thanks for your answer, i think you missunderstand me. i aim to develop a workflow which on a specific internal event (some of our services listen to PubSub and others publishing messages), than send a slack massage.

so i wonder what will be the best approach.
i want to create a trigger node which will handle On event occur, i wonder what will be the best way to do so.

can it be done by our services sending an api-requests to the node? can the node by design create a webhook and than listen to requests?
can i setup another queue which will consume all the trigger messages?

Thanks in advance

Any idea how to implement this kind of logic? actually i found SSE trigger might be the solution but i want something more robust. i thought maybe to create a queue using a rabitmq and send events to this queue which will trigger the workflow. is it possible?

Hi @mtubul,
so you don’t need to develop a custom node but would be comfortable be leveraging existing nodes like our RabbitMQ trigger node? The RabbitMQ trigger node can receive events from Queues and Topics like json objects for further processing inside your workflow, e. g. sending slack messages.