Integro Documentation
  • Getting Set Up
    • Welcome to Integro
      • Initial Setup Guide
        • Configure Your Organization
        • Importing Your Contacts
      • Optional - MailerLite Integration
      • Optional - SMS Integration with RingCentral
  • Use Cases
    • Keeping your Donations Updated with Zapier
    • Connect a Signup Form On Your Website to an Integro workflow
    • Keeping Your Contacts Updated With Zapier
  • API
    • API Overview
    • API Example - Adding New Donations
Powered by GitBook
On this page
  1. API

API Example - Adding New Donations

This article will walk you through how to add Contacts and Donations using the Integro API

Description

In this example we will walk through adding Contacts and Donations to Integro through the API. The easiest way to test your API calls in real time is using our open api spec available at https://api.integrocrm.com.

<?php

require 'vendor/autoload.php'; // Adjust the path based on your project structure

use GuzzleHttp\Client;

// Replace 'API_ENDPOINT' with the actual API endpoint you want to hit
$apiEndpoint = 'https://example.com/api';

$client = new Client();

// Your JSON payload
$jsonData = '{
    "contact": {
        "external_id": 10,
        "title": "Mr.",
        "first_name": "John",
        "last_name": "James",
        "street_address": "123 Main St.",
        "city": "Richmond",
        "state": "CA",
        "zip": "94801",
        "email": "john@email.com",
        "phone": "12345",
        "notes": "This contact was automatically added by Zapier.",
        "labels": [
            "Test Label 1",
            "Test Label 2"
        ]
    },
    "external_id": 123,
    "campaign_id": 123,
    "campaign_name": "Test Campaign",
    "amount": 1,
    "recurring": true,
    "note": "An example note",
    "utm_source": "This parameter indicates the source of the traffic, such as the website, newsletter, or social media platform that drove the user to your site. For email campaigns, you might set this to the name of your email marketing platform or simply email.",
    "utm_medium": "This parameter describes the type of traffic or marketing medium, such as email, social, CPC (cost-per-click), or organic.",
    "utm_campaign": "This parameter is used to identify a specific product promotion or marketing campaign. It allows you to track the overall performance of a campaign.",
    "utm_term": "This parameter is used in paid search campaigns to specify the keyword that triggered the ad. It's not required for other types of campaigns.",
    "utm_content": "This parameter is often used in A/B testing or when there are multiple links to the same URL within one ad or email. It helps differentiate between them."
}';

try {
    $response = $client->post($apiEndpoint, [
        'headers' => [
            'Content-Type' => 'application/json',
        ],
        'body' => $jsonData,
    ]);

    // Get the response body as a string
    $body = $response->getBody()->getContents();

    // If the API returns JSON, you can decode it
    $data = json_decode($body, true);

    // Process the response data as needed
    var_dump($data);
} catch (Exception $e) {
    // Handle exceptions if the request fails
    echo 'Error: ' . $e->getMessage();
}

PreviousAPI Overview

Last updated 1 year ago