Giter Site home page Giter Site logo

sendx-api-php's Introduction

SendX REST API has two methods:

Identify API Method

Identify API Method is used to attach data to a visitor. If a contact is not yet created then we will create the contact. In case contact already exists then we update it.

Example Request:

{
  email: "[email protected]",  
  firstName: "John",
  lastName: "Doe",
  birthday: "1989-03-03",
  customFields: { "Designation": "Software Engineer", "Age": "27", "Experience": "5"},  
  tags: ["Developer", "API Team"],  
 }

Note that tags are an array of strings. In case they don't exist previously then API will create them and associate them with the contact.

Similarly if a custom field doesn't exist then it is first created and then associated with the contact along-with the corresponding value. In case custom field exists already then we simply update the value of it for the aforementioned contact.

We don't delete any of the properties based on identify call. What this means is that if for the same contact you did two API calls like:

API Call A

{
   email: "[email protected]", 
   firstName: "John",
   birthday: "1989-03-03",
   customFields: { "Designation": "Software Engineer"},  
   tags: ["Developer"],  
}

API Call B

{  
  email: "[email protected]",  
  customFields: { "Age": "29"},  
  tags: ["API Team"],  
}

The the final contact will have firstName as John, birthday as 1989-03-03 present. Also both tags Developer and API Team shall be present alongwith custom fields Designation and Age.

Properties:

  • firstName: type string
  • lastName: type string
  • email: type string
  • company: type string
  • birthday: type string with format YYYY-MM-DD eg: 2016-11-21
  • customFields: type map[string]string
  • tags: type array of string

Response:

{
  "status": "200",
  "message": "OK",
  "data": {
    "encryptedTeamId": "CLdh9Ig5GLIN1u8gTRvoja",
    "encryptedId": "c9QF63nrBenCaAXe660byz",
    "tags": [
      "API Team",
      "Tech"
    ],
    "firstName": "John",
    "lastName": "Doe",
    "email": "[email protected]",
    "company": "",
    "birthday": "1989-03-03",
    "customFields": {
      "Age": "29",
      "Designation": "Software Engineer"
    }
  }
}

Track API Method

Track API Method is used to associate tags with a contact. You can have automation rules based on tag addition and they will get executed. For eg:

  • On user registration tag start onboarding drip for him / her.
  • Account Upgrade tag start add user to paid user list and start account expansion drip.

Response:

{ "status": "200", "message": "OK", "data": "success" }

This PHP package is automatically generated by the Swagger Codegen project:

  • API version: v1
  • Build package: class io.swagger.codegen.languages.PhpClientCodegen

Requirements

PHP 5.4.0 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/sendx/sendx-api-php.git"
    }
  ],
  "require": {
    "/": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/SwaggerClient-php/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$api_instance = new Swagger\Client\Api\ContactApi();
$api_key = "api_key_example"; // string | 
$team_id = "team_id_example"; // string | 
$body = new \Swagger\Client\Model\Contact(); // \Swagger\Client\Model\Contact | Contact details

try {
    $result = $api_instance->contactIdentifyPost($api_key, $team_id, $body);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling ContactApi->contactIdentifyPost: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to http://app.sendx.io/api/v1

Class Method HTTP request Description
ContactApi contactIdentifyPost POST /contact/identify Identify a contact as user
ContactApi contactTrackPost POST /contact/track Add tracking info using tags to a contact

Documentation For Models

Documentation For Authorization

All endpoints do not require authorization.

Author

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.