Class CallService

Handles interacting with resources related to X Calls.

Hierarchy (View Summary)

Constructors

Properties

config: RettiwtConfig

The config object.

Methods

  • Get the shared calendar (busy slots) of a user, to find a time to meet with them.

    Parameters

    • id: string

      The ID of the target user.

    • Optionalfrom: Date

      The start of the time window. Defaults to now.

    • Optionalto: Date

      The end of the time window. Defaults to 7 days after from.

    Returns Promise<undefined | ScheduledCall[]>

    The busy slots of the user, or undefined if the user does not share their calendar.

    import { Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    rettiwt.call.availability('1234567890')
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Get the list of external calendars (Google, Outlook) linked to X Calls.

    Returns Promise<CalendarLink[]>

    The list of linked calendars.

    import { Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    rettiwt.call.calendars()
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Cancel a scheduled call.

    Parameters

    • id: string

      The ID of the scheduled call to cancel.

    • Optionaloptions: ICallOccurrenceOptions

      The occurrence(s) to cancel, for recurring calls, and whether to notify the guests by email.

    Returns Promise<boolean>

    Whether the cancellation was successful.

    import { CallRecurrenceScope, Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    // Cancelling a whole recurring series and notifying the guests
    rettiwt.call.cancel('1234567890', { scope: CallRecurrenceScope.ALL, emailGuests: true })
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Create a call link to use later.

    Parameters

    • OptionalaudioOnly: boolean

      Whether the call is audio-only.

    Returns Promise<undefined | string>

    The ID of the created call.

    import { Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    rettiwt.call.create()
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Customize how a scheduled call appears in the calendar of the logged-in user.

    Parameters

    • id: string

      The ID of the scheduled call to customize.

    • customization: ICallCustomization

      The color and/or visibility to apply. Replaces the previous customization.

    • Optionaloptions: ICallOccurrenceOptions

      The occurrence(s) to customize, for recurring calls.

    Returns Promise<boolean>

    Whether the customization was successful.

    import { CalendarColor, Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    rettiwt.call.customize('1234567890', { color: CalendarColor.PURPLE })
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Get the calendar of the logged-in user, including scheduled calls, holidays and events from linked calendars.

    Parameters

    • Optionalfrom: Date

      The start of the time window. Defaults to now.

    • Optionalto: Date

      The end of the time window. Defaults to 7 days after from.

    Returns Promise<ScheduledCall[]>

    The occurrences of the events within the time window, sorted by start time.

    import { Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    // Fetching the calls of October 2026
    rettiwt.call.list(new Date('2026-10-01'), new Date('2026-11-01'))
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Sync the linked external calendars and get their events.

    Parameters

    • Optionalfrom: Date

      The start of the time window. Defaults to now.

    • Optionalto: Date

      The end of the time window. Defaults to 7 days after from.

    Returns Promise<ScheduledCall[]>

    The occurrences of the events of the linked calendars within the time window.

    import { Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    rettiwt.call.refreshCalendars()
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Set the reminder of a scheduled call, for the logged-in user.

    Parameters

    • id: string

      The ID of the scheduled call.

    • minutes: number

      The number of minutes before the call at which to be reminded (0 to 10080).

    • Optionaloptions: ICallOccurrenceOptions

      The occurrence(s) to set the reminder for, for recurring calls.

    Returns Promise<boolean>

    Whether the reminder was set successfully.

    import { Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    rettiwt.call.remind('1234567890', 15)
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Makes an HTTP request according to the given parameters.

    Type Parameters

    • T = unknown

      The type of the returned response data.

    Parameters

    Returns Promise<AxiosResponse<T, any, {}, any>>

    The raw Axios response.

    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);
    });
  • Respond to a scheduled call invitation.

    Parameters

    • id: string

      The ID of the scheduled call.

    • status: CallRsvpStatus

      The response to the invitation.

    • Optionaloptions: ICallOccurrenceOptions

      The occurrence(s) to respond to, for recurring calls.

    Returns Promise<boolean>

    Whether the response was successful.

    import { CallRsvpStatus, Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    rettiwt.call.rsvp('1234567890', CallRsvpStatus.ACCEPTED)
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Schedule a new call.

    Parameters

    • call: INewCall

      The details of the call to schedule.

    Returns Promise<undefined | string>

    The ID of the scheduled call.

    import { Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    // Scheduling a weekly 30 minutes call with a given user
    rettiwt.call.schedule({
    title: 'Weekly sync',
    startsAt: new Date('2026-10-15T10:00:00Z'),
    duration: 30,
    inviteeIds: ['1234567890'],
    recurrence: 'FREQ=WEEKLY;BYDAY=TH',
    })
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Search for people to invite to a call.

    Parameters

    • query: string

      The name or username to search for.

    • Optionalcount: number

      The maximum number of users to fetch. Defaults to 8.

    Returns Promise<CallUser[]>

    The list of matching users. Only users with canInvite set to true can be invited.

    import { Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    rettiwt.call.search('elonmusk')
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Unlink an external calendar from X Calls.

    Parameters

    Returns Promise<boolean>

    Whether the calendar was unlinked successfully.

    import { CalendarProvider, Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    rettiwt.call.unlinkCalendar(CalendarProvider.GOOGLE)
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });
  • Update a scheduled call.

    Parameters

    • id: string

      The ID of the scheduled call to update.

    • updates: ICallUpdates

      The updates to apply. Only the given fields are updated.

    • Optionaloptions: ICallOccurrenceOptions

      The occurrence(s) to update, for recurring calls, and whether to notify the guests by email.

    Returns Promise<boolean>

    Whether the update was successful.

    import { Rettiwt } from 'rettiwt-api';

    const rettiwt = new Rettiwt({ apiKey: API_KEY });

    // Moving a call one hour later
    rettiwt.call.update('1234567890', { startsAt: new Date('2026-10-15T11:00:00Z') }, { emailGuests: true })
    .then(res => {
    console.log(res);
    })
    .catch(err => {
    console.log(err);
    });