Overview
Datasource sending is an integration feature that allows you to integrate our platform with your system, so you can have total freedom in terms of what data you personalise your messages with.
Enable the Datasource Integration Feature
To create a Datasource Integration, you first need to enable it. To do this:
- Hover over your username in the navigation and click Customer Profile*.
- In the Features tab, enable Datasource Sending.
You can now proceed to creating a Datasource Integration.
*If you can’t access this part of the platform, speak to your administrator.
Create a Datasource Integration
To create a datasource integration:
- Hover over your username in the navigation and click on Integrations.
- In the Contacts tab and select Datasource.
- Fill in the information for your integration:
- Title: The title used to identify your integration.
- URL: The URL of the external source where the data is retrieved (e.g.: your API endpoint).
- Username: The username used to authenticate requests to your external source.
- Identifier: This identifies the contact. It can be an email address, mobile number, or unique ID.
- Click Save. Your data source should now be added.
If you were to use a contact’s unique ID as an identifier (e.g.: ev-1), the structure of the data returned from your datasource would look something like this:
{ "fields":[ ... ], "contacts":{ "ev-1":{ "recipient_id":"ev-1", "publication_id":342625, "email_sent_id":null, "advert_1_article_id":"884", "advert_1_image_source_url_id":"243", "..." } } }
How to Use Datasource Integration
To use Datasource Integration in your messages:
- Select the element in your message that you want to personalise.
- Click on the personalisation icon (person icon).
- On the personalisation modal, select your datasource integration. This should show you a list of fields available from the integration.
- Select the field you want to use for the personalisation.
- Click Insert. This will personalise the field according to the data from your data source.
Create Your Own Datasource Endpoint Restful Route
To create your own data source endpoint, you’ll have to create a restful endpoint governed by Basic Auth. The endpoint will receive a POST request with a JSON body containing an array of 100 contact identifiers. A contact identifier is set up on our platform and can be one the contact’s email address, mobile number, or the unique id.
Here’s an example of a data source request making use of the contact’s unique ID in our platform:
curl --location --request POST 'local.everlytic.com/datasource.php' \ --header 'Content-Type: application/json' \ --header 'Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=' \ --data-raw '["id_1","id_2", "id_3"]'
Your data source endpoint needs to return a structured JSON object. The JSON structure must include the following two properties:
- Fields: This is an array of field names that are contained in the data source. Each field name needs to follow SQL databases column naming conventions.
- Contacts: This is a list of contacts matching the request keyed by the identifier.
Expected response:
{ "fields":["contact_id","contact_name","contact_lastname"], "contacts": { "datasource_identifier": {"contact_id" :"1", "contact_name": "lyall", "contact_lastname": "salkinder"}, "datasource_identifier": {"contact_id" :"1", "contact_name": "mike", "contact_lastname": "young"} } }