ApiaiPromised.run(event.message.text, event.sender.id)
.then(apiaiData => {
  if (apiaiData.result.source === "domains" || apiaiData.result.actionIncomplete) {
    // if the result comes from a domain, or is a prompt, then we just pass the fulfillment
    Facebook.sendTextMessage(event.sender.id, apiaiData.result.fulfillment.speech);
  } else {
    // otherwise we process the action
    switch (apiaiData.result.action) {
      case 'helloworld':
        Facebook.sendTextMessage(event.sender.id, 'Bonjour!');
        break;