webhook receive "payload"

roughnecks

Active member
Hello,
I have a bot which can send outgoing webhooks when messaged privately. In MD I set up a webook url which is called by the bot and so far so good, my action is performed.
Now I've been told by bot's devel that the message you send to the bot is transmitted in webhook in "message" attribute..
Is there a way I can grab this message with an action in MD?

Hope I made myself clear enough. Cheers
 

roughnecks

Active member
Here's what I get in bot's console:

Code:
[2023-01-21T22:49:51.710] [TRACE] default - Outgoing webhook options: {
  method: 'POST',
  url: 'https://trigger.macrodroid.com/d26e0afa/test',
  strictSSL: false,
  json: {
    from: 'roughnecks',
    message: 'wee',
    channel: 'roughnecks@domain.tld'
  },
  timeout: 2000
}
 

FrameXX

Well-known member
Seems to me like you are using HTTP POST request instead of HTTP GET request for triggering the MacroDroid webhook. As described in webhook trigger setup window MD can receive extra parameters inside the URL itself, but it's propably not made to be able receive the parameters inside the request body.

You could try to setup your bot to make HTTP GET requests instead of POST, or you could setup the bot to write the parameters inside the url and continue using POST method.
 
Last edited:

MacroDroidDev

Administrator
Staff member
@FrameXX is correct. HTTP POST body content is not supported. There is a very limited payload size for WebHooks so they should really be used for transmitting very simple data so only query parameters are supported.
 

Endercraft

Moderator (& bug finder :D)
@FrameXX is correct. HTTP POST body content is not supported. There is a very limited payload size for WebHooks so they should really be used for transmitting very simple data so only query parameters are supported.
I wonder if you could create a special webhook that continues loading the page while waiting for a response, then in MacroDroid you have the option of sending back a variable to display on the trigger page.

Edit : this is not possible (at least it wouldn't be called "webhook") as the definition of a webhook is to be a one way message.
 
Last edited:
Top