2017 © Pedro Peláez
 

library rapport-client

Rapport

image

venditan/rapport-client

Rapport

  • Tuesday, February 21, 2017
  • by Docnet
  • Repository
  • 3 Watchers
  • 0 Stars
  • 31 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

PHP Client Library for Venditan Rapport

http://www.venditan.com/rapport, (*1)

Table of Contents

Install with Composer

composer require venditan/rapport-client dev-master

Examples

In all the examples below, we will assume you have created a client object with the right credentials, like this:, (*2)

// Create the client with your supplied client id and api key
$obj_client = new \Venditan\Rapport\Client('company', 'api-key');

Order Dispatch

// Add and configure the target recipient/user
$obj_client->addUser()->id('1955')->name('Marty')->email('marty@mcfly.com')->mobile('07019551985');

// Set-up the transaction
$obj_client->addTransaction()->id('2015')->courier('Western Union')->tracking('ELB1885');

// Set the type of event and publish
$obj_client->event('order_dispatched')->send();

Order Details

It is possible to provide order details (lines, delivery address, notes) as well., (*3)

This would normally only be provided once, using the order_detail event., (*4)

// Set-up the transaction
$obj_txn = $obj_client->addTransaction()->id('2015');

// Address
$obj_txn->deliverTo('123 Street, Town, County, POST CODE');

// Notes
$obj_txn->notes('Will be delivered by hand');

// Line. Only the description is required, other fields are optional
$obj_txn->addLine()->describe('Paul Smith Shirt')->quantity(1)->image('https://a.b.c/d.jpg')->attribute('Colour', 'Red')->attribute('Size', '12');

// Set the type of event and publish
$obj_client->event('order_detail')->send();

Estimated Delivery Dates

If your event templates support an estimated delivery date this can be sent along with your request., (*5)

The date will be included as provided so please send the date as you would like it to be displayed., (*6)

// Add and configure the target recipient/user
$obj_client->addUser()->id('1955')->name('Marty')->email('marty@mcfly.com')->mobile('07019551985');

// Set-up the transaction
$obj_client->addTransaction()->id('2015')->estimatedDelivery('10th May 2016');

// Set the type of event and publish
$obj_client->event('stock_arrived')->send();

Service Message

// Add and configure the target recipient/user
$obj_client->addUser()->id('1955')->name('Marty')->email('marty@mcfly.com')->mobile('07019551985');

// Set-up the transaction (optional, useful context)
$obj_client->addTransaction()->id('2015');

// Set a service message
$obj_client->addMessage()->title('Order Update')->body('Hi Marty. I am safe in 1885.')->from('ELB');

// Set the type of event and publish
$obj_client->event('service_message')->send();

Retrieve Thread Messages

Threads exist for either transaction (order) contexts or just plain user (customer) contexts., (*7)

// Retrieve any thread for Order "2015"
$obj_client->getThreadForTransaction('2015');

OR, (*8)

// Retrieve any thread for User "12345"
$obj_client->getThreadForUser('12345');

The response will be a stdClass object decoded from the following JSON structure, (*9)

{
    "id": "oid-2015",
    "topic": "Order 2015",
    "last_read": "2015-01-01 12:00:00",
    "last_read_device": "Mobile, iPhone",
    "messages": [
        {
            "title": "Order Accepted",
            "message": "Thank you for your order.",
            "created": "2015-01-01 12:00:00"
        }
    ]
}

Account Usage

// Retrieve basic account usage data
$obj_client->getAccountUsage();

The response will be a stdClass object decoded from the following JSON structure., (*10)

More usage statistics may be added in future., (*11)

{
    "this_month": {
        "name": "December 2015",
        "year": 2015,
        "month": 12,
        "sms": 199
    },
    "recent_months": [
        {
            "name": "October 2015",
            "year": 2015,
            "month": 10,
            "sms": 117
        },
        ...
    ]
}

The Versions

21/02 2017

dev-master

9999999-dev http://www.venditan.com/rapport

Rapport

  Sources   Download

The Development Requires

sms docnet venditan rapport

22/12 2015

v1.0.0

1.0.0.0 http://www.venditan.com/rapport

Rapport

  Sources   Download

The Development Requires

sms docnet venditan rapport