Skip to content

Lightweight library that allows you to create, edit, delete and upload files to Zendesk Support. In a clean and standard way.

License

Notifications You must be signed in to change notification settings

AdrianVillamayor/ZendeskSupport-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ZendeskSupport-API

By Adrii

Latest Stable Version Total Downloads License

Lightweight library that allows you to create, edit, delete and upload files to Zendesk Suppot. In a clean and standard way.

Installation

Use Composer to install the library.

composer require adrii/zendesk-api

Composer

use Adrii\ZendeskAPI;

Manual

require_once ROOT . 'ZendeskAPI.php';

Usage

    
    $data = array(
        "username" => "1234qwer",
        "type" => "problem",
        "tags" => "ios,test",
        "subject" => "Test",
        "body" => "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean tempor semper enim. Nam non semper ligula. Vestibulum sapien sapien, hendrerit pharetra elementum a, faucibus id nisl. Aenean ornare rhoncus ligula, eget efficitur augue suscipit vehicula. Fusce faucibus odio magna, sit amet aliquet ipsum sodales a.",
        "first_name" => "Adrii",
        "last_name" => "🍍",
        "email" => "adrian.villamayor@gmail.com",
    );
        
    for ($i = 0; $i < count($files); $i++) {
        $zendesk->upload($files[$i]['name'], $files[$i]['tmp_name']);
    }

    $comment = array(
        array(
            'type'          => $data['type'],
            'tags'          => explode(",", $data['tags']),
            'subject'       => $data['subject'],
            'comment'       => array(
                'body'      => $data['body'],
                'public'    => false,
                "uploads"   => $zendesk->getUpload()
            ),
            'requester'     => array(
                'locale_id' => '1',
                'name'      => $data['first_name'] . " " . $data['last_name'],
                'email'     => $data['email'],
            ),
            'priority'      => 'normal',
        )
    );

    $subdomain  = "{subdomain}";
    $user       = "{user}";
    $token      = "{token}";

    $zend = new ZendeskApi($subdomain, $user, $token);

    $zend->create($comment);

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

Thanks for your help! 🎉

About

Lightweight library that allows you to create, edit, delete and upload files to Zendesk Support. In a clean and standard way.

Topics

Resources

License

Stars

Watchers

Forks

Languages