Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/./../app/.././../../finland.picotech.app/public_html/storage/../vendor/./phpoption/../laravel/../nikic/../voku/./../alexandr-mironov/../yajra/./../twilio/../phpdocumentor/../coinpaymentsnet/./.././graham-campbell/../bin/../messagebird/php-rest-api/examples/./conversations
الملفات الموجودة في هذا الـ Path:
.
..
create-hsm.php
create.php
enable-whatsapp-sandbox.php
list.php
message-read.php
messages-create-location.php
messages-create-media.php
messages-create-text.php
messages-list.php
read.php
send.php
update.php
webhooks-create.php
webhooks-delete.php
webhooks-list.php
webhooks-read.php

مشاهدة ملف: webhooks-create.php

<?php

// Webhooks enable real-time notifications of conversation events to be
// delivered to endpoints on your own server. This example creates a webhook
// that is invoked when new conversations and messages are created in the
// specified channel.

require(__DIR__ . '/../../autoload.php');

$messageBird = new \MessageBird\Client('YOUR_ACCESS_KEY'); // Set your own API access key here.

try {
    $webhook = new \MessageBird\Objects\Conversation\Webhook();
    $webhook->channelId = 'CHANNEL_ID';
    $webhook->url = 'https://example.com/webhook';
    $webhook->events = [
        \MessageBird\Objects\Conversation\Webhook::EVENT_CONVERSATION_CREATED,
        \MessageBird\Objects\Conversation\Webhook::EVENT_MESSAGE_CREATED,

        // Other options:
        // \MessageBird\Objects\Conversation\Webhook::EVENT_CONVERSATION_UPDATED,
        // \MessageBird\Objects\Conversation\Webhook::EVENT_MESSAGE_UPDATED,
    ];

    $messageBird->conversationWebhooks->create($webhook);
} catch (\Exception $e) {
    echo sprintf("%s: %s", get_class($e), $e->getMessage());
}