定制 zef-dev/convoworks-pckg-appointments 二次开发

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

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

zef-dev/convoworks-pckg-appointments

Composer 安装命令:

composer require zef-dev/convoworks-pckg-appointments

包简介

Contains conversational workflow elements for managing appointment scheduling scenarios in the Convoworks framework.

关键字:

README 文档

README

This package contains conversational workflow elements for managing appointment scheduling scenarios in the Convoworks framework. It contains elements that you can use in the conversation workflow, but the appointments data source is just described via the IAppointmentsContext interface.

When we are talking about workflow components (elements), we have to primarily consider voice and conversational design needs. Their properties, sub-flows and general behavior are tailored to make conversational workflow as easy as possible. They are not related to any particular booking plugin or a similar 3rd party service provider.

Appointments context is on the other hand bridge between workflow elements (Convoworks) and the real, concrete appointment system you are using in your system.

Appointments context interface

IAppointmentsContext describes methods that should be implemented by a target appointments system. If you have e.g. WordPress schedule appointment plugin, you can easily enable it to be used with Convoworks by implementing this interface.

Most of the methods require user identification and we use email for it. Email works just well with WordPress, while it enables us to have passthrough implementations which do not require the actual user to be created in it. If your target system has several appointment types, the one you need should be configured on this IAppointmentsContext type component.

To be properly used in the Convoworks GUI, it also has to implement IBasicServiceComponent and IServiceContext. You might consider to start your implementation like this:

class MyCustomAppointmentsContext extends AbstractBasicComponent implements IAppointmentsContext, IServiceContext
{

}

You can check for more about developing custom packages on the Convoworks documentation and you can check our Convoworks WP Plugin Package Template

DummyAppointmentsContext

Dummy implementation that can serve to test voice applications or as an example when creating your own IAppointmentsContext implementation.

Here are few predefined features that it has:

  • business hours are 9:00 - 17:00 on workdays
  • appointment duration: 30 min
  • it will store appointments in the Convoworks user scope

Workflow elements

All appointment package workflow elements have the context_id property which hooks them to the context which implements the IAppointmentsContext interface. That way elements are concentrated on the conversation workflow needs, while the real business logic is delegated to the concrete implementation.

Here are all common parameters:

  • context_id - Id of the referenced IAppointmentsContext
  • email - Optional for CheckAppointmentTimeElement but required for all others
  • timezone_mode - DEFAULT will use default timezone from referenced appointments context, CLIENT will try to get client information or SET will allow you to explicitly set the value.
  • timezone - only when timezone_mode is SET. PHP timezone name.

Some elements have multiple sub-flows depending on the result we got. This kind of approach enables you to use less IF statements in your workflow. But in order not to force you to split workflow, some of the flows are optional and when left empty, the default flow will be executed.

CheckAppointmentTimeElement

This element will check if the desired time slot is available. It has several sub-flows, depending on requested slot or suggestions availability. When the requested slot is not available, element exposes suggestions, an array of time slots (timestamps) which could be offered to the end user.

Parameters:

  • appointment_date - Optional, requested date in the Y-m-d format (the MySQL DATE format)
  • appointment_time - Optional, requested time in the H:i:s format (the MySQL TIME format)
  • email - Optional, user identification. If present, it might serve for better suggestions
  • return_var - Default status, name of the variable which will be present in sub-flows and that contains information about operation result (suggestions : array of suggestions, requested_time: requested appointment as timestamp, requested_timezone: requested time zone as string, not_allowed: true when the requested period is out of business hours)

Flows:

  • available_flow - Executed when time slot is available
  • suggestions_flow - Executed when the slot is not available an there are suggestions
  • single_suggestion_flow - Optional, executed if there is just a single suggestion. If it is empty (no elements inside), suggestions_flow will be executed
  • no_suggestions_flow- Optional, executed if there are no suggestions. If it is empty, suggestions_flow will be executed

Other:

  • suggestions_builder - Component of type IFreeSlotQueueFactory which serves for building suggestions. You can use DefaultFreeSlotQueue or create your own.

Suggestions representation as JSON.

[{
      "timestamp" : 123345678,
}, {
      "timestamp" : 123445678,
}]

CreateAppointmentElement

This element will try to create an appointment for a given time slot. It can happen (rarely) that the slot is not free anymore and you can use not_available flow to handle it. If a general, unexpected error occurs, the system handler will handle it.

Parameters:

  • appointment_date - Requested date in the Y-m-d format (the MySQL DATE format)
  • appointment_time - Requested time in the H:i:s format (the MySQL TIME format)
  • payload - Various other properties that might be used with an implementing booking plugin.
  • return_var - Default status, name of the variable that contains additional information (appointment_id: string, requested_time: requested appointment as timestamp, requested_timezone: requested time zone as string, not_allowed: true when the requested period is out of business hour)

Flows:

  • ok - This flow is executed when appointment is created
  • not_available - Executed when the requested slot is not available

UpdateAppointmentElement

Element which updates existing appointment time.

Parameters:

  • appointment_id - Id of the existing appointment
  • appointment_date - Requested date in the Y-m-d format (MySQL DATE format)
  • appointment_time - Requested time in the H:i:s format (MySQL TIME format)
  • payload - Optional, various other properties that might be used with an implementing plugin. When empty, original payload data provided on creation should stay the same.
  • return_var - Default status, name of the variable that contains additional information (existing previous appointment version as you would get it with load appointment element, requested_time: requested appointment as timestamp, requested_timezone: requested time zone as string, not_allowed: true when the requested period is out of business hour)

Flows:

  • ok - Executed when the appointment is updated
  • not_available - Executed when the requested slot is not available

CancelAppointmentElement

This element will cancel an existing appointment.

Parameters:

  • appointment_id - Id of the existing appointment
  • return_var - Default status, name of the variable that contains additional information (existing: previous appointment version as you would get it with load appointment element)

Flows:

  • ok - Executed when the appointment is canceled

LoadAppointmentsElement

This element will load existing appointments for the current user.

Parameters:

  • mode : current default, past or all
  • limit : default 10
  • return_var - Default status, name of the variable that contains additional information (appointments : array of appointments)

Flows:

  • multiple - Executed when the multiple appointments are found.
  • single - Executed when only a single appointment is found. If it is empty, multiple flow will be executed.
  • empty - Executed if there are no suggestions. If it is empty, multiple flow will be executed

LoadAppointmentElement

This element returns single appointment data.

Parameters:

  • appointment_id - Id of the existing appointment
  • return_var - Default status, name of the variable that contains additional information (appointment: array of appointment objects)

Flows:

  • ok - Executed when the appointment is loaded.

Single appointment representation as JSON.

{
      "appointment_id" : "123",
      "email" : "user@domain.com",
      "timestamp" : 123345678,
      "timezone" : "America/New_York",
      "payload" : {
          "some_other_fields" : "That is used by implementing appointment context & WP plugin",
          "more_fields" : "Some other data"
      }
}

Template - Schedule Appointments

This package is shipped with the ready to use service template - Schedule Appointments. By default it is configured to use our dummy appointments context. You can easily change it on the variables view by changing the APPOINTMENTS value.

Features

This conversational service enables your users to create, reschedule or cancel appointments. It is designed to provide a nice and rich user experience. Users are able to create new appointments, check if they have existing ones and cancel or reschedule them. When the requested slot is not available, service will suggest several free slots.

Other characteristics and requirements:

  • Ready to use as Alexa skill
  • Voice only interface
  • It will require from user to enable access to profile data in Alexa app (name, email)

Initial setup

If you just installed Convoworks WP, you might want to check the Connect to Amazon and create your first Alexa skill from our Convoworks basics video tutorial series.

Open Convoworks WP services view and click on the "Create new" button. Enter your service name, select the "My Booking" template and press the "Submit" button.

Now navigate to the service "Configuration" view and select "amazon alexa" configuration button. In the "Amazon Alexa Skill Permissions" section check the "Full Name" and the "Customer Email Address" checkboxes. Press "Save configuration" and your service will be propagated to Alexa Console.

You might also change APP_NAME in the "Variables'' view. If you plan to use some other appointment context, you should change APPOINTMENTS to the appropriate id.

Go to the Alexa app (or web app https://alexa.amazon.com), click on "Your Skills", select the "Dev skills" tab, find your new skill and enable it.

Your Booking skill now can be tested on your Alexa enabled devices.

For more information, please check out convoworks.com

zef-dev/convoworks-pckg-appointments 适用场景与选型建议

zef-dev/convoworks-pckg-appointments 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 119 次下载、GitHub Stars 达 2, 最近一次更新时间为 2022 年 01 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「convoworks」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 zef-dev/convoworks-pckg-appointments 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 zef-dev/convoworks-pckg-appointments 我们能提供哪些服务?
定制开发 / 二次开发

基于 zef-dev/convoworks-pckg-appointments 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-01-18