News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

How to connect webhook page correctly?

Started by maxya, May 29, 2020, 05:08:00 AM

Previous topic - Next topic

maxya

I am writing a module
You need to install a service webhook, but when checking, does the service add its parameter through ?
/index.php?action=Webhook?sig=180decf64976dca10d2a721719c1e301614af7d8e4461856bd9efe0a91b2c878

add_integration_function('integrate_actions', __CLASS__ . '::actions_webhook', false, __FILE__);

    public static function actions_webhook(&$actions)
    {
        $actions['ViberWebhook'] = array('ViberWebhook.php', '');
    }


How to fix it?
/index.php?action=Webhook - work 200
/index.php?action=Webhook?sig=180decf64976dca10d2a721719c1e301614af7d8e4461856bd9efe0a91b2c878 - not work 404

Doug Heffernan

At your hooks file add this code:

$hook_functions = array(
'integrate_actions' => 'function_name',
);


Then at your ViberWebhook.php file add the function for that hook like this:

function function_name(&$actionArray)
{
$actionArray['ViberWebhook'] = array('ViberWebhook.php', 'other_function');
   
}


Note that other_function() should be defined/created at the ViberWebhook.php file.

Hope it helps. If you have additional questions, do not hesitate to ask.

maxya

Thanks for the message.
But I meant a little different.
My webhook is connected to the forum, but when accessing it, does the external service add the parameter through ?

There is no problem accessing /index.php?action=Webhook

But if when referring to
/index.php?action=Webhook add parameters after ?, I get an error
/index.php?action=Webhook?sig=180d - This section is currently unavailable.

Arantor

Change the second ? to a &

/index.php?action=Webhook&sig=180decf64976dca10d2a721719c1e301614af7d8e4461856bd9efe0a91b2c87

maxya

Quote from: Arantor on May 29, 2020, 06:50:02 AM
Change the second ? to a &

/index.php?action=Webhook&sig=180decf64976dca10d2a721719c1e301614af7d8e4461856bd9efe0a91b2c87

This is not added by me,
This add viber service, which refers to the webhook.
I have no influence on this


Arantor

So they're incompetent, good to know.

Instead then you'll have to make a new page that isn't index.php, load SSI.php in it to give you access to SMF's database and use that page instead.

maxya

Quote from: Arantor on May 30, 2020, 08:28:00 AM
So they're incompetent, good to know.
Thanks for answers. I wrote them a letter asking why they add these parameters. But they do not answer. And there was a question with a different error, they never fixed it in 2 years

Advertisement: