/kontent-custom-element-sendpulse

SendPulse mailing list selector custom element for Kentico Kontent

Primary LanguageJavaScriptMIT LicenseMIT

⚠️ Deprecation notice

This repository has been archived and is no longer maintained.

Core integration Gallery

Last modified Issues Contributors Forks MIT License

Stack Overflow GitHub Discussions

kontent logo sendpulse logo

FeaturesDemoDeploySetupSaved valueContributorsLicenseResources

This repository contains the source code of SendPulse mailing list selector custom element for Kontent by Kentico.

Features

The custom element allows linking a ceratin mailing list from Sendpulse with your content in Kontent by Kentico. This allows for linking together pages/forms with specific mailing lists in order to add collected contacts to those maling lists.

When an mailing list is selected, its ID can be used in a POST request to SendPulse to add one or multiple email adresses to the mailing list. The POST request is not part of the custom element.

Demo

Demo Animation

Quick Deploy

Netlify has made this easy. If you click the deploy button below, it will guide you through the process of deploying it to Netlify and leave you with a copy of the repository in your account as well.

Deploy to Netlify

Setup

  1. Get your API credentials from Sendpulse account

    You'll need to login into your Sendpulse account. Then navigate into Account settings -> API where you'll see your ID and Secret, which are the two settings needed for the integration to work.

Sendpulse Api Key

  1. Netlify/server setup

    Since you don't want to store the API secret inside of the custom element config, we are using Netlify function to act as a proxy between your custom element and the Sendpulse API. In order to make the function work, you'll need to provide it with the Secret you obtained in the previous step. For that, we'll use Netlify's Build enrionment variable. The only issue with these variables are that they are being loaded on build, so whenever you change the variables, you'll need to manually trigger a rebuild.

    The expected variable name for the function is SENDPULSE_API_SECRET.

    How this all can be done is described in our Kontent-Netlify example repository, or can be observed on the animation below.

Netlify variable setup

  1. Configure the Custom Element

    After your function is setup, you'll need to create and configure your Sendpulse custom element. The process of adding a custom element into your project is descripbed in Kontent's official documentation.

    The custom element has to be also configured. The neccessary configuration values are as follows:

{
    "apiId": "<YOUR SENDPULSE API ID>"
}

The functionUrl should be equal to your custom element's Hosted URL with /.netlify/functions/sendpulse-client added to it (if you are using the provided quick deploy). If you decide to deploy the element differently, you'll have to update the element's code.

What is Saved

Mailing lists are retrieved in an array of mailing list objects. After selecting a mailing list from SendPulse the object is saved in Kontent. For more information see: https://sendpulse.com/br/integrations/api/bulk-email.

[
  {
    "id": "1",
    "name": "My first list",
    "all_email_qty": "1",
    "active_email_qty": "0",
    "inactive_email_qty": "1",
    "creationdate": "2015-04-20 08:52:40",
    "status": "0",
    "status_explain": "Active"
  },
  {
    "id": "2",
    "name": "My second list",
    "all_email_qty": "6",
    "active_email_qty": "0",
    "inactive_email_qty": "6",
    "creationdate": "2015-04-20 09:02:39",
    "status": "0",
    "status_explain": "Active"
  }
]

Contributors

This custom element was originally created by TrueLime.

We have collected notes on how to contribute to this project in CONTRIBUTING.md.

License

MIT

Additional Resources