zef-dev / convoworks-core

PHP framework for handling conversational services like Amazon Alexa skills, Google Assistant, Viber, FB messenger ...
https://convoworks.com
MIT License
25 stars 2 forks source link

Card Visual Block #10

Open mmarcec007 opened 3 years ago

mmarcec007 commented 3 years ago

Card Block Define a new block in convoworks with name Card Block which will make it easier to work with cards on Amazon Alexa, Google Assistant, Facebook Messenger and Viber.

Block Properties itself:

Block Containers:

Card Actions:

Additional specifications:

Please also refer to the Dummy representation of the Card Block.

card_block_image

tolecar commented 3 years ago

Couple things I would like to point out

mmarcec007 commented 3 years ago

Here is an quick overview of the interface infrastructure for the Card Visual Element.

IConvoCardRequest makes it easier to detect any selected card action after a card response was sent.

interface IConvoCardRequest extends IConvoRequest
{
    /**
     * @return string
     */
    public function getSelectedCardAction() : string;
}

IConvoCardResponse makes it easier to declare an card response.

interface IConvoCardResponse extends IConvoResponse
{
    public function getCardResponse(IVisualCard $cardItem) : array;
}

IVisualCard is used in IConvoCardResponse->getCardResponse(IVisualCard $cardItem) card response. This definition makes it clearer how the CardResponse should be formed.

interface IVisualCard {
    public function getCardVisualItem() : IVisualItem;
    public function getCardActions() : array;
}

IVisualItem is part of CardResponse.

interface IVisualItem
{
    public function getTitle() : string;
    public function getSubtitle() : string;
    public function getDescription() : string;
    public function getImageURL() : string;
    public function getImageText() : string;
}

ICardAction is used to render buttons in card responses.

interface ICardAction
{
    public function getCardActionKey() : string;
    public function getCardActionName() : string;
}