Always await your actions

All Cloudhooks actions return promises. You must wait for these promises to resolve using await, otherwise your hook won't work as expected. Without await, your hook might complete before the action finishes, leading to unexpected behavior or errors.

You can use await because Cloudhooks is ES2016 compatible:

module.exports = async function (payload, actions) {
  // Wait for the HTTP request to complete
  const { data } = await actions.http.get('https://cloudhooks.dev');
  
  // Now you can safely work with the data
  console.log('Here is the page: ', data)
}

❌ Incorrect usage:

module.exports = async function (payload, actions) {
  // Missing await!
  const { data } = actions.http.get('https://cloudhooks.dev');
  
  // Here you'll have a promise, not the actual data, it will fail
  console.log('Here is the page: ', data)
}