Skip to content

Latest commit

 

History

History
149 lines (109 loc) · 4.67 KB

docs.md

File metadata and controls

149 lines (109 loc) · 4.67 KB

Classes

Message

Message

Functions

useCookieJar(jar, username)Promise.<TextNow>

Use a cookie jar to login

usePuppeteer()Promise.<TextNow>

Use a Puppeteer window to login [will be full/non-headless to allow user to login]

init(fetch)Promise.<Message>

Initalize message object, async to accommodate a possible media message download

toString()String

Returns contents of message, which is probably not what you want. So you really shouldn't use this in production.

send(number, message)

Send a message

fromNumber(number)Promise.<Array.<Object>>

Get messages from number, does NOT emit message events

toTNFormat(number)String
fromTNFormat(tnNumber)PhoneNumber
refreshUser()Object

Refreshes this.user

Message

Message

Kind: global class

new Message(json)

Param Type Description
json Object Message JSON from TextNow

message.raw : Object

Kind: instance property of Message

useCookieJar(jar, username) ⇒ Promise.<TextNow>

Use a cookie jar to login

Kind: global function
Returns: Promise.<TextNow> - Authenticated and ready-to-go TextNow instance

Param Type Description
jar CookieJar CookieJar to use
username String Username of authenticated user

usePuppeteer() ⇒ Promise.<TextNow>

Use a Puppeteer window to login [will be full/non-headless to allow user to login]

Kind: global function
Returns: Promise.<TextNow> - Authenticated and ready-to-go TextNow instance

init(fetch) ⇒ Promise.<Message>

Initalize message object, async to accommodate a possible media message download

Kind: global function

Param Type Description
fetch function fetch function, authenticated with CookieJar to fetch a possible media message

toString() ⇒ String

Returns contents of message, which is probably not what you want. So you really shouldn't use this in production.

Kind: global function
Returns: String - Contents of message

send(number, message)

Send a message

Kind: global function

Param Type Description
number String Phone number, will be converted using libphonenumber-js
message String Message to send

fromNumber(number) ⇒ Promise.<Array.<Object>>

Get messages from number, does NOT emit message events

Kind: global function
Returns: Promise.<Array.<Object>> - Array of messages

Param Type Description
number PhoneNumber | String Phone number, will be converted using libphonenumber-js if it's a string

toTNFormat(number) ⇒ String

Kind: global function
Returns: String - Phone number in TextNow [E.164] format

Param Type Description
number PhoneNumber | String Number in any format recognized by libphonenumber-js, or an instance of PhoneNumber

fromTNFormat(tnNumber) ⇒ PhoneNumber

Kind: global function

Param Type Description
tnNumber String Number in TextNow format

refreshUser() ⇒ Object

Refreshes this.user

Kind: global function
Returns: Object - this.user