The outbound API is intended to inform you of events happening in your Kartra account. The API will send out those outbound calls whenever a specific list of actions, pre-defined by you inside the Kartra account, are triggered.  

Configuring your outbound API

To pre-define those actions, navigate to Integrations > My API > Outbound API. All you need to do is to enter the URL(s) you want our API to ping, and the specific event(s) you want us to notify you about. You may configure multiple URLs, and multiple notification events per URL.


The data contained inside the API calls

There are a number of events our API can notify you about, such as...

  • When a lead gets tagged.
  • When a lead is granted access to a membership.
  • When a transaction is processed.
  • When a lead fills in an opt-in form.
  • Etc.

The specific information contained within each of those event is different on a case by case scenario. For example, transaction-related notifications contain relevant details about the transaction itself: product, transaction amount, customer details, etc. That being said, the info is always sent as a raw body POST JSON formatted object. Here's an example of a JSON object sent when a lead is subscribed to a list:

        "id": "1",
        "first_name": "John",
        "middle_name": "Doe",
        "last_name": "Doe",
        "last_name2": "Doe",
        "email": "",
        "phone_country_code": "+1",
        "phone": "1234567",
        "company": "company",
        "address": "address",
        "city": "New York",
        "zip": "1234",
        "state": "state",
        "country": "United States",
        "date_joined": "2018-04-26 00:00:00",
        "website": "",
        "ip": "",
        "ip_country": "United States",
        "facebook": "facebook",
        "twitter": "twitter",
        "linkedin": "linkedin",
        "google_plus": "google_plus",
        "sales_tax_id": "1234",
        "lead_picture": "",
        "source": "0",
        "score": "0",
        "lead_deleted": "0",
        "lead_deleted_date": "2018-04-26 00:00:00",
        "referring_id": "0", 
        "blacklisted": "0",    
        "source_id": "0",
        "gdpr_lead_status": 1,
        "gdpr_lead_status_date": "2018-04-26 00:00:00",
        "gdpr_lead_status_ip": "",
        "gdpr_lead_communications": 0,
        "custom_fields": [
          "field_value":"beef lasagna",
            "list_name":"list 1"

Fetching the data

Finally, you have to make sure that, inside your end-point URL(s), you have a script that catches and interprets the data passed by our API outbound notifications. For that purpose, your end point URL(s) must be written in a programming language that can catch the HTTP raw post request. Here is a small PHP sample on how to get the raw post:

    $postdata = file_get_contents("php://input"); 
    // The data comes as an JSON so you will need to decode it 
    $postdata_decoded = json_decode($postdata); 

    // Now that you have all the data, you may grab it and pass it to your custom scripts 
    // Example: $postdata_decoded->lead contains the details of the specific lead triggering the action