CREATE Lead (FAO Integromat Developers)

Follow

This instructions have been written for Integromat to help build a LeadByte App.
IF you are a member of staff at Integromat please do contact us at support[@]lbyte.zendesk.com

Prerequisites

To Create a lead you need to know
- The LeadByte account i.e. mycompany.leadbyte.co.uk
- The campaign id
- The fields that are required
- An API Key


Retrieve ALL Campaigns
To create a lead you need to know which campaign (list) you are adding this lead to.  As a result you will need to READ all campaigns.  Once you know what campaign you want to post leads to you can then retrieve detailed data for that campaign.  

Example request

[GET] https://{account}.leadbyte.com/restapi/v1.2/campaigns?key={key}&debug=yes

Example payload

[
	{
		"id": "9",
		"name": "Example Campaign A",
		"reference": "EXAMPLE-CAMPAIGN",
		"description": "",
		"currency": "Britain (United Kingdom), Pounds",
		"country": "United Kingdom",
		"sms_field": "Phone 1",
		"active": "1",
		"sup_visible": "1",
		"archived": "0"
	}
]


Retrieve Detailed Data For A Campaign

Using the id from the list of campaigns, you can now retrieve the fields available and whether they are required or optional.  If a field is required, you must map a field in Integromat to it.  We advise you show the label to the Integromat user but you submit the value to the "name" value.  For example, the user may create a custom field in LeadByte called Make_Of_Car (the label / friendly name) however, in the database the name is data13.  Once you have mapped the field you can then CREATE the lead using a POST Request.

Example request

[GET] https://{account}.leadbyte.com/restapi/v1.2/campaigns/{id}?key={key}


Example payload

{
	"id": "9",
	"name": "Example Campaign A",
	"reference": "EXAMPLE-CAMPAIGN",
	"description": "",
	"currency": "Britain (United Kingdom), Pounds",
	"country": "United Kingdom",
	"sms_field": "Phone 1",
	"active": "1",
	"sup_visible": "1",
	"archived": "0",
	"fields": [
		
	
		{
			"name": "data13",
			"label": "make_of_car",
			"required": true,
			"data_type": "Text",
			"selection_labels": "",
			"selection_values": "",
			"category": ""
		},
		{
			"name": "data14",
			"label": "mortgage_type",
			"required": false,
			"data_type": "Text",
			"selection_labels": "",
			"selection_values": "",
			"category": ""
		},
		{
			"name": "dob",
			"label": "DOB",
			"required": false,
			"data_type": "Date",
			"selection_labels": "",
			"selection_values": "",
			"category": "Standard"
		},
		{
			"name": "email",
			"label": "Email",
			"required": true,
			"data_type": "Email Address",
			"selection_labels": "",
			"selection_values": "",
			"category": "Standard"
		},
		{
			"name": "firstname",
			"label": "First_Name",
			"required": true,
			"data_type": "Alphabetical",
			"selection_labels": "",
			"selection_values": "",
			"category": "Standard"
		},
		{
			"name": "gender",
			"label": "Gender",
			"required": false,
			"data_type": "Text",
			"selection_labels": "Male,Female,M,F",
			"selection_values": "Male,Female,M,F",
			"category": "Standard"
		},
		{
			"name": "lastname",
			"label": "Last_Name",
			"required": true,
			"data_type": "Alphabetical",
			"selection_labels": "",
			"selection_values": "",
			"category": "Standard"
		},
		{
			"name": "phone1",
			"label": "Phone_1",
			"required": false,
			"data_type": "UK Mobile Number",
			"selection_labels": "",
			"selection_values": "",
			"category": "Standard"
		},
		{
			"name": "postcode",
			"label": "Postcode",
			"required": false,
			"data_type": "Postcode",
			"selection_labels": "",
			"selection_values": "",
			"category": "Standard"
		},
		{
			"name": "sid",
			"label": "SID",
			"required": true,
			"data_type": "Text",
			"selection_labels": "",
			"selection_values": "",
			"category": "Standard"
		}
	]
}

 

Create Lead
Once you have selected the campaign you want to create a lead in and you have mapped the fields, you can then make a POST request to create the lead.  Note: you need to submit the campaign reference value to a field name called campid (as per example below)

Example request

[POST] https://{account}.leadbyte.com/restapi/v1.2/leads

Example JSON Payload

{
	"key": "{key}",
	"lead": {
		"campid": "EXAMPLE-CAMPAIGN",
		"sid": "1",
		"email": "{email}",
		"title": "{title}",
		"firstname": "{firstname}",
		"lastname": "{lastname}",
		"data13": "{make_of_car}"
	}
}


Example response


A successful response is status Success, two examples below.

{"status":"Success","code":2,"message":"","results":[{"queueId":"ac1e0092-3656328b-60b032e0-d708-7e561a98","status":"Quarantined","code":2}]}
{"status":"Success","code":2,"message":"","results":[{"queueId":"ac1e0092-3656328b-60b032e0-d708-7e561a98","status":"Queued","code":2}]}

Example unsuccessful response is status Error

{"status":"Error","code":-5,"message":"One or more errors occurred, see errors array","redirectUrl":"","errors":["Email is not a valid email address"]}

Here are our response codes

Response Codes:

-9: Campaign not active
-8: HLR rejection
-7: Supplier not authorised
-5: Validation error
-4: Campaign cap reached
-3: Remote system error
-2: Duplicate or resubmission
-16: Number matched DNCR database
-15: Number matched TPS database
-14: IP address country rejection
-13: Landline rejection
-12: Email rejection
-11: IP address blocked
-100: Internal error
-10: PAF rejection

 

Was this article helpful?
0 out of 0 found this helpful

Comments