Skip to content

chabokpush/chabok-php-demo

Repository files navigation

Chabok API for PHP

Integrate your app with Chabok messaging & push api seamlessly

Upgrade Notes to v1.1.0 (MUST READ)

  • Change all Swagger prefix to Chabok
  • You should set 'App_ID' on Chabok Configuration to connect in the right way

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/chabokpush/chabok-php-demo.git"
    }
  ],
  "require": {
    "chabok-php": "dev-master"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/chabok-php-demo/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');

// Configure API key authorization: ApiSecurity,  Get your 'YOUR_API_KEY' from http://sandbox.push.adpdigital.com/front/account/edit 
Chabok\Client\Configuration::getDefaultConfiguration()->setApiKey('access_token', 'YOUR_API_KEY');
// Get your 'App_ID' from http://sandbox.push.adpdigital.com/front/account/edit 
Chabok\Client\Configuration::getDefaultConfiguration()->setAppId('App_ID');
// Make Dev mode enable If you want to test your App on Development environment or don't have Chabok premium account
Chabok\Client\Configuration::getDefaultConfiguration()->setDevMode(true);
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// Chabok\Client\Configuration::getDefaultConfiguration()->setApiKeyPrefix('access_token', 'Bearer');

$api_instance = new Chabok\Client\Api\InstallationApi();
$user_id = "user_id_example"; // string | 
$tag_name = "tag_name_example"; // string | 

try {
    $result = $api_instance->installationAddTag($user_id, $tag_name);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling InstallationApi->installationAddTag: ', $e->getMessage(), PHP_EOL;
}

?>

Documentation for API Endpoints

All URIs are relative to https://sandbox.push.adpdigital.com/api

Class Method HTTP request Description
InstallationApi installationAddTag GET /installations/addTag/{userId}/{tagName} Add tag to all devices of a user
InstallationApi installationFetchById GET /installations/fetchById/{installationId} Find device installation data by installationId
InstallationApi installationFetchByUserId GET /installations/fetchByUserId/{userId} Find devices of a specific user
InstallationApi installationGroupBySubscription GET /installations/channels List of unique channel names
InstallationApi installationRemoveTag GET /installations/removeTag/{userId}/{tagName} Remove a tag from devices of a UserId
InstallationApi installationTags GET /installations/tags List of unique tag names
MessageApi messageFetchById GET /messages/fetchById/{messageId} Fetch a pushed message by id
PushApi pushByQuery POST /push/byQuery Push a text message to a segment of devices
PushApi pushToUsers POST /push/toUsers Push multiple text messages to users
VerificationApi verificationRequestCodeGet GET /verification/requestCode/{userId} Request a verification code to be sent to a user
VerificationApi verificationVerifyGetVerificationVerifyCodeuserIdcode GET /verification/verifyCode/{userId}/{code} Verify user's verification code

Documentation For Models

Documentation For Authorization

ApiSecurity

  • Type: API key
  • API key parameter name: access_token
  • Location: URL query string