karix/karix-lib

2.0.0 2020-06-29 23:05 UTC

This package is auto-updated.

Last update: 2024-03-29 04:12:36 UTC


README

Build Status Coverage Status

Karix API lets you interact with the Karix platform using an omnichannel messaging API. It also allows you to query your account, set up webhooks and buy phone numbers.

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

  • API version: 2.0
  • Package version: 2.0.0
  • Build package: io.swagger.codegen.languages.PhpClientCodegen

Requirements

PHP 5.6 and later

Installation & Usage

Composer

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

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/karixtech/karix-php.git"
    }
  ],
  "require": {
    "karixtech/karix-php": "2.0.0"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/karix-php/vendor/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 HTTP basic authorization: basicAuth
$config = Karix\Configuration::getDefaultConfiguration()
    ->setUsername('ACCOUNT_ID')
    ->setPassword('ACCOUNT_TOKEN');

$apiInstance = new Karix\Api\MessageApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client(),
    $config
);
date_default_timezone_set('UTC');
// Create Message object
$message = (new \Karix\Model\CreateMessage())
    ->setChannel("sms") //Or use "whatsapp"
    ->setSource("+1XXX2321XXX")
    ->setDestination(["+1XXX8323XXX", "+1XXX3234XXX"])
    ->setContent(["text" => "Sent from Karix PHP SDK"]);

try {
    $result = $apiInstance->sendMessage($message);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling MessageApi->sendMessage: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for API Endpoints

All URIs are relative to https://api.karix.io

Class Method HTTP request Description
AccountsApi createSubaccount POST /account/ Create a new subaccount
AccountsApi getSubaccount GET /account/ Get a list of accounts
AccountsApi getSubaccountById GET /account/{uid}/ Get details of an account
AccountsApi patchSubaccount PATCH /account/{uid}/ Edit an account
MessageApi getMessage GET /message/ Get list of messages sent or received
MessageApi getMessageById GET /message/{uid}/ Get message details by id.
MessageApi sendMessage POST /message/ Send a message to a list of destinations
NumberApi deleteNumber DELETE /number/{num}/ Unrent number from your account
NumberApi getNumber GET /number/ Get details of all phone numbers linked to your account.
NumberApi getNumberDetails GET /number/{num}/ Get details of a number
NumberApi patchNumberDetails PATCH /number/{num}/ Edit phone number belonging to your account
NumberApi rentNumber POST /number/ Rent a phone number
NumberSearchApi searchNumber GET /numbersearch/ Query for phone numbers in our inventory.
WebhookApi createWebhook POST /webhook/ Create webhooks to receive Message
WebhookApi deleteWebhookById DELETE /webhook/{uid}/ Delete a webhook by ID
WebhookApi getWebhook GET /webhook/ Get a list of your webhooks
WebhookApi getWebhookById GET /webhook/{uid}/ Get a webhook by ID
WebhookApi patchWebhook PATCH /webhook/{uid}/ Edit a webhook

Documentation For Models

Documentation For Authorization

basicAuth

  • Type: HTTP basic authentication

Author

support@karix.io