Skip to content

Commit

Permalink
Merge branch 'master' into 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lukiq committed Oct 26, 2017
2 parents bdac75c + 6955f88 commit bd0400d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Expand Up @@ -156,6 +156,22 @@ Available methods

- `$LiveChatAPI->tags->delete('Tag Name')`

### Webhooks

[Webhooks REST API documentation](https://docs.livechatinc.com/rest-api/#webhooks).

- `$LiveChatAPI->webhooks->get()`

- `$LiveChatAPI->webhooks->webhooks(array(
"event_type" => "chat_started",
"data_types" => array(
"chat", "visitor"
),
"url" => "http://www.shoeshop.com/webhook",
))`

- `$LiveChatAPI->webhooks->delete('622d3950eecea8bb5f8c26f20c76ee2e')`

To do
------------

Expand Down
28 changes: 28 additions & 0 deletions src/LiveChat/Api/Model/Webhooks.php
@@ -0,0 +1,28 @@
<?php

/**
* @see https://docs.livechatinc.com/rest-api/#webhooks
*/
namespace LiveChat\Api\Model;

class Webhooks extends BaseModel
{
const METHOD_PATH = 'webhooks';

public function get()
{
return $this->executeGet(self::METHOD_PATH);
}

public function add(array $vars)
{
return $this->executePost(self::METHOD_PATH, $vars);
}

public function delete($webhookID)
{
$url = self::METHOD_PATH . '/' . $webhookID;

return $this->executeDelete($url);
}
}

0 comments on commit bd0400d

Please sign in to comment.