Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

PHP warning when source is DIALOGFLOW_CONSOLE #51

Open
jaxtheking opened this issue Oct 20, 2020 · 1 comment
Open

PHP warning when source is DIALOGFLOW_CONSOLE #51

jaxtheking opened this issue Oct 20, 2020 · 1 comment

Comments

@jaxtheking
Copy link

jaxtheking commented Oct 20, 2020

Hi,
I was testing a Card message directly from the Dialoglow console when I realised my webhook script is producing this warning:
Undefined index: DIALOGFLOW_CONSOLE in /[...]/vendor/eristemena/dialogflow-fulfillment-webhook-php/src/RichMessage/Card.php on line 210. I'm using PHP 7.3.

Not a big deal, but could you maybe add DIALOGFLOW_CONSOLE to $v2PlatformMap in RichMessage.php at line 16?
Also, since it supports rich messages, it could be added to $supportedRichMessagePlatforms also.
This seems to work:

protected $v2PlatformMap = [
    'unspecified'   => 'PLATFORM_UNSPECIFIED',
    'facebook'      => 'FACEBOOK',
    ...
    'google'        => 'ACTIONS_ON_GOOGLE',
    'DIALOGFLOW_CONSOLE'    => 'DIALOGFLOW_CONSOLE',
];

protected $supportedRichMessagePlatforms = [
    'facebook', 'slack', 'telegram', 'kik', 'skype', 'line', 'viber', 'google', 'DIALOGFLOW_CONSOLE',
];

Thanks.
Luca

@jaxtheking
Copy link
Author

Or even more simply, in RichMedia.php:

protected function setRequestSource($requestSource)
{
    if (null == $requestSource || 'DIALOGFLOW_CONSOLE' == $requestSource) {
        $requestSource = 'unspecified';
    }

    $this->requestSource = $requestSource;

    return $this;
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant