sirumobile/zendesk-notifier

Symfony Zendesk Notifier Bridge

0.1.2 2022-04-05 13:15 UTC

This package is auto-updated.

Last update: 2024-05-05 17:27:04 UTC


README

Provides Zendesk integration for Symfony Notifier.

Requirements

  • PHP 7.3
  • Symfony Notifier 5.3+ and HttpClient components
  • Zendesk subdomain, username and API token

Installation

$ composer require sirumobile/zendesk-notifier

Add correct DSN with your Zendesk credentials to ENV. Then configure notifier and add ZendeskTransportFactory to your services.

# .env
ZENDESK_DSN=zendesk://USERNAME:TOKEN@SUBDOMAIN

You can get your API key from Zendesk Admin panel. If your Zendesk domain is yourcompany.zendesk.com and username support@yourcompany.com, the DSN would look something like this:

# .env
ZENDESK_DSN=zendesk://support@yourcompany.com:abc123@yourcompany
# ./config/packages/notifier.yaml
framework:
    notifier:
        chatter_transports:
            zendesk: '%env(ZENDESK_DSN)%'
# ./config/services.yaml
Siru\Notifier\Bridge\Zendesk\ZendeskTransportFactory:
    tags: [ chatter.transport_factory ]

Usage

By default, transport creates a Ticket on behalf of agent or admin. To create a Request on behalf of user, set the correct options using ZendOptions class.

$options = (new ZendeskOptions())
    ->subject('My message')
    ->asRequest()
    ->requester('some-user@domain');
$chatMessage = new ChatMessage('');
$chatMessage->options($options);

See ZendeskOptions for all available options.