Use voice notifications or voice captchas using an API
Voice notifications and voice captchas are sent as phone calls to specified numbers. You can call API operations to send voice notifications or voice captchas.
Usage notes
Use text-to-speech (TTS) templates and voice notification files only after they are approved.
For the same combination of qualification information and number purpose, the following throttling limits apply to calls made to the same number: 1 call per minute, 5 calls per hour, and 20 calls per 24 hours. The 24-hour period starts from the first successful call. Use this feature responsibly. For more information about throttling, see Throttling rules.
Preparations
Register an Alibaba Cloud account. Complete enterprise identity verification. Then, activate Voice Service.
Apply for enterprise qualifications and wait for approval. For more information, see Enterprise Qualification Management.
Apply for a script and wait for approval. A script is required to declare your business scenario. The script content is not used in the voice calls. For more information, see Add a script.
If you use the common pattern for calls (recommended), you do not need to purchase numbers. Alibaba Cloud provides a shared number pool. If you use the exclusive pattern, you must apply for real numbers.
Before you call an API operation, review the API overview to understand the operation and find the required request parameters. If an error occurs after you send a request, look up the error message in the API error codes document.
Workflow
Step 1: Prepare the call content
When you upload a voice file using an API, the exclusive pattern is used by default. If you plan to use the common pattern to initiate a voice call using an API, go to the Voice Service console to apply for call content. For more information, see Create a voice template.
Call content includes TTS templates and voice files. You must apply for call content and wait for it to be approved before you can initiate voice calls. You can apply for content and query the review status in the console.
TTS templates: You cannot create TTS templates by calling an API operation. You must create them in the Voice Service console. For more information, see Create a voice template.
Voice files: You can upload voice files using an API, a software development kit (SDK), or the console. For more information about how to upload files using an API or an SDK, see Upload a voice file using an API.
NoteAfter you upload a voice file, you can call the QueryVoiceFileAuditInfo operation to query the review status. If the file fails the review, check the failure reason and upload the file again.
Step 2: Initiate a voice call
Based on your requirements, call the appropriate API operation to send a voice notification or a voice captcha. Before you call the operation, carefully read the parameter descriptions.
General API operations | API operations for the exclusive pattern only |
|
|
Step 3: Query call details
General API operations | API operations for the exclusive pattern only |
| ListCallTaskDetail: Use the task ID that is returned in Step 2 to view the details for the specified task. |
References
Online API debugging: Visit the OpenAPI Developer Portal to debug API operations online, view complete request parameters, and automatically generate SDK sample code for various languages.
Error code query: If an error is returned when you call an API operation, refer to the API error codes document to troubleshoot the issue.
FAQ: