wwwision / neos-mailchimp
将MailChimp集成到您的Neos网站/Flow应用的流包
Requires
- neos/neos: ^5.0 || ^7.0 || ^8.0
This package is auto-updated.
Last update: 2024-08-28 22:57:34 UTC
README
将MailChimp®集成到您的Neos网站或Flow应用的包。
功能
本包包含两个主要功能
- 为Flow Form Framework提供的MailChimp®订阅完成器
- 一个简单的Neos模块,允许Neos管理员管理MailChimp®列表和收件人
使用方法
安装此包并确保解决所有依赖关系。安装此包的最简单方法是使用composer
composer require wwwision/neos-mailchimp
安装成功后,请确保在您的网站包的Settings.yaml
中配置MailChimp®API密钥
Wwwision: Neos: MailChimp: apiKey: '<VALID_MAILCHIMP_API_KEY>'
注意:API密钥可以从mailchimp.com > Account > Extras > API keys
获取
完成。现在您可以登录Neos后端(作为管理员)并在新的模块administration/mailchimp
中管理您的时事通讯列表和收件人(如果模块未出现在菜单中,请确保清除浏览器缓存)。
Neos模块
该模块非常简单,易于理解。目前它允许
- 显示所有列表
- 显示单个列表的详细信息,包括创建日期、发件人信息和收件人数
- 显示所选列表的所有成员
- 从列表中删除成员
- 将新成员订阅到列表
表单完成器
本包还附带一个简单的表单完成器,允许使用Flow Form Framework创建简单的时事通讯订阅表单。
或者,您可以将以下片段保存到Data/Forms/newsletter.yaml
以创建简单的时事通讯订阅表单
type: 'Neos.Form:Form' identifier: mailchimp label: Mailchimp renderables: - type: 'Neos.Form:Page' identifier: page1 label: 'Page 1' renderables: - type: 'Neos.Form:SingleLineText' identifier: 'firstName' label: 'First name' validators: - identifier: 'Neos.Flow:NotEmpty' properties: placeholder: 'Your first name' defaultValue: '' - type: 'Neos.Form:SingleLineText' identifier: 'lastName' label: 'Last name' validators: - identifier: 'Neos.Flow:NotEmpty' properties: placeholder: 'Your last name' defaultValue: '' - type: 'Neos.Form:SingleLineText' identifier: 'email' label: 'E-Mail' validators: - identifier: 'Neos.Flow:NotEmpty' - identifier: 'Neos.Flow:EmailAddress' - identifier: 'Wwwision.Neos.MailChimp:UniqueSubscription' options: listId: '<MAILCHIMP-LIST-ID>' properties: placeholder: 'Your email address' defaultValue: '' finishers: - identifier: 'Wwwision.Neos.MailChimp:MailChimpSubscriptionFinisher' options: listId: '<MAILCHIMP-AUDIENCE-ID>' additionalFields: 'FNAME': '{firstName}' 'LNAME': '{lastName}' - identifier: 'Neos.Form:Confirmation' options: message: 'Thank you, your subscription was successful. Please check your email.' renderingOptions: submitButtonLabel: ''
注意:将两个"<MAILCHIMP-AUDIENCE-ID>"替换为有效的受众(列表)标识符,该标识符可以从mailchimp.com > Audience > <YOUR-AUDIENCE> > Settings > Audience name & defaults
获取。受众ID通常包含数字,例如"1243568790"。
使用interestGroups
选项,您可以为用户设置固定的或动态的兴趣组以进行订阅。
# ... finishers: - identifier: 'Wwwision.Neos.MailChimp:MailChimpSubscriptionFinisher' options: listId: '<MAILCHIMP-AUDIENCE-ID>' additionalFields: 'FNAME': '{firstName}' 'LNAME': '{lastName}' interestGroups: - 'abc123abc1' - 'def123def1' - '{interestGroups}' // Placeholder for single value fields (e.g. select box) ... - '{interestGroups.0}' // Placeholder for multi value fields (e.g. check boxes) - '{interestGroups.1}'
当然,表单完成器也可以在不使用Neos的情况下使用(即,在纯Flow应用中进行时事通讯订阅)。
数据源
兴趣类别
返回订阅列表中所有兴趣类别及其ID和标签的列表。
数据源标识符:mailchimp-interest-category
dataSourceAdditionalData
listId
- (字符串) 订阅列表的ID
兴趣
返回给定类别中所有兴趣及其ID和标签的列表。
数据源标识符:mailchimp-interest
dataSourceAdditionalData
listId
- (字符串) 订阅列表的IDcategoryId
- (字符串) 兴趣类别的ID
示例节点类型配置
... properties: subscriptionList: type: string defaultValue: '' ui: label: Subscription list id category: type: string defaultValue: '' ui: label: Category inspector: hidden: 'ClientEval:node.properties.subscriptionList != "" ? false : true' editor: Neos.Neos/Inspector/Editors/SelectBoxEditor editorOptions: allowEmpty: true dataSourceIdentifier: mailchimp-interest-category dataSourceAdditionalData: listId: ClientEval:node.properties.subscriptionList interestId: type: string defaultValue: '' ui: label: Interest inspector: group: categories hidden: 'ClientEval:node.properties.category != "" ? false : true' editor: Neos.Neos/Inspector/Editors/SelectBoxEditor editorOptions: allowEmpty: true dataSourceIdentifier: mailchimp-interest dataSourceAdditionalData: listId: ClientEval:node.properties.subscriptionList categoryId: ClientEval:node.properties.category
趣味知识
本包演示...
...如何使用Views.yaml重用Neos布局和部分
...如何创建和配置表单完成器,以便可以在表单定义中使用它
...如何使用Objects.yaml初始化自定义API客户端
...如何使用CallbackQueryResult
对象使任意结果集可计数和“可分页”
常见问题解答(FAQ)
- 我遇到一个错误
未找到MailChimp列表。您在Wwwision.Neos.MailChimp.apiKey中正确配置了API密钥吗?
,我哪里做错了?- 请确保您已按照上述说明在设置和表单完成器配置中配置了API密钥。如果情况是这样,请确保您的包依赖项正确。这意味着:配置API密钥的包必须在
composer.json
清单中要求wwwision/neos-mailchimp
包。否则,加载顺序不正确,API密钥可能被默认设置覆盖
- 请确保您已按照上述说明在设置和表单完成器配置中配置了API密钥。如果情况是这样,请确保您的包依赖项正确。这意味着:配置API密钥的包必须在
许可证
在GPLv3+下授权,请参阅LICENSE