new Chat(opts)
Snapchat wrapper for chat-related API calls.
Parameters:
Name | Type | Description |
---|---|---|
opts |
Object |
- Source:
Methods
-
clearConversationWithIdentifier(identifier, cb)
-
Clears the conversation with the given identifier.
Parameters:
Name Type Description identifier
string The identifier of the conversation to clear.
cb
function - Source:
-
clearFeed(cb)
-
Clears the entire feed.
Parameters:
Name Type Description cb
function - Source:
-
conversationAuth(username, cb)
-
Retrieves the conversation auth mac and payload for a conversation with username.
Parameters:
Name Type Description username
string cb
function - Source:
-
conversationsWithUsers(usernames, cb)
-
Fetches the conversations for all users in \e usernames
Parameters:
Name Type Description usernames
Array.<string> cb
function - Source:
-
conversationWithUser(username, cb)
-
Retrieves the conversation with \e username.
Parameters:
Name Type Description username
string cb
function - Source:
-
loadAllConversations(cb)
-
Loads all conversations into the current session.
This method will update client.session.conversations accordingly.
Parameters:
Name Type Description cb
function - Source:
-
loadConversationsAfter(conversation, cb)
-
Loads another page of conversations in the feed after the given conversation.
This method will update client.session.conversations accordingly.
Parameters:
Name Type Description conversation
Conversation The conversation after which to load more conversations.
cb
function - Source:
-
loadFullConversation(conversation, cb)
-
Loads all messages in the given thread and adds them to that Conversation object.
Parameters:
Name Type Description conversation
Conversation The conversation to load completely.
cb
function - Source:
-
loadMessagesAfterPagination(messageOrTransaction, cb)
-
Loads more messages after the given message or cash transaction.
Parameters:
Name Type Description messageOrTransaction
Transaction | Message any object conforming to Pagination \b EXCEPT AN \C Conversation.
cb
function - Source:
-
markRead(conversation, cb)
-
Marks all chat messages in a conversation as read.
Parameters:
Name Type Description conversation
Conversation cb
function - Source:
- To Do:
-
- currently not working
-
sendMessage(message, username, cb)
-
Sends a message \e message to \e username.
Parameters:
Name Type Description message
string The message to send.
username
Array.<string> The username of the recipient.
cb
function - Source:
-
sendMessageToUsers(message, usernames, cb)
-
Sends a message \e message to each user in \e usernames.
Parameters:
Name Type Description message
string The message to send.
usernames
Array.<string> An array of username strings as recipients.
cb
function - Source:
-
sendTypingToUser(username, cb)
-
Sends the typing notification to a single user.
Parameters:
Name Type Description username
string cb
function - Source:
-
sendTypingToUsers(recipients, cb)
-
Sends the typing notification to the given users.
Parameters:
Name Type Description recipients
Array.<string> An array of username strings.
cb
function - Source: