botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
81 stars 90 forks source link

Sending a notification to human agent in HITL doesn't work #651

Closed artoby closed 4 years ago

artoby commented 5 years ago

Make sure these checkboxes are checked before raising an issue, thank you!

Issue description

Sending of a notification to a human from the HITL module isn't working as it should according to the tutorial at https://botpress.io/docs/tutorials/#alerting-agents

Screen Shot 2019-03-26 at 2 32 28 PM

There are 2 issues:

  1. The tutorial says event.user.first_name but actually it should be user.first_name
  2. Sending of the notification raises an exception. Video demonstrating the issue: https://youtu.be/jgFfk8LuVfg Exception log exception.log
rndlaine commented 5 years ago

HITL is still under development. Right now we're focusing on other parts of the product but we'll definitely fix HITL at some point in the next couple months.

In the meantime we'll fix the tutorial.

artoby commented 5 years ago

@rndlaine ok, thanks!

JijeshP commented 5 years ago

@artoby try like below

 const botId = event.botId;
    const name = event.state.user.full_name;

    const message = name + ' wants to talk to a human';
    bp.notifications.create(botId, {
      botId,
      level: 'info',
      message: message,
      url: '/modules/hitl'
    });
saalehaafreen commented 5 years ago

i tried it but it showed me

Launcher Unhandled Rejection [error, insert into "srv_notifications" ("botId", "created_on", "id", "level", "message", "module_icon", "module_id", "module_name", "redirect_url") values ($1, now(), $2, $3, $4, $5, $6, $7, $8) returning "id", "botId", "level", "message", "module_id", "module_name", "module_icon", "redirect_url", "created_on" - null value in column "id" violates not-null constraint] help me @JijeshP

testuserusman commented 4 years ago

Just update this and it will work fine :)

I tested it:

const message = user.first_name + ' wants to talk to a human' bp.notifications.create('flight-booking-bot', { message, level: 'info', url: '/modules/hitl' }) / Your code ends here /