In this 10-minute quick start, you'll upload an audio file for a Talk greeting using the Greetings APIs.

For information on uploading an audio file using the Zendesk Admin Center, see Managing outgoing greetings.

What you'll need

To complete this quick start, you'll need the following:

Creating your audio file

Create your own custom greeting and save it as an encoded MP3 audio file with a maximum file size of 10 MB. Name the greeting myaudio.

For information on supported audio types and maximum file sizes, see Managing outgoing greetings.

Creating the greeting name

The greeting name is the name that appears in the Greetings tab in Admin Center. In this example, the greeting name is mytalkgreeting and is listed under the Hold category.

Use the /api/v2/channels/voice/greeting_categories endpoint to list greeting categories. Your output should looks similar to this, where the Hold category id is 4.

{  "greeting_categories": [    { "id": 1, "name": "voicemail" },    { "id": 2, "name": "available" },    { "id": 3, "name": "wait" },    { "id": 4, "name": "hold" },    { "id": 5, "name": "ivr" },    { "id": 6, "name": "callback" },    { "id": 7, "name": "callback_confirmation" },    { "id": 8, "name": "call_recording_opt_out" },    { "id": 9, "name": "call_recording_opt_in" }  ],  "next_page": null,  "previous_page": null,  "count": 9}

Use the /api/v2/channels/voice/greetings endpoint to create the greeting. Pass it your greeting name and category id.

curl https://{subdomain}.zendesk.com/api/v2/channels/voice/greetings.json \  -H "Content-Type:application/json" \  -d '{"greeting": {"name":"mytalkgreeting", "category_id": 4}}' \  -v -u {email_address}/token:{api_token} \  -X POST

If successful, the response displays the greeting information. Save the greeting id as you'll need it in the next step. In this example, the greeting id is 20682868564759 but yours will be unique to your own implementation.

{   "greeting":{      "id":20682868564759,      "name":"mytalkgreeting",      "category_id":4,      "default":false,      "default_lang":false,      "active":false,      "pending":true,      "audio_url":null,      "audio_name":null,      "upload_id":null,      "phone_number_ids":[],      "ivr_ids":[],      "has_sub_settings":false   }}

Updating the greeting with the audio file

Now update your greeting using the /api/v2/channels/voice/greetings/{greetings_id} endpoint to add the audio file.

curl https://{subdomain}.zendesk.com/api/v2/channels/voice/greetings/{greeting_id} \  -H 'Content-Type: multipart/form-data' \  -F 'greeting[upload_attributes][uploaded_data]=@"{path}/myaudio.mp3"' \  -u {email_address}/token:{api_token} \  -X PUT

If successful, the response displays the updated greeting information.

{   "greeting":{      "id":20682868564759,      "name":"mytalkgreeting",      "category_id":4,      "default":false,      "default_lang":false,      "active":false,      "pending":false,      "audio_url":"/api/v2/channels/voice/greetings/20682868564759/be016fbe3a76a1af0.mp3",      "audio_name":"myaudio.mp3",      "upload_id":null,      "phone_number_ids":[],      "ivr_ids":[],      "has_sub_settings":false   }}

You can also use the /api/v2/channels/voice/greetings/{greetings_id} endpoint to show your greeting.

curl https://{subdomain}.zendesk.com/api/v2/channels/voice/greetings/{greeting_id} \  -u {email_address}/token:{api_token}

Your output should look similar to this:

{  "greeting": {    "active": false,    "audio_name": "myaudio.mp3",    "audio_url": "/api/v2/channels/voice/greetings/20682868564759/be016fbe3a76a1af0.mp3",    "category_id": 4,    "default": false,    "default_lang": false,    "has_sub_settings": false,    "id": 20682868564759,    "ivr_ids": [],    "name": "mytalkgreeting",    "pending": false,    "phone_number_ids": [],    "upload_id": null  }}

If audio_name or audio_url is blank, your update was not successful. Check your syntax and make sure that the path to your audio file is correct.

Verifying the greeting

  1. In Admin Center, click the Channels icon in the sidebar, then select Talk and email > Talk.

  2. Select the Greetings tab.

  3. Scroll to the Hold category and click the Play icon next to mytalkgreeting.

Deleting the greeting

When done, use the /api/v2/channels/voice/greetings/{greetings_id} endpoint to delete the greeting.

curl https://{subdomain}.zendesk.com/api/v2/channels/voice/greetings/{greeting_id} \  -v -u {email_address}/token:{api_token} -X DELETE