This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Imports global types | |
import '@twilio-labs/serverless-runtime-types' | |
// Fetches specific types | |
import { | |
Context, | |
ServerlessCallback, | |
ServerlessFunctionSignature, | |
} from '@twilio-labs/serverless-runtime-types/types' | |
import axios, {AxiosResponse} from 'axios' | |
import FormData from 'form-data' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Flex.Manager.getInstance().workerClient.on('reservationCreated', (reservation: Reservation) => { | |
console.log('reservation', reservation) | |
let mediaId = Flex.AudioPlayerManager.play({ | |
url: 'https://api.twilio.com/cowbell.mp3', | |
repeatable: true, | |
}) | |
reservation.on('accepted', () => Flex.AudioPlayerManager.stop(mediaId)) | |
reservation.on('canceled', () => Flex.AudioPlayerManager.stop(mediaId)) | |
reservation.on('completed', () => Flex.AudioPlayerManager.stop(mediaId)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Imports global types | |
import '@twilio-labs/serverless-runtime-types' | |
// Fetches specific types | |
import { | |
Context, | |
ServerlessCallback, | |
ServerlessFunctionSignature, | |
} from '@twilio-labs/serverless-runtime-types/types' | |
type OptOut = { |