Advertisement
Guest User

Untitled

a guest
Apr 24th, 2019
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. free 100$ amazon gift card
  2.  
  3. Messenger integration example
  4.  
  5. See examples/messenger.js for a thoroughly documented tutorial.
  6. Overview
  7.  
  8. The Wit module provides a Wit class with the following methods:
  9.  
  10. message - the Wit message API
  11.  
  12. You can also require a library function to test out your bot in the terminal. require('node-wit').interactive
  13. Wit class
  14.  
  15. The Wit constructor takes the following parameters:
  16.  
  17. accessToken - the access token of your Wit instance
  18. logger - (optional) the object handling the logging.
  19. apiVersion - (optional) the API version to use instead of the recommended one
  20.  
  21. The logger object should implement the methods debug, info, warn and error. They can receive an arbitrary number of parameters to log. For convenience, we provide a Logger class, taking a log level parameter
  22.  
  23. Example:
  24.  
  25. const {Wit, log} = require('node-wit');
  26.  
  27. const client = new Wit({
  28. accessToken: MY_TOKEN,
  29. logger: new log.Logger(log.DEBUG) // optional
  30. });
  31.  
  32. console.log(client.message('set an alarm tomorrow at 7am'));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement