https://github.com/statikbe/craft-flexmail
https://github.com/statikbe/craft-flexmail
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/statikbe/craft-flexmail
- Owner: statikbe
- License: mit
- Created: 2021-11-10T13:22:19.000Z (over 4 years ago)
- Default Branch: develop
- Last Pushed: 2025-07-08T11:31:42.000Z (12 months ago)
- Last Synced: 2025-07-08T12:41:10.438Z (12 months ago)
- Language: PHP
- Size: 54.7 KB
- Stars: 1
- Watchers: 7
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.MD
- Changelog: CHANGELOG.MD
- License: LICENSE.MD
Awesome Lists containing this project
README
# Flexmail for Craft CMS
This plugin integrates the [Flexmail REST API](https://api.flexmail.eu/documentation/#overview) into Craft CMS. The first version will focus on adding contacts, and assigning preferences & interests.
## Installation
To install the plugin, follow these instructions:
```console
cd /path/to/project
composer require statikbe/craft-flexmail
./craft plugin/install flexmail
```
## Settings
The plugin has the following settings:
- API username (`apiUsername`)
- API token (`apiToken`)
- Default contact source (`defaultSource`) (read more about Flexmail sources [here](https://en.support.flexmail.eu/article/291-about-sources))
The default contact source can be set in settings, or you can set in template using a hidden ``source`` field.
## Usage
By default, a contact in Flexmail has the following fields ([API docs](flexmail)):
- Email (required)
- First name
- Last name
- Language (required)
### Basic subscribe form
`````html
{{ actionInput('flexmail/contacts/add') }}
{{ csrfInput() }}
E-mail
First name
Last name
`````
### Subscribe form with custom fields
Flexmail custom fields can be added in the ``fields`` namespace.
For example ``fields[city]``, where "city" is the handle of the custom field in Flexmail.
`````html
{{ actionInput('flexmail/contacts/add') }}
{{ csrfInput() }}
E-mail
Your organisation
`````
### Subscribe form with interests
Flexmail is 2 ways to segment or add metadata to contacts: interests.
These can be added by using ``labels[]`` and ``preferencs[]`` respectivly.
It's important to note that the values for these need to be **the ID of that item in Flexmail**.
`````html
{{ actionInput('flexmail/contacts/add') }}
{{ csrfInput() }}
E-mail
// Interests
`````
Interests can be imported and refresh from the API through a Utility.
## Fields
The plugin includes fields for interests that are defined in your Flexmail account.
The idea here is that you can create an interest for contacts that subscribe from a specific page/product/etc.
This field will use the imported interests.
## Helpers
Flexmail uses ID's for most things (sources, labels, preferences) but those ID's are not exposed in the webpages.
You can use these console command to list each of these, they will return all items with their ID and label
flexmail/debug/get-interest
flexmail/debug/get-sources