InternalThe config object for configuring the Rettiwt instance.
Get the full conversation history for a specific conversation, ordered recent to oldest. Use this to load complete message history for a conversation identified from the inbox.
The ID of the conversation (e.g., "394028042-1712730991884689408").
Optionalcursor: stringThe cursor for pagination. Is equal to the ID of the last message from previous batch.
The conversation with full message history, or undefined if not found.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching a specific conversation
rettiwt.dm.conversation('394028042-1712730991884689408')
.then(conversation => {
if (conversation) {
console.log(`Conversation with ${conversation.participants.length} participants`);
console.log(`${conversation.messages.length} messages loaded`);
}
})
.catch(err => {
console.log(err);
});
Delete a conversation. You will leave the conversation and it will be removed from your inbox.
The ID of the conversation to delete.
A promise that resolves when the conversation is deleted.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Deleting a conversation
rettiwt.dm.deleteConversation('394028042-1712730991884689408')
.then(() => {
console.log('Conversation deleted successfully');
})
.catch(err => {
console.log('Failed to delete conversation:', err);
});
Get your inbox, ordered recent to oldest.
Optionalcursor: stringThe cursor to the inbox items to fetch. Is equal to the ID of the last inbox conversation.
The required inbox. Returns initial inbox if no cursor is provided.
import { Rettiwt } from 'rettiwt-api';
// Creating a new Rettiwt instance using the given 'API_KEY'
const rettiwt = new Rettiwt({ apiKey: API_KEY });
// Fetching the initial DM inbox state
rettiwt.dm.inbox()
.then(inbox => {
console.log(`Found ${inbox.conversations.length} conversations`);
console.log('First conversation:', inbox.conversations[0]);
})
.catch(err => {
console.log(err);
});
Makes an HTTP request according to the given parameters.
The requested resource.
The raw data response received.
import { FetcherService, ResourceType } from 'rettiwt-api';
// Creating a new FetcherService instance using the given 'API_KEY'
const fetcher = new FetcherService({ apiKey: API_KEY });
// Fetching the details of the User with username 'user1'
fetcher.request(ResourceType.USER_DETAILS_BY_USERNAME, { id: 'user1' })
.then(res => {
console.log(res);
})
.catch(err => {
console.log(err);
});
Handles interacting with resources related to direct messages