Authorization
header. So Pipedream automatically configures this HTTP request to pass your token to that specific header:
https://slack.com/api/chat.postMessage
:
channel
and message
for the request:
$.flow.retry
isn’t available in the HTTP Request action to retry automatically if the request failssteps.trigger.event.body.send_message
try...catch
blocks. In this example, we’ll only send a Slack message if another API request fails:
$errors
channel, instead of handling each error individually.$.flow.rerun
within a try...catch
block in order to retry a failed API request.
See the example in the $.flow.rerun
docs for Node.js.
@pipedream/platform
axios?axios
is an HTTP client for Node.js (see these docs for usage examples).
axios
has a simple programming API and works well for most use cases. But its default error handling behavior isn’t easy to use. When you make an HTTP request and the server responds with an error code in the 4XX or 5XX range of status codes, axios
returns this stack trace:
axios
wrapper as a part of the @pipedream/platform
package. This presents the same programming API as axios
, but implements two helpful features:
400
), it returns only the data
property of the response object — the HTTP response body. This is typically what users want to see when they make an HTTP request:400
), it displays a detailed error message in the Pipedream UI (the HTTP response body), and returns the whole axios
response object so users can review details on the HTTP request and response:@pipedream/platform
axios in component actions@pipedream/platform
axios in component actions, import it:
@pipedream/platform
axios uses methods provided by the $
object, so you’ll need to pass that as the first argument to axios
when making HTTP requests, and pass the standard axios
request config as the second argument.
Here’s an example action: