Class: Typetalk

Typetalk

new Typetalk(options)

Typetalk API client

Parameters:
Name Type Argument Description
options Object <optional>

API parameters

Properties
Name Type Argument Default Description
client_id String <optional>

client id

client_secret String <optional>

client secret

scope String <optional>
topic.read

scope

redirect_uri String <optional>

redirect uri

access_token String <optional>

access token

refresh_token String <optional>

refresh token

timeout Number <optional>
3000

timeout(ms)

See:

Methods

acceptTeamInvitation(teamId, inviteTeamId) → {Promise}

Accept team invitation

Parameters:
Name Type Description
teamId Number

Team ID

inviteTeamId Number

Team invitation ID (invites.teams[x].id in Get notification list)

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

acceptTopicInvitation(topicId, inviteTeamId) → {Promise}

Accept topic invitation

Parameters:
Name Type Description
topicId Number

Topic ID

inviteTeamId Number

Topic invitation ID (invites.topics[x].id in Get notification list)

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

authorizeChromeApp(options) → {Promise}

Starts an auth flow at the typetalk oauth2 URL.

Parameters:
Name Type Argument Description
options Object <optional>

oAuth2 parameters

Properties
Name Type Argument Description
client_id String <optional>

client id

scope String <optional>

scope

redirect_uri String <optional>

redirect uri

Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

clearToken()

Removes your access token from this instance

createTopic(name, options) → {Promise}

Create topic

Parameters:
Name Type Argument Description
name String

Topic Name

options Object <optional>

Form parameters

Properties
Name Type Argument Description
teamId Number <optional>

Team ID

inviteMembers[0..N] String <optional>

account.name or e-mail address

[options.inviteMessage String

Invite message

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

declineTeamInvitation(teamId, inviteTeamId) → {Promise}

Decline team invitation

Parameters:
Name Type Description
teamId Number

Team ID

inviteTeamId Number

Team invitation ID (invites.teams[x].id in Get notification list)

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

declineTopicInvitation(topicId, inviteTeamId) → {Promise}

Decline topic invitation

Parameters:
Name Type Description
topicId Number

Topic ID

inviteTeamId Number

Topic invitation ID (invites.topics[x].id in Get notification list)

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

deleteTopic(topicId) → {Promise}

Delete topic

Parameters:
Name Type Description
topicId Number

Topic ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

favoriteTopic(topicId) → {Promise}

Favorite topic

Parameters:
Name Type Description
topicId Number

Topic ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getAccessTokenUsingAuthorizationCode(options) → {Promise}

Get an access token using authorization code

Parameters:
Name Type Argument Description
options Object <optional>

oAuth2 parameters

Properties
Name Type Argument Description
client_id String <optional>

client id

client_secret String <optional>

client secret

redirect_uri String <optional>

redirect uri

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getAccessTokenUsingClientCredentials(options) → {Promise}

Get access token using authorization code

Parameters:
Name Type Argument Description
options Object <optional>

oAuth2 parameters

Properties
Name Type Argument Description
client_id String <optional>

client id

client_secret String <optional>

client secret

scope String <optional>

scope

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getFriends() → {Promise}

Get my friends

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getMentionList(options) → {Promise}

Get mention list

Parameters:
Name Type Argument Description
options Object <optional>

Form parameters

Properties
Name Type Argument Description
from Number <optional>

Mention ID

unread Boolean <optional>

true: only unread mentions, false: all mentions

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getMessage(topicId, postId) → {Promise}

Get message

Parameters:
Name Type Description
topicId Number

Topic ID

postId Number

Post ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getMyProfile() → {Promise}

Get my profile

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getMyTopics() → {Promise}

Get my topics

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getNotificationCount() → {Promise}

Get notification count

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getNotificationList() → {Promise}

Get notification list

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getTalk(topicId, talkId, options) → {Promise}

Get messages in talk

Parameters:
Name Type Argument Description
topicId Number

Topic ID

talkId Number

Talk ID

options Object <optional>

Form parameters

Properties
Name Type Argument Description
count Number <optional>

default value: 20, maximum: 100

from Number <optional>

references Post ID

direction String <optional>

"backward" or "forward"

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getTalks(topicId) → {Promise}

Get talk list

Parameters:
Name Type Description
topicId Number

Topic ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getTeams() → {Promise}

Get my teams

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getTopicDetails(topicId) → {Promise}

Get topic details

Parameters:
Name Type Description
topicId Number

Topic ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getTopicMembers(topicId) → {Promise}

Get topic members

Parameters:
Name Type Description
topicId Number

Topic ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

getTopicMessages(topicId, options) → {Promise}

Get topic messages

Parameters:
Name Type Argument Description
topicId Number

Topic ID

options Object <optional>

Query parameters

Properties
Name Type Argument Description
count Number <optional>

default value: 20, maximum: 100

from Number <optional>

references Post ID

direction String <optional>

"backward" or "forward"

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

hasToken() → {Boolean}

Check if this instance has the access token and the refresh token

Returns:
  • Returns true if this instance has the access token and the refresh token
Type
Boolean

inviteTopicMember(topicId, options) → {Promise}

Invite members to topic

Parameters:
Name Type Argument Description
topicId Number

Topic ID

options Object <optional>

Form parameters

Properties
Name Type Argument Description
inviteMembers[0..N] String <optional>

account.name or e-mail address

[options.inviteMessage String

Invite message

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

likeMessage(topicId, postId) → {Promise}

Like message

Parameters:
Name Type Description
topicId Number

Topic ID

postId Number

Post ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

postMessage(topicId, message, options) → {Promise}

Post message

Parameters:
Name Type Argument Description
topicId Number

Topic ID

message String

your message, maximum length: 4096

options Object <optional>

Form parameters

Properties
Name Type Argument Description
replyTo Number <optional>

references Post ID

fileKeys[0-5] String <optional>

attachment file key, maximum count: 5

talkIds[0-5] Number <optional>

Talk IDs that you want to put the message in, maximum count: 5

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

readMention(mentionId) → {Promise}

Read mention

Parameters:
Name Type Description
mentionId Number

Mention ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

readMessagesInTopic(topicId, options) → {Promise}

Read messages in topic

Parameters:
Name Type Argument Description
topicId Number

Topic ID

options Object <optional>

Form parameters

Properties
Name Type Argument Description
postId Number <optional>

Post ID ( if no parameter, read all posts )

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

readNotification() → {Promise}

Read notification

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

refreshAccessToken(options) → {Promise}

Get an access token using authorization code

Parameters:
Name Type Argument Description
options Object <optional>

oAuth2 parameters and refresh token

Properties
Name Type Argument Description
client_id String <optional>

client id

client_secret String <optional>

client secret

refresh_token String <optional>

refresh token

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

removeMessage(topicId, postId) → {Promise}

Remove message

Parameters:
Name Type Description
topicId Number

Topic ID

postId Number

Post ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

removeTopicMember(topicId, options) → {Promise}

Remove members and invites from topic

Parameters:
Name Type Argument Description
topicId Number

Topic ID

options Object <optional>

Form parameters

Properties
Name Type Argument Description
removeInviteIds[0..N] Number <optional>

Invite ID (invites[x].id in get-topic-details)

removeMemberIds[0..N] Number <optional>

Account ID (accounts[x].id in get-topic-details)

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

requestAuthorization(options)

Redirect users to request Typetalk access

Parameters:
Name Type Argument Description
options Object <optional>

oAuth2 parameters

Properties
Name Type Argument Description
client_id String <optional>

client id

scope String <optional>

scope

redirect_uri String <optional>

redirect uri

See:

searchAccounts(nameOrEmailAddress) → {Promise}

Search accounts

Parameters:
Name Type Description
nameOrEmailAddress String

account.name or e-mail address

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

unfavoriteTopic(topicId) → {Promise}

Unfavorite topic

Parameters:
Name Type Description
topicId Number

Topic ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

unlikeMessage(topicId, postId) → {Promise}

Unlike message

Parameters:
Name Type Description
topicId Number

Topic ID

postId Number

Post ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

updateTopic(topicId, options) → {Promise}

Update topic

Parameters:
Name Type Argument Description
topicId Number

Topic ID

options Object <optional>

Form parameters

Properties
Name Type Argument Description
name String <optional>

Topic Name (not to use in team if team ID is empty string)

[options.teamId Number

Team ID

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

uploadAttachmentFile(topicId, file) → {Promise}

Upload attachment file

Parameters:
Name Type Description
topicId Number

Topic ID

file Binaly

max file size: 10MB

See:
Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise

validateAccessToken() → {Promise}

Validate your access token

Returns:

promise object - It will resolve with response data or fail with error object

Type
Promise