Knowledge Base
/
How to send leads to a Driftrock Affiliate Capture

How to send leads to a Driftrock Affiliate Capture

How to send leads to a Driftrock Affiliate Capture

This guide will describe how an affiliate partner can send leads to Driftrock.

‍

Firstly, you must have an Affiliate Capture already set up on the Driftrock platform to send the leads to. This should be set up by a user on the Driftrock account. See Driftrock's guide to setting up a Driftrock Affilate Capture here.

‍

The Driftrock user should also have provided you with the following to help you build the POST request:

  • The expected fields in an example payload
  • Your affiliate id
  • Your API key

‍

Building the POST request

‍You can make POST requests to this URL:

‍https://external-apis.driftrock.com/v2/affiliate_event

‍‍

Headers:

Content-Type: application/json
Accept: application/json
Authorization: Bearer xxxx-xxxx-xxxx-xxxx

where xxxx-xxxx-xxxx-xxxx is an api key that the client will send to you.

‍

Body:‍

The body must be JSON formatted and containing the required or recommended fields:

  • event_type [string] (required) : this should be set to lead, conversion or action.
  • event_name [string] (required) : tell us what label you would like to assign to this event (eg: User signed up, Page view, Purchase )
  • source_id [string] (required) : this is needed to link the event to the Capture thats been created. This will be in the example payload the client sends across.
  • affiliate_id [string] (required) : this is needed to link the event to one of the affiliates set up in the 'Affiliate' step (step 3) of the capture.
  • fields [json] (required) : this is a json field, where you send us the attributes of this event (eg: "fields": {"email": "test@driftrock.com", "question_1": "test answer"} )
  • event_id [string] (optional) : this can be any ID that is used in your system to uniquely identify this event. Note that if you send two events with the same event_id, they will be linked to the same person in our system.
  • person_id [string] (optional) : this can be any ID that is used in your system to uniquely identify a person. Note that if you send two events with the same person_id, they will be linked to the same person in our system.
  • ga_client_id [string] (optional) : this is the Google Analytics ID that you can provide to allow us to extract marketing info.
  • created_at [string] (optional) : if you would like to provide a more precise timestamp for when the event occurred. If not provided it will be set to the moment Driftrock receives the event, this is a subtle distinction but may be important to your business case. This should be passed in ISO8601 format, (eg: 2019-12-02T10:00:00.000Z)

Using the example string and the affiliate ID you’ll have been sent by the client using Driftrock, the body should look like this as an example:

‍

{
 "event_type": "lead",
 "event_name": "Lead received",
 "source_id": "",
 "affiliate_id": "AFFILIATE_ID",
 "fields": {
   "email_": "...", // required
   "last_name": "...", // required
   "first_name": "...", // required
   "postcode": "..."
 }
}

‍

Send your first test lead.

‍

If your test has been successful, you should see the following response:

  • status: 200
  • payload: {"data": "ok"}

If your test failed, you will see the following response:

  • status: 400
  • payload: {"error": "..."}

‍

Contact the Driftrock user to confirm your lead has been sent successfully.

‍