Documentation

Getting Started
Capture
Competitions
Galleries
Rewards
Installation
Advanced
Integrations
Action Types
Guides

Webhook Integration

Gleam can trigger a request to your own endpoint when entries are created. We currently offer two Webhook types which you can setup.

These Webhooks are currently in BETA for Business customers and activated by request only. Please submit a support ticket.

Integration Webhooks

These will currently only trigger for Subscribe actions and will work just like any normal integration.

Webhooks have the advantage of including custom fields and other data that we don't currently sync with mail providers. Which makes them excellent for building your own integrations or sending data to an unsupported email provider.

Integration Webhooks are not instant (except for Captures), they pass through our Fraud filter first before being sent to your endpoint. The process usually takes 5-10 minutes.

Integration Webhook Request

Our webhooks will create a POST request containing a JSON body to your endpoint. Example JSON:

{
 campaign: {
     name: "My Campaign",
     key: "a1XyD,
     type: "Competition",
 },
 user: {
     name: "Joe Bloggs",
     email: "joe@example.com",
     country: "Australia",
     region: "Queensland",
     city: "Bloggstown",
     country_code: "AU",
     details: {
       "I have read the terms and conditions" => "true",
       "How are you?" => "Great, thanks!",
       "Postcode" => 8282
     }
 },
 entry: {
   entry_method_id: 334222,
   created_at: "2015-11-18 05:14:37 UTC",
   type: "email_subscribe"
 }
}

Post Entry Webhooks

These Webhooks are setup on the Post Entry tab of Competitions and Rewards. They will send through a Webhook POST every time an action is completed.

This request will also show things like the total number of entries for that user (for Competitions) and their progress towards unlocking a Reward.

Post Entry Webhook Request

Our webhooks will create a POST request containing a JSON body to your endpoint. Example JSON:

{
  "campaign": {
    "name": "Example Competition",
    "key": "test1",
    "type": "Competition"
  },
  "user": {
    "name": "John Smith",
    "email": "john.smith@example.com",
    "country": "Australia",
    "region": "Victoria",
    "city": "Melbourne",
    "country_code": "AU",
    "actions_completed": 1,
    "details": {
      "Pet's name": "Spot",
      "Date of birth": "11/11/1986"
    }
  },
  "entry": {
    "entry_method_id": "123456",
    "created_at": "2016-07-25 06:17:51 UTC",
    "type": "custom",
    "value": "Example user answer",
    "worth": 1
  },
  "social_links": [
    {
      "provider": "twitter",
      "uid": "1345519622",
      "reference": "gleamapp"
    }
  ],
}

Whitelisting

If you need to whitelist IP addressess, the requests from Gleam's webhooks will come from 66.85.138.114 or 198.15.100.98

Code Snippets

You will need to have an endpoint that can receive the POST request from Gleam.

Ruby / Ruby On Rails

The user, campaign, and entry details will be mapped to Rails parameters.

For a generic Ruby solution, you can use:

require 'json'

data_json = JSON.parse request.body.read

PHP

<?php
$data = json_decode(file_get_contents('php://input'), TRUE);
print_r($data,true);
?>

Connect With Us