Prerequisites
- Access credentials (Secret key and User ID)
- Development environment for your chosen programming language
Steps
1
Set Up Environment Variables
Add your API key and user ID to your environment variables.
2
Configure API Access
Create a script with the following authentication setup for your chosen language:
3
Submit TTS Job
Create and submit your TTS job in your chosen language:
4
Poll Job Status
Monitor your job’s progress in your chosen language:
5
Download and Save Audio
Save the generated audio file in your chosen language:
Complete Code
Troubleshooting
If you encounter issues, check these common problems:-
Authentication Issues:
- Verify your API key and user ID
- Confirm the
AUTHORIZATION
header includes “Bearer ” prefix
-
Job Status Polling:
- Ensure you’re using the correct job ID
- Check that the polling URL is properly formatted
- Verify the polling interval is appropriate for your use case
-
API Endpoint Errors:
- Verify the correct PlayAI’s Dialog 1.0 API endpoint URL
- Confirm the model name is correct
- Check that all required parameters are included in the request
-
Language-Specific Issues:
- JavaScript: Ensure
node-fetch
is installed for Node.js environments - Go: Check for proper error handling and response body closing
- Dart: Verify the
http
package is added to yourpubspec.yaml
- Swift: Make sure you’re running on macOS for file system access
- JavaScript: Ensure