无代码业务自动化工具Activepieces

什么是 Activepieces ?

Activepieces 是一款工作流程自动化软件,可以帮助您自动化所有重要流程,例如市场、销售、营销等。您可以集成其他有用的应用程序并更有效地管理您的业务。无需编码,是 Zapier 的绝佳替代品。

Activepieces 和之前老苏介绍的 n8n、Automatisch 是同一类软件。目前已经支持 100 多种应用,其中包括了 OpenAI

准备工作

因为触发器可能存在回调,所以需要让 Activepieces 有公网可访问的 IP 或者域名。

老苏这次采用了 Cloudflared + NPM 方案,不了解的可以去翻看一下

文章传送门:免费的Cloudflared实现外网访问群晖(续)

域名 局域网地址
https://ap.laosu.cf http://192.168.0.197:4848

其中

  • 192.168.0.197 为安装 Activepieces 服务的群晖主机 IP
  • 4848 为 Activepieces 服务对外暴露的端口

命令行安装

docker-compose.yml

将下面的内容保存为 docker-compose.yml 文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
version: '3.0'

services:
activepieces:
image: activepieces/activepieces
container_name: activepieces-web
restart: unless-stopped
## Enable the following line if you already use AP_EXECUTION_MODE with SANDBOXED or old activepieces, checking the breaking change documentation for more info.
## privileged: true
ports:
- 4848:80
depends_on:
- postgres
- redis
env_file: env.txt

postgres:
image: postgres:14
container_name: activepieces-postgres
restart: unless-stopped
environment:
- POSTGRES_DB=${AP_POSTGRES_DATABASE}
- POSTGRES_PASSWORD=${AP_POSTGRES_PASSWORD}
- POSTGRES_USER=${AP_POSTGRES_USERNAME}
volumes:
- ./pdata:/var/lib/postgresql/data

redis:
image: redis
container_name: activepieces-redis
restart: unless-stopped
volumes:
- ./rdata:/data
  • 老苏开始折腾时,activepieces/activepieces:latest 对应的版本为 0.7.1;本文写作时,对应的版本为 0.8.0;而本文发文时最新版本为 0.12.2;
  • 端口设为了 4848,你可以自行修改,只要在本机端口不冲突即可;

env.txt

将下面的内容保存为 env.txt 文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
## It's advisable to consult the documentation and use the tools/deploy.sh to generate the passwords, keys, instead of manually filling them.

AP_ENGINE_EXECUTABLE_PATH=dist/packages/engine/main.js

## 256 bit encryption key, 32 hex character
AP_ENCRYPTION_KEY=e106ddcb2e44970f9aea69f68f7fa775

## JWT Secret
AP_JWT_SECRET=0d9c355322247022bb0aa334e71f7372ec06e8a49f4518adf9b3a985e2adb2f5

AP_ENVIRONMENT=prod
AP_FRONTEND_URL=https://ap.laosu.cf
AP_TRIGGER_DEFAULT_POLL_INTERVAL=5
AP_POSTGRES_DATABASE=activepieces
AP_POSTGRES_HOST=postgres
AP_POSTGRES_PORT=5432
AP_POSTGRES_USERNAME=postgres
AP_POSTGRES_PASSWORD=123456
AP_EXECUTION_MODE=UNSANDBOXED
AP_REDIS_HOST=redis
AP_REDIS_PORT=6379
AP_SANDBOX_RUN_TIME_SECONDS=600
AP_TELEMETRY_ENABLED=false
  • AP_FRONTEND_URL:前端访问地址,也就是我们前面反代的地址,用于指定重定向地址和 webhook 地址;
  • AP_POSTGRES_:这个前缀表示是 postgres 数据库的相关设置;
  • AP_REDIS_:这个前缀表示是 redis 数据库的相关设置;
  • AP_TELEMETRY_ENABLED:不要设 true;
  • AP_ENCRYPTION_KEY: 可以用 openssl rand -hex 16 来生成;
  • AP_JWT_SECRET :可以用 openssl rand -hex 32 来生成;

关于更多变量的说明,请参考官方文档:https://www.activepieces.com/docs/install/configurations/environment-variables

然后执行下面的命令

1
2
3
4
5
6
7
8
9
10
# 新建文件夹 activepieces 和 子目录
mkdir -p /volume1/docker/activepieces/{pdata,rdata}

# 进入 activepieces 目录
cd /volume1/docker/activepieces

# 将 docker-compose.yml 放入当前目录

# 一键启动
docker-compose --env-file env.txt up -d

运行

在浏览器中输入 https://ap.laosu.cf 就能看到注册界面

登录成功后的主界面

带demo

点 + 号新建,会看到有一些现成的 template

如果没有合适的模板,也可以自己重新搭建

一个标准的流程(flow)包含了 2 个部分:触发器(trigger) 和动作(actions)

触发器分为两类:Core 和 App Events

其中:

  • Core 有一个定期自动执行的 Schedule 和一个在访问特定 URL 时自动执行的 Webhook;
  • App Events 则可以从其他应用程序启动;

RSS2Email

假设还是以 ”老苏博客更新了之后,发邮件通知“ 这个流程为例

第一步、点 Select Trigger ,右侧触发器选择 RSS Feed

  • Trigger :选择 New Item In Feed
  • RSS Feed URL:设置老苏的 RSS 订阅地址 https://laosu.tech/atom.xml

完成之后要点右下角的 Load data,加载完成后能看到 5 条数据

第二步、选择 mail 应用,可供选择的有 3 个

老苏选择了 Gmail,当然你也可以选择 SMTP ,来使用其他的邮箱,不过老苏没试

创建 New Connection 时,Gmail 需要授权

保存之后,还需要设置主题等,完成之后,同样需要 Test app,如果没问题的话会返回 Tested Successfully

加下来就可以重命名、并发布了

最后 body 部分只使用了 summary 和 link

收到了测试邮件

返回主页就能看到我们创建的 RSS2Email 了

SMTP

Gmail 在国内还是限制的,所以 SMTP 显得更灵活一些,老苏还是用 88 邮箱做示例

其他是一样的

现在的 My Flows 中多了一个

收到的测试邮件

下面加载出来的图片等预览功能,是 hotmail 网页版的功能;

参考文档

activepieces/activepieces: Your friendliest open source automation tool ✨ Workflow automation tool / Enterprise automation tool / Business automation tool / Zapier Alternative
地址:https://github.com/activepieces/activepieces

Activepieces - The open source business automation software - Zapier alternative
地址:https://www.activepieces.com/

I tried sending the full text RSS of GIGAZINE’s article by e-mail using the open source & self-hostable tool ‘Activepieces’ that can be automated by combining various applications like IFTTT and Zapier for free - GIGAZINE
地址:https://gigazine.net/gsc_news/en/20230528-activepieces-automation/