定制 joelgrondrup/silverstripe-microbizz 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

joelgrondrup/silverstripe-microbizz

最新稳定版本:1.0.0

Composer 安装命令:

composer require joelgrondrup/silverstripe-microbizz

包简介

Adds support for event handling for Microbizz in a SilverStripe environment

README 文档

README

Overview

🔌 Connect to Microbizz
This module provides an interface to listen to one or more Microbizz systems, capture complex objects when commands are issued, and act upon them. You can also create custom interface endpoints to embed iframes in the Microbizz CRM system.

Installation

📦 Install via Composer
Run the following command to install the module:

composer require joelgrondrup/silverstripe-microbizz

After this run:

dev/build

🛠 Configure the CMS
Once the database is built, you will see a button labeled "Microbizz Applications" in the CMS. Start by creating a Microbizz Application in the CMS by entering a public and secret key. Contact Ventu commercial support to obtain these keys.

Image of fields for public and secret developer key

Activate Application

🔗 Establish Connection
You must conduct a handshake with Microbizz to receive an access token, contract ID, and endpoint URL. Click "Activate" and follow the instructions. You may fill out hooks and interfaces before activating, but this can also be completed afterward.

After a successful handshake, the access token, endpoint, and contract fields should be populated.

Image of fields for access token, endpoint, and contract

Enter User Information for API Requests

🔑 API Credentials
Complete the configuration by providing an API key, username, and password, which should be created in the corresponding Microbizz system. This information will be beneficial when extending hooks and interfaces.

Hooks for Event Endpoints

🔔 Receive Events
To capture your first event objects from Microbizz, create a webhook and provide a mod and a hook code. Remember, hooks are necessary for obtaining event endpoint types.

Image of fields for webhook with title, mod and hook code

You can add as many hooks as needed. Available events are listed here. After adding event hooks, activate them by clicking "Activate" and follow the form in Microbizz.

Once data is received from Microbizz, use the "Event log" tab to view all incoming data, or check individual hooks to view events specific to each webhook.

Working with Event Data

⚙️ Customize Functionality
For each hook, you can craft custom functions that will be triggered when the hook is activated. All possible actions are listed in a dropdown under the "Actions" tab. To create these functions, extend the BaseWebhook class and add static functions.

Example

<?php

class TodoWebhooks extends BaseWebhook {

    static function closeTodosWhenControlled($data, $params, $event) {

        // Perform actions

        $event->Log .= "Closed todo with ID {$data['id']}";
        $event->write();

    }

}

When you have created your custom function, it will automatically appear in the "Actions" dropdown menu.

Field for customs webhook functions

Every extension of the BaseWebhook should accept three parameters: data, params, and event. Data represents the information sent from Microbizz, params is an array of parameters from the Microbizz application, and event is the MicrobizzEvent object in SilverStripe. Modify the log in the CMS using this, which is particularly useful for debugging and detailing what transpired.

Interface Endpoints

🎛 Embed Interfaces
Interface endpoints are iframes embedded within the Microbizz CRM system at various locations. They are referred to as "interfaces" in the documentation. To create an interface endpoint, extend the BaseInterfaceEndpoint class and implement a static function with parameters: data and params.

Data includes the GET parameters from the iframe, while params is an array that contains the Microbizz application parameters, session token result, interface, and application objects.

Example

<?php

use SilverStripe\Control\Controller;

class TodoInterface extends BaseInterface {

    static function showMyCustomTodoTab($data, $params) {

        $controller = Controller::curr();

        return $controller->renderWith("MyCustomTodoTabInterface");

    }

}

License

📜 MIT License
This module is licensed under the MIT license.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2025-12-11