messagebird-nodejs icon indicating copy to clipboard operation
messagebird-nodejs copied to clipboard

Promises

Open julien-c opened this issue 6 years ago • 1 comments

Is promises support on the roadmap for this lib?

julien-c avatar Mar 05 '19 17:03 julien-c

I would love this too.

In the meantime I use:

import util from 'util';
import initMB from 'messagebird';

const messagebird = initMB(messagebirdKey);

const send = util.promisify(messagebird.messages.create);

await send({
    originator : '<YOUR-MOBILE-NUMBER>',
    recipients : [ '<YOUR-MOBILE-NUMBER>' ],
    body : 'Hi! This is your first message'
});

mikecentric avatar Sep 14 '20 00:09 mikecentric