Skip to content

cakephp/automation

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

224 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

What is this?

We had an old slackbot implementation, which synced discord messages to slack and vice versa. See https://github.com/cakephp/discord-slack-bridge

But this broke when Slack changed their API and discontinued the RTM API. Therefore, it was time to replace it.

The current solution is to use n8n, a powerful workflow automation tool which can do so much more than just bridging Discord and Slack.

Where is it set up?

It runs inside our apps.cakephp.org Server which hosts a bunch of dokku based apps.

The URL is https://automation.cakephp.org - for Backend access please ask a core member or @lordsimal

How does it work?

Slack => Discord Chat Sync

This uses the n8n built-in Slack trigger to listen for new messages in a specific Slack channel.

Each channel needs to be mapped individually to a Discord channel, since we

  • don't want to sync every channel and
  • some channels may have different names in Slack and Discord

Debugging Slack Messages with manual triggers in n8n

N8N 2.0 now has a better way to debug workflow runs via looking at the "Executions" tab in the n8n UI.

This shows you directly which data gets sent for which trigger so you have a better overview of the data and can easily debug it.

Problems to be fixed

  • If a user edits or deletes a message in Slack, it is not synced to Discord.
  • Reactions are not synced yet.
  • Links sent from Slack to Discord appear as e.g.
https://book.cakephp.org/5/en/intro/conventions.html#database-conventions|https://book.cakephp.org/5/en/intro/conventions.html#database-conventions

Discord => Slack Chat Sync

This one was a bit more tricky, since Discord doesn't have a built-in trigger for new messages.

We needed to add a community node which adds a trigger for new messages in Discord channels.

This new bot also needed access to the Gateway Intents API, which was not present in the old bot we had till now.

Therefore, a new bot was created and was added to the CakePHP Discord server - very creatively named "CakePHP-Slack-Bot"

With that community node installed and the new bot added to the Discord server, we were now able to add a trigger for new messages in Discord channels.

Problems to be fixed

  • If a user edits or deletes a message in Discord, it is not synced to Slack.
  • Reactions are not synced yet.

Persisting community nodes in dokku

At first there was a problem with the community node not being persisted in the Dokku app. After a rebuild, the community node was not available anymore.

Fortunately, @d1ceward - who provided the initial Dokku setup - found a solution to this problem. d1ceward-on-dokku#4

dokku storage:ensure-directory automation --chown false
chown 1000:1000 /var/lib/dokku/data/storage/automation
dokku storage:mount automation /var/lib/dokku/data/storage/automation:/home/node/.n8n

With that, the community node is now persisted across rebuilds and restarts.

But I am not sure how to update community nodes yet...

Updating to newer N8N 2.0 version

There are 2 things that need to be done:

  1. Update the runner on the apps.cakephp.org Server via dokku git:from-image automation-runners n8nio/runners:2.18.0
  2. Update the Dockerfile N8N_VERSION Arg to use the same version and push the commit to trigger the deploy

About

Dockerfile to run n8n (automation) on Dokku (mini-Heroku)

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Shell 94.5%
  • Dockerfile 5.5%