Send a Voice message

Home » DOCOON APIs » REST API » Basic functionnalities » Send a Voice message

To simplify job creation, Docoon REST API provides to you a specific resource per media. For Voice jobs only the resource is called “VoiceJobs”.

We will review how to send quickly a Voice with one recipient or many recipients. We will also review the Voice advanced parameters and the text to speech personnalisation of the voice message.

When the Voice job request is accepted, you will get a jobNumber, it means a job was accepted and was put in the appropriate queue (depending on your priority defined in your contract), we will send the message to each recipient as soon as possible depending of the current traffic.

When the job is finished, you will be able to check the transmission status of each recipient, check “Get transmission reports” easy worflow for more information.

Send Voice request informations

Name: /VoiceJobs
Type: POST

Headers:

Name Value
Authorization Value : Authorization token check : Connect to REST API
Content-Type Value : application/json

 

Parameters list:

Parameter Type Description
JobType String JobType you want to use (‘Vocal’ for Voice message sending).
TrackingID String (Optional) String of your choice, as a reference for the job (shown in the summary and in your billing).
LaunchType Integer (Optional) Choose your type of sending 0 = Send your message , 1 = Do a proof , 2 = Do a preview.
ScheduledStartTime String (Optional) Choose a date to schedule your job.Example : ‘2017-06-08T03:50:25.355Z’
Documents List of FileReference List of FileReference: used to define documents to transmit to each recipient.
Document format accepted for Voice message: .txt, .mp3, .wav.
The text files will be converted by our text to speech engine before the sending. You can use text personalisation with text file.
AdhocRecipients List of AdhocRecipients (Optional can be replace by List File)
List of AdhocRecipients: List of the recipients for the sending, see below for the AdhocRecipients Structure.
Lists List of FileReference (Optional can be replace by AdhocRecipients)
List of FileReference: Used for the recipient list.
List format: .xlsx, .xls, .csv, .tab.
your list should at least contained the phone number in the first column (default setting), then it is up to you to fill the other column.
Parameter VoiceParameter Avanced parameters for Voice message sending (see below).

 

Structure details of AdhocRecipients

This Object is used to list your recipient in the “AdhocRecipients”

Parameter Type Description
Name String Name or Id of your recipient.
Address String Address/Phone number of your recipient.
OptionalFields List of String List of additionnal information of your recipient (Last Name, Birth date, Country, …) .
The first 5 items of the list will be included in the reports.
It is also possible to use these elements to personalize the messages.
If you want to add the first item of this list use ‘BCF3 (then ‘BCF4, 5 etc..).
`BCF1 = Value inserted into the field “Address” and `BCF2 = Value inserted into the field “Name”.

 

Structure details of FileReference

The object File Reference is used for both list and documents, The structure is the same but you have to select the right “Type” depending of your document.

Parameter Type Description
Name String Name of the file with extension (abc.txt).
Content String FileEncoded in BASE64
Hosted Boolean (optional) True: if the file is hosted in your list of document (Docoon hosted document), False: if not.
MimeType String (Optional) If the file’s MIME type is defined, it will be used for sending email. Else, the system will associate a MIME type based on the file extension.
Type Integer Sect your document type :
0 = List
1 = Document
2 = Body (specific email)
3 = AltBody (specific email)
4 = Attachment (specific email)
Send Basic Voice message
{
  "JobType": "Vocal",
  "TrackingId": "Send Basic Voice message",
  "Documents": [
    {
      "Name": "Test.txt",
      "Type":1,
      "Content": "VGhpcyBpcyBhIHZvaWNlIG1lc3NhZ2U="
    }
  ],
  "AdhocRecipients": [
	{
      "Name": "Dupont",
      "Address": "00336xxxxxx"
    }
  ]
}

Voice advanced parameters description

In addition to the parameters presented above, there are advanced parameters allowing to configure specific parameters to Voice sending (Text to speech speed, Test to speech voice, sender, scenario, …).

Parameter Type Description
Media Integer Type of media used
2: Voice (Always this value for Voice sending).
TextToSpeechVoiceRate Integer This parameter allows you to fix the pronouncement speed of the text to speech engine. The value can be fixed between -10 and 10.
TextToSpeechVoiceId Integer This parameter allows you to fix the voice used by the text to speech engine. (check the Text To Speech voice in the FAQ).
ScenarioId Integer This parameter allows you to fix the scenario used during the call (check the voice scenario in the FAQ).
Sender String This parameter allows you to fix the number displayed to the recipient. The sender must be a phone number.
AcknowledgeKey String This parameter allows you to fix the key to press to acknowledge the message.
The key can be 1, 2, 3, 4, 5, 6, 7, 8, 9 and *.
This option is not available on all scenarios (check the voice scenario in the FAQ).
RepeatKey String This parameter allows you to fix the key to press to repeat the message.
The key can be 1, 2, 3, 4, 5, 6, 7, 8, 9 and *.
This option is not available on all scenarios (check the voice scenario in the FAQ).
TransferKey String This parameter allows you to fix the key to press to transfer the call to the phone number difined by TransferNumber parameter .
The key can be 1, 2, 3, 4, 5, 6, 7, 8, 9 and *.
This option is not available on all scenarios (check the voice scenario in the FAQ).
TransferNumber String This parameter allows you to fix the phone number used during the call transfer.
Use advanced parameters
{
  "JobType": "Vocal",
  "TrackingId": "Send Voice message with advanced parameters",
  "Documents": [
    {
      "Name": "Test.txt",
      "Type":1,
      "Content": "VGhpcyBpcyBhIHZvaWNlIG1lc3NhZ2U="
    }
  ],
  "AdhocRecipients": [
	{
      "Name": "Dupont",
      "Address": "00336xxxxxx"
    }
  ],
  "Parameter": {
    "Sender": "0612XXXXXX",
    "TextToSpeechVoiceRate": 5,
    "TextToSpeechVoiceId": 7,
    "ScenarioId": 1,
    "TransferNumber": "0612XXXXXX",
    "TransferKey": "3",
    "RepeatKey": "1",
    "AcknowledgeKey": "2",
    "Media": 2 
  }
}

 

Send a Voice message using a file list

You can also use a file list for your recipient. You will have to replace the “AdhocRecipients” list by a “Lists” of File Reference (see the structure below). List format accepted : .xlsx, .xls, .csv, .tab.

By Default, the phone number should be in the first column of the first (and only) sheets of your file.
The other columns can be used for personalizations.

Use file list
{
  "JobType": "Vocal",
  "TrackingId": "Send Voice message with file list",
  "Documents": [
    {
      "Name": "Test.txt",
      "Type":1,
      "Content": "VGhpcyBpcyBhIHZvaWNlIG1lc3NhZ2U="
    }
  ],
  "Lists": [
    {
      "Name": "test.tab",
      "Type":0,
      "Content": "77u/MDAzMzc4Tg3OA=="
    }
  ]
}

Sucessful response

Status: 200 : OK

Parameters list:

Parameter Type Description
JobNumber int ID of the job created
Sucessful Sending
{
  "JobNumber": 44608862
}

Error response

Status: 400: Bad request

Parameter Type Description
Message String Specification of the problem.
ModelState list of job List of job (String error).
Error in the Sending
{
  "Message": "The request is invalid.",
  "ModelState": {
    "job": [
      "An error has occurred."
    ]
  }
}

More Usage Examples

Message personalization

You can personalize your Voice message (only with text documents) using “`BCFX” values. X being the position of the data you want to send.
For Adhoc sending, `BCF1 is the Address or Phone number, `BCF2 is the Name, `BCF3 the first optional field, `BCF4 the second optional field, …
For List sending, the number is the position in the column. `BCF1 is the first column (usually the phone number), `BCF2 is the second column, …

In the following AdHoc Sample,
We use the text : “Hi `BCF2, Are you from `BCF3 ?”
the resulting test of the 1st Recipient will be : “Hi Dupont, Are you from Company A ?”.
the resulting test of the 2nd Recipient will be : “Hi James, Are you from Company B ?”.

Personalization using Adhoc
{
  "JobType": "Vocal",
  "TrackingId": "Send Voice message with personalization",
  "Documents": [
    {
      "Name": "Test.txt",
      "Type":1,
      "Content": "SGkgYEJDRjIsIEFyZSB5b3UgZnJvbSBgQkNGMyA/"
    }
  ],
  "AdhocRecipients": [
    {
      "Name": "Dupont",
      "Address": "00337xxxxxx",
      "OptionalFields": [
        "Company A"
      ]
    },
	{
      "Name": "James",
      "Address": "00336xxxxxx",
      "OptionalFields": [
        "Company B"
      ]
    }
  ]
}

Scheduled job

Use the “ScheduledStartTime” value to delay your sending.
In our example you will send a message the 1st of January 2019.

Scheduled job
{
  "JobType": "Vocal",
  "TrackingId": "Send scheduled Voice message",
  "ScheduledStartTime": "2019-01-01T00:00:00.688Z", 
  "Documents": [
    {
      "Name": "Test.txt",
      "Type":1,
      "Content": "VGhpcyBpcyBhIHZvaWNlIG1lc3NhZ2U="
    }
  ],
  "AdhocRecipients": [
	{
      "Name": "Dupont",
      "Address": "00336xxxxxx"
    }
  ]
}