Basics
About n8n
n8n is a platform for automating tasks by connecting different applications and services. Please refer to the n8n user documentation for learning more about it. Here, the focus is on connecting Optimizely Campaign and n8n and you should have a basic understanding of n8n before reading on.
The name n8n is short for nodemation and is pronounced n-eight-n.
The package n8n-nodes-optimizely-campaign
The capabilities of n8n can be extended by adding node types. The Optimizely Campaign node types for n8n are available through npm in the package @optimizely-campaign/n8n-nodes-optimizely-campaign. If you are hosting your own n8n instance, you have to install these yourself, see Requirements and setup below.
Requirements and setup
User accounts
Following conditions are required for using the Optimizely Campaign n8n integration:
- If you are in the DACH region, you need an Optimizely Campaign API user who has the role bm - Webservice User Integration-Platform. Optimizely support will help you create an API user with the required role.
- If you are outside the DACH region, you need an Optimizely Campaign API user who has the role epi - Webservice User Integration-Platform. You can create such a user yourself, in case of problems please contact support.
- You have the login credentials for this API user.
- You can log in to Optimizely Campaign with another user account (not strictly required but highly recommended for testing your workflows).
- You have a user account on an n8n instance.
n8n uses the login credentials of the API user to communicate with Optimizely Campaign, see Configuring Campaign API credentials below.
With many mailbox providers, you can use email subaddressing to create a new user easily, e. g. if your address is first.last@example.com, you can create the user first.last+n8n@example.com as a new user in Optimizely Campaign. While the Campaign users are different, email messages for both addresses will arrive in your inbox for first.last@example.com.
Installing the Campaign node types
Context: In self-hosted instances of n8n, you must add the package n8n-nodes-optimizely-campaign manually.
Prerequisites: You are logged in in n8n, with administrator permissions.
- In the bottom right, click on
(settings).
→ A pop-up menu displays. - Click Community node.
→ You see the page Community nodes. - Click Install.
→ The menu Install community nodes displays. - In the field npm Package Name, enter "@optimizely-campaign/n8n-nodes-optimizely-campaign".
- Add a checkmark to confirm that you understand the risks of adding packages.
- Click Install.
→ The Optimizely Campaign nodes are installed in your n8n instance.
If you prefer, you can also install the npm package through the terminal on your server with the command:
npm install @optimizely-campaign/n8n-nodes-optimizely-campaign
Configuring Campaign API credentials
Context: n8n uses a Campaign API user account to communicate with Campaign. For this, you must enter an API user's credentials in n8n.
Prerequisites: You know the credentials of a Campaign API user with the required role (see User accounts). You are logged in in n8n.
- In the top left of the n8n page, click + (plus).
- From the pop-up menu, select Credential.
→ The menu Add new credential displays. - In the field Select an app or service to connect to, type "Optimizely Campaign".
- From the drop-down list, select Optimizely Campaign API.
- Click Continue.
- Enter the user name (email address), password and the client ID of your Campaign client.
Note: The client ID is visible in Campaign under Administration > API overview.
→ If your credentials are correct, the message Connection tested successfully displays. - Click Save.
The nodes for Optimizely Campaign
Overview
In an n8n workflow, nodes control what happens and when it happens. When adding a node in n8n, search for "Optimizely Campaign" to see the nodes from Campaign. Each node belongs to one of two categories:
- Triggers that control workflows,
- Actions that are executed in workflows.
Following triggers from Optimizely Campaign are available:
- On archive
- On blocklist
- On bounce
- On click
- On confirmedoptin
- On doubleoptin
- On filtered by blocklist
- On open
- On sent
- On singleoptin
- On spamcomplaint
- On unsubscribe
Following actions in Optimizely Campaign are available:
- Create a recipient
- Update a recipient
- Get a recipient
- Send a transactional message
In addition to the Campaign-specific nodes, there is another very powerful option:
- n8n's generic HTTP Request node can send requests to the Campaign REST API.
To automate a process involving Optimizely Campaign and another application, create an n8n workflow that combines a trigger or action from Optimizely Campaign with a trigger or action from the other application.
Data transmission through triggers
Technically, the Campaign triggers in n8n are HTTP requests (webhooks). When a relevant event happens, Campaign sends a POST request to n8n. The values from the request body can then be used in the next node of the workflow.
When you add an action node after a trigger, the data fields are visible in the input menu on the left-hand side of the action node's node details view. You can drag these data fields to input fields of the action node. Then, in each run, the values provided by the trigger will be used in the action.
Viewing the data fields provided by a trigger
Context: Each trigger provides a specific set of data fields that can be used in subsequent nodes.
Prerequisites: You are logged in in n8n.
- Open or create a workflow.
- Open or add a Campaign trigger.
- On the right-hand side of the node details view, click Test this trigger.
- Open the tab JSON.
→ The data fields are visible in the JSON code.
Note: The following screenshot shows the default mock-up data provided for click events, highlighted with a green frame. You can see which data fields are available from this type of trigger.
Please sign in to leave a comment.