In this example, we will learn how to use the API to record a voicemail greeting and how to enable voicemail for a source.
1. Record greeting
To create a new voicemail greeting, POST to the voicemail_greetings resource:
POST /customers/407382/voicemail_greetings
name=MyGreeting
{
"voicemail_greetings":[{
"name":"MyGreeting",
"timestamp":"2012-03-14 20:43:17",
"datalength":null,
"locked":"0",
"used_by":[],
"customer_id":"407382",
"vm_greeting_id":"303",
"sounddata":"",
"record_number":"+4618123456",
"record_pin":"8367"
}]
}
Now we've created a voicemail greeting placeholder, but we need to record a greeting message. To record a message, dial the number seen in record_number and enter your pin code, record_pin.
2. Enable voicemail
Once recorded, you will need to enable voicemail for a source:
PUT /sources/219982
vm_greeting_id=303&vm_divert_busy=1&vm_divert_noanswer=1¬ify_on_new_voicemail=1&email=n@c.com
{
"sources":[{
"source_id":"219982",
"name":"test",
"email":"n@c.com",
"smsnumber":null,
"media":null,
"customer_id":"407382",
"phonenr":"+461890510",
"destnr":"+4618921814",
"timestamp":"2012-03-13 23:00:00",
"expire":null,
"created":"2012-03-14 20:56:46",
"modified":"2012-03-14 20:58:09",
"class":"0",
"status":"active",
"vm_greeting_id":"303",
"campaign_id":null,
"publisher_id":null,
"notify_on_missed_call":"0",
"notify_on_new_voicemail":"1",
"vm_divert_all":"0",
"vm_divert_busy":"1",
"vm_divert_noanswer":"1",
"alt_numbers":[]
}]
}
Not only did we enable this source to divert to our previously created voice greeting on busy and no answer, but we also enabled email notifications when someone leaves a new voicemail. Cool, huh?
3. Download greeting
If you want to download your voice greeting, you can GET the voicemail_greetings resource:
GET /customers/407382/voicemail_greetings/303
{
"voicemail_greetings":[{
"name":"MyGreeting",
"timestamp":"2012-03-14 20:51:25",
"datalength":"24192",
"locked":"0",
"used_by":{
"219982":"test"
},
"customer_id":"86931",
"vm_greeting_id":"303",
"sounddata":"........"
}]
}
Congratulations! You've now learned how to create a voicemail greeting and to assign it to a source using the Kaisa API.
Comments
0 comments
Please sign in to leave a comment.