remp / crm-remp-mailer-module
CRM 邮件模块
Requires
- php: ^8.1
- dev-master
- 3.4.0
- 3.3.0
- 3.2.0
- 3.1.0
- 3.0.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.0
- 2.5.0
- 2.4.0
- 2.3.0
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.0
- 1.2.0
- 1.1.0
- 1.0.0
- 1.0.0-beta2
- 1.0.0-beta1
- 0.39.0
- 0.38.0
- 0.37.0
- 0.36.0
- 0.35.0
- 0.34.0
- 0.33.0
- 0.32.0
- 0.31.0
- 0.30.0
- 0.29.1
- 0.29.0
- 0.28.0
- 0.27.0
- 0.26.0
- 0.25.0
- 0.24.0
- 0.23.0
- 0.22.0
- 0.21.0
- 0.20.1
- 0.20.0
- 0.18.0
- 0.15.0
This package is auto-updated.
Last update: 2024-09-20 12:58:51 UTC
README
REMP 邮件模块是一个集成模块,连接 CRM 和 REMP 邮件。
模块为 NotificationEvent
添加监听器以发送电子邮件,并附加小部件,允许用户/管理员配置新闻通讯订阅,并在管理中查看所有已发送电子邮件的日志。
安装模块
我们建议使用 Composer 进行安装和更新管理。
composer require remp/crm-remp-mailer-module
启用和配置模块
将已安装的扩展添加到您的 app/config/config.neon
文件中。
extensions: remp_mailer: Crm\RempMailerModule\DI\RempMailerModuleExtension
添加后,您需要提供 REMP 邮件实例的 URL 和 CRM 与邮件通信时应使用的 API 令牌。
修改您的配置文件,并用实际值替换示例值
remp_mailer: # Base URL where mailer is hosted. host: http://mailer.remp.press # API token to communicate with Mailer. By default the token can be acquired in REMP SSO. api_token: abcdef123456789
如果配置不完整,初始化将在您的配置记录器中记录错误,并在 CRM 中不会启用模块。
一切准备就绪后,请确保通过运行以下命令更新 CRM 内部配置(它们应始终是您的发布过程的一部分)
php bin/command.php api:generate_access
php bin/command.php application:seed
可配置服务
您可以选择不允许尚未确认的用户订阅新闻通讯(根据 users.confirmed_at
数据库列)。此功能默认禁用,您可以通过将以下片段添加到您的 config.neon
来启用它
services: mailerMailerConfig: setup: - setSubscribeOnlyConfirmedUser(true)
API 文档
所有示例都使用 http://crm.press
作为基础域名。请在执行示例之前将主机更改为您使用的域名。
所有示例都使用 XXX
作为授权令牌的默认值,请将其替换为实际的令牌
- API 令牌。 服务器之间通信的标准 API 密钥。它识别整个调用应用程序。它们可以在 CRM 管理员中生成(
/api/api-tokens-admin/
),并且每个 API 密钥都必须列入白名单才能访问特定的 API 端点。默认情况下,API 密钥没有访问任何端点的权限。 - 用户令牌。 在登录过程中为每个用户生成,令牌在系统不同部分之间通信时识别单个用户。令牌可以读取
- 从
n_token
cookie 中,如果用户通过 CRM 登录。 - 从
/api/v1/users/login
端点的响应中 - 您可以将响应存储到自己的 cookie/本地存储/会话中。
- 从
API 响应可以包含以下 HTTP 状态码
如果可能,响应包括带有进一步解释错误信息的 application/json
编码的有效负载。
POST /api/v1/mailer/subscribe
API 端点调用 REMP 邮件 API 端点并将用户订阅给定的邮件类型和变体。
头部
示例
curl --location --request POST 'http://crm.press/api/v1/mailer/subscribe' \ --header 'Authorization: Bearer XXX' \ --form 'mail_type_code="alerts"' \ --form 'variant_code="daily"'
响应
{ "status": "ok" }
POST /api/v1/mailer/unsubscribe
API 端点调用 REMP 邮件 API 端点并将用户从给定的邮件类型和变体中取消订阅。
头部
示例
curl --location --request POST 'http://crm.press/api/v1/mailer/unsubscribe' \ --header 'Authorization: Bearer XXX' \ --form 'mail_type_code="alerts"' \ --form 'variant_code="daily"'
响应
{ "status": "ok" }