Installation

Setting up Tickety SDK is a straightforward process designed to integrate seamlessly with your current workflow. Here's how to get started:

Package Installation

No prerequisites or additional dependencies are required. Begin by installing the Tickety SDK with your package manager of choice:

npm install tickety-sdk
yarn add tickety-sdk

Initial Setup

After installation, sign up for a Tickety account and navigate to the dashboard to generate your unique API key. This key is vital for initializing the SDK in your application.

import Tickety from 'tickety-sdk';

const ticket = new Tickety('YOUR_API_KEY');

First Steps

With the SDK initialized, you're ready to start sending and fetching messages right away. Below is a basic guide to sending a message to the Tickety dashboard and fetching messages from a conversation:

const response = await ticket.sendMessage('Your message here', 'USER_AUTH_TOKEN');
if (response.success) {
  console.log('Message sent successfully');
} else {
  console.error('Failed to send message:', response.error);

const messages = await ticket.fetchMessage('USER_AUTH_TOKEN');
if (messages.success) {
  console.log('Messages fetched successfully', messages.data);
} else {
  console.error('Failed to fetch messages:', messages.error);

Real-time Updates

To keep your application up-to-date with the latest interactions, Tickety SDK's current version suggests implementing a polling strategy. Here's a quick example of how you can poll for new messages every 5 seconds:

function pollForUpdates() {
  setInterval(async () => {
    const updates = await tickety.fetchMessage('yourAuthToken', { ticketId:'yourTicketId'; });
    if (updates.success && updates.data.length > 0) {
      console.log('New updates: ', updates.data);
      // Refresh your UI with the new updates
    }
  }, 5000);
}

We are actively working on integrating real-time messaging directly into the SDK to provide a more dynamic user experience.

Next Steps

After successfully integrating Tickety SDK into your project, explore the rest of the documentation to learn more about advanced features and customization options. If you encounter any issues or have questions, please refer to our FAQs or reach out to our support team.