• Resolved davidcervantes

    (@davidcervantes)


    Hello,

    I’m trying to send an e-mail with Watson assistant in a specific response.

    I found in the code a way to send e-mails by set up a context var in the json response.

    But when I set ‘mail_context_vars’ as a ‘action’ in the json response, the function mail_context_vars($response_actions[$i]) is not trigger.

    The condition in the code is similar to
    $response_body['output']["actions"][$i]['name'] is equal to 'mail_context_vars'

    I edit the my json response to have a [actions][][name]= “mail_context_vars” like this:

    {
      "output": {
        "actions":[
          {
          	"name": "mail_context_vars"
          }
        ],
        "generic": [
          {
            "values": [
              {
                "text": "Sending a email"
              }
            ],
            "response_type": "text",
            "selection_policy": "sequential"
          }
        ]
      }
    }

    But the plugin don’t send any e-mail.
    Looking into the Watson Assistant’s response in the browser I see that the [‘actions’][][‘name’] that I set up is in [output][user_defined][actions][][name] so the plugin code never match the condition.

    {
       "output":{
          "generic":[ ],
          "debug":{ },
          "intents":[ ],
          "entities":[ ],
          "user_defined":{
             "actions":[
                {
                   "name":"mail_context_vars"
                }
             ]
          }
       },
       "context":{ },
    }
    

    It will be great if the dev team correct this by adding the [user_defined] in the condition to be able to send emails in this way.

    I avoid this bug by using the hook watsonconv_message_received that triggers when a response is delivered by Watson, using a function that check if my context var is set up and sending a email with wp_mail().

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Send e-mails with a specific response in Watson Assistant.’ is closed to new replies.