Skip to content

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

Open
@Xotl

Description

@Xotl

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().

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions