@@ -14,20 +14,89 @@ It's easy to get started. Simply enter the API Key and secret you obtained from
1414
1515### 🚀 Create a webhook
1616``` php
17+ <?php
18+ require_once('vendor/autoload.php');
19+
20+ $basicAuthUserName = 'YOUR_API_KEY'; // The username to use with basic authentication
21+ $basicAuthPassword = 'YOUR_SECRET_KEY'; // The password to use with basic authentication
22+
23+ $client = new MessageMediaWebhooksLib\MessageMediaWebhooksClient($basicAuthUserName, $basicAuthPassword);
24+
25+ $webhooks = $client->getWebhooks();
26+
27+ $body = new MessageMediaWebhooksLib\Models\CreateWebhookRequest();
28+ $body->url = "http://webhook.com/asdasd";
29+ $body->method = "POST";
30+ $body->encoding = "JSON";
31+ $body->headers = array("x-your-webhook-custom-header" => "custom-value");
32+ $body->events = array("RECEIVED_SMS");
33+ $body->template = '{"id":"$mtId","status":"$statusCode"}';
34+
35+ $result = $webhooks->createWebhook($body);
1736```
1837
1938### 📥 Retrieve all webhooks
2039``` php
40+ <?php
41+ require_once('vendor/autoload.php');
42+
43+ $basicAuthUserName = 'YOUR_API_KEY'; // The username to use with basic authentication
44+ $basicAuthPassword = 'YOUR_SECRET_KEY'; // The password to use with basic authentication
45+
46+ $client = new MessageMediaWebhooksLib\MessageMediaWebhooksClient($basicAuthUserName, $basicAuthPassword);
47+
48+ $webhooks = $client->getWebhooks();
49+
50+ $page = 0;
51+ $pageSize = 10;
52+
53+ $result = $webhooks->retrieveWebhook($page, $pageSize);
54+ print_r($result);
2155```
2256
2357### 🔄 Update a webhook
2458You can get a webhook ID by looking at the ` id ` of each webhook created from the response of the above example.
2559``` php
60+ <?php
61+ require_once('vendor/autoload.php');
62+
63+ $basicAuthUserName = 'YOUR_API_KEY'; // The username to use with basic authentication
64+ $basicAuthPassword = 'YOUR_SECRET_KEY'; // The password to use with basic authentication
65+
66+ $client = new MessageMediaWebhooksLib\MessageMediaWebhooksClient($basicAuthUserName, $basicAuthPassword);
67+
68+ $webhooks = $client->getWebhooks();
69+
70+ $webhookId = "YOUR_WEBHOOK_ID";
71+
72+ $body = new MessageMediaWebhooksLib\Models\CreateWebhookRequest();
73+ $body->url = "http://webhook.com/some_new_url";
74+ $body->method = "POST";
75+ $body->encoding = "JSON";
76+ $body->headers = array("Account" => "teasdasdst");
77+ $body->events = array("RECEIVED_SMS");
78+ $body->template = '{"id":"$mtId","status":"$statusCode"}';
79+
80+
81+ $result = $webhooks->updateWebhook($webhookId, $body);
2682```
2783
2884### ❌ Delete a webhook
2985You can get a webhook ID by looking at the ` id ` of each webhook created from the response of the retrieve webhooks example.
3086``` php
87+ <?php
88+ require_once('vendor/autoload.php');
89+
90+ $basicAuthUserName = 'YOUR_API_KEY'; // The username to use with basic authentication
91+ $basicAuthPassword = 'YOUR_SECRET_KEY'; // The password to use with basic authentication
92+
93+ $client = new MessageMediaWebhooksLib\MessageMediaWebhooksClient($basicAuthUserName, $basicAuthPassword);
94+
95+ $webhooks = $client->getWebhooks();
96+
97+ $webhookId = "YOUR_WEBHOOK_ID";
98+
99+ $webhooks->deleteWebhook($webhookId);
31100```
32101
33102## 📕 Documentation
0 commit comments