Webhook for HTTPS

Post Reply
actionHero
Member
Posts: 37
Joined: Thu May 18, 2017 12:06 am

Webhook for HTTPS

Post by actionHero »

Has anyone been successful in configuring a Webhook in Switch? I can't even get the HTTP to work, I will eventually need the HTTPS. I've never generated a Certificate, Private Key or password before?

I've setup my HTTP webhook, using Postman to send the requests... just getting a 404 error in return.

Any suggestions?
Last edited by actionHero on Mon Nov 26, 2018 8:48 pm, edited 2 times in total.
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Webhook for HTTPS

Post by Padawan »

404 means Switch doesn't know which page to serve. Have you already setup a Webhook element in one of your flows and is the flow activated?

Do you get errors in the Switch messages?
actionHero
Member
Posts: 37
Joined: Thu May 18, 2017 12:06 am

Re: Webhook for HTTPS

Post by actionHero »

Hello,
No errors in Switch Messages.

Yes I have the webhook setup in a flow.

I'm using 'test/notify' as the URL.

My put call form Postman is http://"myIP":8080/test/notify

I get a 404 return...

If I just enter, http://"myIP":8080

I get the messages from Enfocus PDF Review Module. So I at least know it's connecting. It's just not seeing the "test/notify" in my webhook URL.
actionHero
Member
Posts: 37
Joined: Thu May 18, 2017 12:06 am

Re: Webhook for HTTPS

Post by actionHero »

Hello,
No errors in Switch Messages.

Yes I have the webhook setup in a flow.

I'm using 'test/notify' as the URL.

My put call form Postman is http://"myIP":8080/test/notify

I get a 404 return...

If I just enter, http://"myIP":8080

I get the messages from Enfocus PDF Review Module. So I at least know it's connecting. It's just not seeing the "test/notify" in my webhook URL.
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Webhook for HTTPS

Post by jan_suhr »

Are you using the WebhookRequest class in your script?

Here is an example form the manual.

Code: Select all

function webhookTriggered( s : Switch, r : WebhookRequest )
{
  if (r == null) 
  {
    try
    {
      s.webhookSubscribe(WebhookRequest.POST, "/myscript/notify");
    }
    catch(e)
    {
      s.log(3, "Error: %1", String( e ));
    }
    return;
  }
  s.log(1,"Received request using method: %1", r.method);
  s.log(1,"Request data: %1", r.getBody().toString());
  s.log(1,"Request headers: %1", JSON.stringify(r.headers));
  s.log(1,"Request query: %1", JSON.stringify(r.query));
  if ('my_header' in r.headers)
  {
    s.log(1,"Value of 'my_header': %1", r.headers.my_header);
  }
  if ('my_parameter' in r.query)
  {
    s.log(1,"Value of 'my_parameter': %1", r.query.my_parameter);
  }
}
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
actionHero
Member
Posts: 37
Joined: Thu May 18, 2017 12:06 am

Re: Webhook for HTTPS

Post by actionHero »

Hi Jan,
I was just hoping to use the webhook configurator built in to Switch. Are you saying it doesn't work?

Thanks
jan_suhr
Advanced member
Posts: 586
Joined: Fri Nov 04, 2011 1:12 pm
Location: Nyköping, Sweden

Re: Webhook for HTTPS

Post by jan_suhr »

actionHero wrote: Mon Nov 26, 2018 6:14 pm Hi Jan,
I was just hoping to use the webhook configurator built in to Switch. Are you saying it doesn't work?

Thanks
You posted in Scripting...
Jan Suhr
Color Consult AB
Sweden
=============
Check out my apps
Padawan
Advanced member
Posts: 358
Joined: Mon Jun 12, 2017 8:48 pm
Location: Belgium
Contact:

Re: Webhook for HTTPS

Post by Padawan »

actionHero wrote: Mon Nov 26, 2018 5:41 pm Hello,
No errors in Switch Messages.

Yes I have the webhook setup in a flow.

I'm using 'test/notify' as the URL.

My put call form Postman is http://"myIP":8080/test/notify

I get a 404 return...

If I just enter, http://"myIP":8080

I get the messages from Enfocus PDF Review Module. So I at least know it's connecting. It's just not seeing the "test/notify" in my webhook URL.
Does that mean that both Switch and the PDF review module server are running on the same system and setup to listen to the same port?

If you are running them on the same server, then I would suggest to use different ports.
actionHero
Member
Posts: 37
Joined: Thu May 18, 2017 12:06 am

Re: Webhook for HTTPS

Post by actionHero »

I did end up changing the ports and its working now. Simple fix.
Post Reply