2016-12-28 2 views
-1

J'essaye de comprendre s'il y a une option pour obtenir les journaux de conversation des discussions avec une sorte de webhook. Les documents API.AI se réfèrent uniquement à l'utilisation de webhook à des fins de réalisation, mais pour l'instant je ne prévois pas mon serveur (GCP ENGINE APP) pour fournir l'exécution, mais uniquement pour enregistrer les paramètres pertinents de chaque conversation. Quelqu'un sait comment aborder cela?Comment obtenir API.AI simplement m'envoyer les données JSON de la conversation?

Répondre

0

Activez la fonction de crochet Web pour l'intention. Vous serez en mesure d'obtenir les demandes et toutes les données associées. Vous pourrez également renvoyer à API.AI. Voici le cercle complet:

{ 
    "id": "891db09a-851c-43dc-81c6-4c6705c94f85", 
    "timestamp": "2017-01-03T10:31:18.676Z", 
    "result": { 
    "source": "agent", 
    "resolvedQuery": "yes, France", 
    "action": "show.news", 
    "actionIncomplete": false, 
    "parameters": { 
     "adjective": "", 
     "subject": "France" 
    }, 
    "contexts": [ 
     { 
     "name": "subject", 
     "parameters": { 
      "subject.original": "France", 
      "adjective": "", 
      "subject": "France", 
      "adjective.original": "" 
     }, 
     "lifespan": 5 
     }, 
     { 
     "name": "region", 
     "parameters": { 
      "subject.original": "France", 
      "adjective": "", 
      "subject": "France", 
      "adjective.original": "" 
     }, 
     "lifespan": 5 
     } 
    ], 
    "metadata": { 
     "intentId": "34773849-4ac2-4e28-95a5-7abfc061044e", 
     "webhookUsed": "true", 
     "webhookForSlotFillingUsed": "false", 
     "intentName": "subject" 
    }, 
    "fulfillment": { 
     "speech": "Here is the latest news\n\n According to Watson the main emotion expressed in the article is: ;((sadness)\n\n Son of Equatorial Guinea’s president facing trial in France\n\nPARIS — After years of investigation, France on Monday put the son of the president of Equatorial Guinea on trial for corruption, charged with spending many millions in state funds — much of it allegedly in cash — to feed an opulent lifestyle of fast cars, designer clothes, works of art and...\n\nRead more: https://www.washingtonpost.com/world/europe/son-of-equatorial-guineas-president-facing-trial-in-france/2017/01/02/b03d30d0-d0cb-11e6-9651-54a0154cf5b3_story.html", 
     "source": "Washington Post", 
     "displayText": "Here is the latest news. According to Watson the main emotion expressed in the article is: sadness", 
     "messages": [ 
     { 
      "type": 0, 
      "speech": "Here is the latest news\n\n According to Watson the main emotion expressed in the article is: ;((sadness)\n\n Son of Equatorial Guinea’s president facing trial in France\n\nPARIS — After years of investigation, France on Monday put the son of the president of Equatorial Guinea on trial for corruption, charged with spending many millions in state funds — much of it allegedly in cash — to feed an opulent lifestyle of fast cars, designer clothes, works of art and...\n\nRead more: https://www.washingtonpost.com/world/europe/son-of-equatorial-guineas-president-facing-trial-in-france/2017/01/02/b03d30d0-d0cb-11e6-9651-54a0154cf5b3_story.html" 
     } 
     ], 
     "data": { 
     "newsAgent": { 
      "adjective": "", 
      "subject": "France", 
      "intent": "subject", 
      "action": "show.news", 
      "news": { 
      "title": "Son of Equatorial Guinea’s president facing trial in France", 
      "source": "Washington Post", 
      "link": "https://www.washingtonpost.com/world/europe/son-of-equatorial-guineas-president-facing-trial-in-france/2017/01/02/b03d30d0-d0cb-11e6-9651-54a0154cf5b3_story.html", 
      "language": "english", 
      "body": "PARIS — After years of investigation, France on Monday put the son of the president of Equatorial Guinea on trial for corruption, charged with spending many millions in state funds — much of it allegedly in cash — to feed an opulent lifestyle of fast cars, designer clothes, works of art and...", 
      "emotion": "sadness", 
      "emoticon": ";(" 
      }, 
      "speech": "Here is the latest news", 
      "sessionId": "0856125a-d0bc-4cba-990d-cbcfaea536db" 
     } 
     } 
    }, 
    "score": 1 
    }, 
    "status": { 
    "code": 206, 
    "errorType": "partial_content", 
    "errorDetails": "Webhook call failed. Error message: Webhook contains contexts with empty names or names containing whitespaces. ErrorId: 131000fa-0ec1-4efb-b47c-64301ac7bb2b" 
    }, 
    "sessionId": "0856125a-d0bc-4cba-990d-cbcfaea536db" 
} 

L'objet result est la demande que API.AI vous envoie, vous obtenez les contexts objets aussi bien.

L'objet fulfilment est la réponse de mon point final renvoyé à API.AI

Check the documentation

+0

Hey Samuel - merci pour votre aide, je ne vis maintenant (retour de vacances), La chose est, je garde tomber dans le même problème tout le temps - si j'utilise la fonction webhook dans l'intention, c'est en fait (si je comprends bien) signifie que je dois aller dans la section accomplissement et activer webhook => signifie que j'ai besoin d'implémenter le contenu de réponse API.AI sinon l'intention ne saura pas "quoi répondre" à l'utilisateur ... Donc, je ne veux pas construire maintenant toute la logique pour l'accomplissement, je veux juste obtenir les données et répondre wi ok-200 mais semble API.AI ne sait pas comment prendre cela sans casser mon bot. –