An open API service indexing awesome lists of open source software.

https://github.com/statikbe/craft-flexmail


https://github.com/statikbe/craft-flexmail

Last synced: 10 months ago
JSON representation

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