/Knowtify-API-PHP

Class for PHP to use Knowtify

Primary LanguagePHPGNU General Public License v2.0GPL-2.0

Knowtify-API-PHP

Class for PHP to use Knowtify (http://www.knowtify.io/). Knowtify is the smartest and easiest way to engage your users with email.

How to Install

  • Copy Knowtify.php and Yourname_Knowtify.php to your server.
  • add include('Yourname_Knowtify.php'); to the php file that you want to use the Knowtify Class.

Editing the files Yourname_Knowtify.php

Add the API key from Knowtify

 public function __construct() {
  $this->_api = 'API KEY';
  $this->_URL = 'http://www.knowtify.io/api/v1';
  $this->_data = "/data";
  $this->_contacts = "/contacts";
  $this->_add = '/add';
  $this->_edit = '/edit';
  $this->_upsert = '/upsert';
  $this->_delete = '/delete';
} 
  • You can change the Yourname_Knowtify.php name to something that works in your project.
  • The API KEY you will get from your Knowtify Settings

How to work with data.

Adding Data

How to use the add data function

$notificationKnowtify = new Yourname_Knowtify();
$leadclient = $notificationKnowtify->AddKnowtifyData($data = array("data" => array("data" => "Added Data")));

Adding Contact

How to use the add contact function

$notificationKnowtify = new Yourname_Knowtify();
        
        $addclient = $notificationKnowtify->UpsertKnowtifyContacts($data = array(
            "contacts" => array(
                "name" => "John",
                "email" => "john@test.com",
                "data" => array(
                    "category" =>"sports",
                    "followers" =>300
                )
            )
        ));  

Deleting Contact

Delete Contacts

$notificationKnowtify = new Yourname_Knowtify();
        
        $addclient = $notificationKnowtify->DeleteKnowtifyContacts($data = array(
            "contacts" => array(
                "john@test.com",
                "sam@test.com",
                "sarah@test.com",
                "mike@test.com",
                "jill@test.com",
                "ashley@test.com",
                "frank@test.com",
                "bill@test.com"
            )
        ));  

Sending Transactional Email

Sending Transactional Email

$notificationKnowtify = new Yourname_Knowtify();
        
        $addclient = $notificationKnowtify->UpsertKnowtifyContacts($data = array(
            "event" => "purchase",  //this is the tag for the email in Knowtify
            "contacts" => array(
                 "email" => "marty@mcfly.io",   //this is to whom the email will be delivered
                "PurchasedItem" => "Flux Capacitor 2000", //this is all sample data that will populate the body of the email 
                "ItemImage" => "/fluxcapacitor2000.jpg",
                "ItemDescription" => "The most advanced Capacitor yet!",
                "PurchasePrice" =>"$1,299" 
            )
        ));  

Author:

Donovan Maidens ( @Anomalous_Bot / anomalous.co.za )