aNinja Integration

You are here:
< All Topics
Table of Contents

Several options are available to integrate and inject leads into your aNinja account:

You can integrate and augment the functionality of popular platforms with aNinja, including Shopify, Squarespace, WordPress & Wix.

1. WordPress Sites Integration

Get your API key in your User Settings when logged in aNinja account.

Install & activate WP plugin in your WordPress installation: forms-3rdparty-integration

Follow the instructions below for Contact Form 7 and Gravity Form

Contact Form 7 aNinja Integration

Gravity Forms aNinja Integration

2. Standalone applications

The following example is in PHP, but can be repurposed to your language of choice (Python, Ruby, Java, etc..)

Sample PHP API push

 

/**
* Basic snippet for posting with command line curl
*/
$apikey = '123456';

function doCurl($apikey = null, $data = []) {
$data = http_build_query($data);

$api_base = 'https://aninja.com/api/v1';

$api_endpoint= '/contactform/?apikey='.$apikey.'';

$cmd = 'curl -sL --data \''.$data.'\' "'.$api_base.'/'.$api_endpoint.'"';

 

3. Javascript applications

The following example is of an API request in Javascript. You can customize off of the following examples to suit your actual code / use case.

Example use cases: Squarespace, Shopify

ajax({
type: 'POST',
url: "https://aninja.com/api/v1/contactform/?apikey=YOUR_API_KEY_HERE",
data:$.param({contact_name : contact_name}) + "&"+ $.param({contact_email1 : contact_email1}) + "&"+ $.param({contact_phone1 : contact_phone1})+ "&"+ $.param({company_name : company_name}),
success: function (data) {
alert('success');
}
});

The following is more specific to Squarespace (add in the “Page section settings -> Advanced tab -> Page header code injection text area” section for the page where you have the form you want to forward into aNinja)

// SQUARESPACE - example 1
// Add in javascript advanced:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
$('form').submit(function(e) {
var contact_name = $("input[name='fname']").val();
var contact_email1 = $( "input[name='email']").val();
var phone_areacode = $('*[data-title="Areacode"]').val();
var phone_prefix= $('*[data-title="Prefix"]').val();
var phone_line = $('*[data-title="Line"]').val();
var contact_phone1 = phone_areacode+phone_prefix+phone_line;
var subject = $($('select')[0]).val();
var pref_contact_method = $($('select')[1]).val();
var message = $('textarea#textarea-yui_3_17_2_1_1442700176413_134868-field').val();

$.ajax({
type: 'post',
url: "https://aninja.com/api/v1/contactform/?apikey=YOUR_API_KEY_HERE",
data: {
'contact_name': contact_name,
'contact_email1': contact_email1,
'contact_phone1': contact_phone1,
'your-comments': 'message: '+message+' subject:'+subject+' pref_contact_method: '+pref_contact_method
},
success: function (data) {
// alert('success');
}
});
});
});
</script>

 

Fields mapping Table

The following are standard fields you can map to, in addition to any custom fields created in your application that you can see under Settings -> Custom fields