Skip to main content

broadcastmesssage

POST v1/application/broadcastmesssage#

With this API, you can send the same text message to multiple customers on behalf of one of your staff members. The message is delivered to the one-to-one conversation between the staff member and each customer.

Sending is performed asynchronously. When the API accepts the request, it starts the sending process and returns a broadcastId to you. You can query the per-customer sending results with this broadcastId using the getbroadcastmesssagestatus API.

API requests

  • Must be authenticated with HMAC Authentication. For HMAC Authentication, see the Authentication document.
  • API URI : https://DIYALOG-SERVER-API-ENDPOINT/v1/application/broadcastmesssage
  • HTTP Request Type POST
  • HTTP Content-Type application/json

Request Body#

Schema
json object
     staffId (String)
      User number, in your system, of the staff member who will send the message. Cannot be empty. The staff member must be registered in the Diyalog system.
     customerIds (String array)
      Customer numbers the message will be sent to. Cannot be empty and can contain at most 50 customer numbers.
     message (String)
      Text message to be sent to the customers.

Example Json Request Body :#

{
"staffId" : "45186",
"customerIds" : ["70021", "70022", "70024"],
"message" : "Merhaba"
}

Responses#

HTTP 200 Response
json object
The API returns a json object as a response. Request validation errors are also returned with HTTP 200, with the isSuccess field set to false.
     isSuccess (boolean)
      Indicates whether the request was accepted.
      true indicates that the request was accepted and the sending process has started. It does not indicate the delivery result to customers.
      false indicates that the request was not accepted due to an error.
     message (String)
      Information message about the result of the operation. Returns "Broadcast process started" for successful requests.
     error (String)
      Optional. Indicates the error code when isSuccess is false. It can take the following values.
                         MAX_PEER_PER_BROADCAST_MESSAGE_EXCEEDED : customerIds contains more than 50 customer numbers.
                         CUSTOMER_IDS_IS_EMPTY_ERROR : customerIds is empty.
                         STAFF_ID_IS_EMPTY_ERROR : staffId is empty.
                         STAFF_NOT_FOUND_IN_SYSTEM : No staff member registered in the Diyalog system was found for the staffId.
     broadcastId (String)
      Optional. Returned when isSuccess is true. The unique id created for your request in the Diyalog system. Use this id in status and detail queries.

Example Response Body :#

{
"isSuccess": true,
"message": "Broadcast process started",
"broadcastId": "b3f0b6c2-6f0e-4a57-9d55-1c7a8e2b9f41"
}

Example Error Response Body :#

{
"isSuccess": false,
"message": "Staff not found in system.",
"error": "STAFF_NOT_FOUND_IN_SYSTEM"
}
HTTP 400 Response
string
If the request body is not valid JSON, a required field is missing, or a field has the wrong type, the API returns a response with the HTTP 400 status code. The error message is returned as text.
HTTP 500 Response
string
When the API encounters a general error, it will return a response with the HTTP 500 status code. The API's error message is returned as text.

If the request fails HMAC validation, the following errors are returned as plain text. See Authentication.

HTTP statusMessageDescription
400Required headers not foundOne or more of the x-dlg-date, x-dlg-requester-userid or x-dlg-authorization headers are missing.
400Authorization failed due to data format not validThe x-dlg-authorization value after DLGA is not in the AccessKeyId:Signature form.
400Date format is invalid. EEE, dd MMM yyyy HH:mm:ss Z is requiedThe x-dlg-date value cannot be parsed in this format. The message text is returned as shown, including its spelling.
401Authorization failedThe x-dlg-authorization header does not contain DLGA , the AccessKeyId is unknown, or the signature is not correct.
401You have no permission on this operation. Contact your admin.The signature is correct, but your access key has no application permission.
403Request time may not be correct.The x-dlg-date value differs from the server time by more than 15 minutes.