vormkracht10 / genesys-api

PHP package to communicate with the Genesys API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP Genesys API

Latest Version on Packagist Tests Total Downloads

This package is a PHP wrapper for the Genesys API. The package provides a fluent syntax to interact with the API.

Installation

You can install the package via composer:

composer require vormkracht10/genesys-api

Usage

Authentication

This package only provides a way to interact with the API. To handle the authentication logic we created the oauth2-genesys package which provides a league/oauth2-client provider for Genesys.

Create Genesys API client

use Vormkracht10\GenesysApi\Genesys;

$accessToken = '{access-token}';

$genesys = Genesys::api(
  region: 'us-west-1', // optional, default is 'us-east-1'
  accessToken: $accessToken
);

Conversations

Get conversation

$genesys->conversations()->get(id: '{conversation-id}');

List conversations

$genesys->conversations()->list();

Create conversation

$genesys->conversations()->create(
  params: []
);

Messages for conversation

$genesys->conversations()->messages(id: '{conversation-id}');

Message for conversation

$genesys->conversations()->message(
  conversationId: '{conversation-id}',
  messageId: '{message-id}'
);

Get message draft for conversation

$genesys->conversations()->getMessageDraft(
  conversationId: '{conversation-id}',
);

Update message draft for conversation

$genesys->conversations()->updateMessageDraft(
  conversationId: '{conversation-id}',
  params: []
);

Update conversation participant

$genesys->conversations()->updateParticipant(
  conversationId: '{conversation-id}',
  participantId: '{participant-id}',
  params: []
);

Emails for conversation

$genesys->conversations()->emails(id: '{conversation-id}');

Update attributes for conversation

$genesys->conversations()->updateAttributes(
  conversationId: '{conversation-id}',
  participantId: '{participant-id}',
  params: [
    'labels' => ['Done', 'Mailed customer']
  ]
);

Replace participant

$genesys->conversations()->replaceParticipant(
  conversationId: '{conversation-id}',
  participantId: '{participant-id}',
  params: [
    'userId' => '{user-id}'
  ]
);

Users

Get user

$genesys->users()->get(id: '{user-id}');

// With parameters
$genesys->users()->get(id: '{user-id}', params: ['expand' => 'languagePreference']);

List users

$genesys->users()->list();

Create user

$genesys->users()->create([
  'name' => 'Test',
  'department' => 'Test Department',
  'email' => 'test@testdepartment.com',
  'addresses' => [],
  'title' => 'Lorem Ipsum',
  'password' => 'P1hQrt4WytLxz2gF%LYc',
  'divisionId' => null,
  'state' => 'active',
])

Update user

$genesys->users()->update(
  id: '{user-id}',
  params: [
    'name' => 'New name',
]);

Delete user

$genesys->users()->delete(id: '{user-id}');

Get queues for user

$genesys->users()->queues(id: '{user-id}');

Queues

Get queue

$genesys->queues()->get(id: '{queue-id}');

List queues

$genesys->queues()->list([
  'pageNumber' => 1,
  'pageSize' => 25,
  'sortOrder' => 'desc',
]);

Create queue

$genesys->queues()->create([
  'name' => 'Test queue'
]);

Update queue

$genesys->queues()->update(
  id: '{queue-id}',
  params: [
    'name' => 'New name',
]);

Delete queue

$genesys->queues()->delete(id: '{queue-id}');

Get the wrap-up codes for a queue

$genesys->queues()->getWrapupCodes(
  id: '{queue-id}',
  params: [
    'pageSize' => 25,
    'pageNumber' => 1
  ]
);

Get the members of a queue

$genesys->queues()->members(
  id: '{queue-id}',
  params: [
    'pageSize' => 25,
    'pageNumber' => 1
  ]
);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

About

PHP package to communicate with the Genesys API.

License:MIT License


Languages

Language:PHP 100.0%