Wit.message() needs a better way to pass params

This issue has been tracked since 2019-05-27.

The problem

Currently the Wit.message() lacks support for msg_id (issue #169) & thread_id (see docs for /message).

But adding those fields will mean passing more arguments to Wit.message() and if you only need to pass just some arguments, let's say we only need message & junk you will end with something like this:

const {Wit, log} = require('node-wit');

const client = new Wit({
  accessToken: MY_TOKEN,
  logger: new log.Logger(log.DEBUG) // optional
});

client.message('set an alarm tomorrow at 7am', null, null, null, false);

Also if you want to add more supported fields the argument list will only increase, because changing the order or removing old values will break apps that already uses Wit.message().

The proposal

Make Wit.message() accepts an Object as a first argument and take the values from it, since message argument must be a string, this should be easy to implement. Also only if the first argument is an Object you should take the values from it, so we don't break apps that already use Wit.message().

More Details About Repo
Owner Name wit-ai
Repo Name node-wit
Full Name wit-ai/node-wit
Language JavaScript
Created Date 2016-04-12
Updated Date 2022-12-02
Star Count 1928
Watcher Count 98
Fork Count 497
Issue Count 36

YOU MAY BE INTERESTED

Issue Title Created Date Updated Date