Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fazlurr/09bb2a30f6e620cf0fcebe90fb2156d7 to your computer and use it in GitHub Desktop.
Save fazlurr/09bb2a30f6e620cf0fcebe90fb2156d7 to your computer and use it in GitHub Desktop.
Documentation on how to send outbound message in Qiscus Multichannel via REST API

Send Outbound Message

Send individual message

Verb

POST https://multichannel.qiscus.com/api/v3/admin/broadcast/client

Parameters

Name Type In Description
Content-Type string header Must be application/json
Qiscus-App-Id string header Your App ID. Can be found at App Information on Settings page
Qiscus-Secret-Key string header Your Qiscus-Secret-Key. Can be found at App Information on Settings page. Please note, you must keep this key secret. Only use it from your server side
channel_id integer body Your Whatsapp channel id. Can be found in "Broadcast Template Detail" page
name string body Name of broadcast
template_name string body Template name that will be used to in the broadcast. Can be found in "Broadcast Template Detail" page
template_detail_id integer body Template id that will be used to in the broadcast. Can be found in "Broadcast Template Detail" page
namespace string body Template namespace that will be used to in the broadcast. Can be found in "Broadcast Template Detail" page
language string body Template language that will be used to in the broadcast. Can be found in "Broadcast Template Detail" page
variables array of string body Variables that has been defined in your template. Can be found in "Broadcast Template Detail" page
phone_number string body The recipient that you want to send the broadcast. Use E164 format without "+"
started_at datetime string body Use this parameter if you want to schedule the broadcast. Use ISO 8601 format
button_params array of object body If your template has buttons, you can use this parameter

Sample Request

curl --location --request POST 'https://multichannel.qiscus.com/api/v3/admin/broadcast/client' \
--header 'Qiscus-App-Id: your-app-id' \
--header 'Qiscus-Secret-Key: your-secret-key' \
--header 'Content-Type: application/json' \
--data-raw '{
    "channel_id": 534,
    "name": "Test Broadcast",
    "template_name": "invoince_update",
    "template_detail_id": 172,
    "namespace": "6616bb93_d895_41e7_8bbe_2c528219e56e",
    "language": "id",
    "variables": [
        "Nurcholis",
        "Rp. 30.000",
        "10 Maret 2022"
    ],
    "phone_number": "6281527975868",
    "button_params": [
        {
            "type": "url",
            "values": "coba",
            "index": 0
        }
    ],
    "started_at": "2022-03-05T10:15:00.000Z"
}'

Sample Response

{
    "data": {
        "broadcast_job_id": 14528583,
        "broadcast_logs": [
            {
                "id": 25702462,
                "message_id": null,
                "notes": null,
                "phone_number": "6281527975868",
                "sent_at": "2022-03-05T10:15:00Z",
                "status": "scheduled",
                "variables": "[\"Nurcholis\",\"Rp. 30.000\",\"10 Maret 2022\"]"
            }
        ],
        "language": "id",
        "name": "invoince_update",
        "namespace": "6616bb93_d895_41e7_8bbe_2c528219e56e"
    },
    "status": 200
}

Send bulk message (broadcast)

Sending bulk message to recipients will be done by uploading the CSV file and sending the message. You can send messages up to 1000 recipients at one time.

Upload file

Verb

POST https://multichannel.qiscus.com/api/v3/admin/broadcast/upload_csv

Parameters

Name Type In Description
Content-Type string header Must be multipart/form-data
Qiscus-App-Id string header Your App ID. Can be found at App Information on Settings page
Qiscus-Secret-Key string header Your Qiscus-Secret-Key. Can be found at App Information on Settings page. Please note, you must keep this key secret. Only use it from your server side
file binary csv file body Your csv file that contain all of your recipients and variables. Must be follow Template schema. Sample of csv of your template can be downloaded via Broadcast Page.
template_detail_id integer body Template id that will be used to in the broadcast. Can be found in "Broadcast Template Detail" page
separator string body Your csv separator. Can be "," or ";"

Sample request

curl --location --request POST 'https://multichannel.qiscus.com/api/v3/admin/broadcast/upload_csv' \
--header 'Qiscus-App-Id: your-app-id' \
--header 'Qiscus-Secret-Key: your-secret-key' \
--form 'file=@"/home/nurcholisart/Videos/csv_broadcast_template.csv"' \
--form 'template_detail_id="172"' \
--form 'separator=","'

Sample response

{
    "broadcast_file_id": 2272837,
    "current_balance": {
        "credits": "0",
        "free_session": 1000,
        "quota": 857
    },
    "estimation_charge": {
        "credit": 0,
        "free_session": 1,
        "quota": 0
    }
}

Send Broadcast

Verb

POST https://multichannel.qiscus.com/api/v3/admin/broadcast/send_broadcast

Parameters

Name Type In Description
Content-Type string header Must be multipart/form-data
Qiscus-App-Id string header Your App ID. Can be found at App Information on Settings page
Qiscus-Secret-Key string header Your Qiscus-Secret-Key. Can be found at App Information on Settings page. Please note, you must keep this key secret. Only use it from your server side
template_detail_id integer body Template id that will be used to in the broadcast. Can be found in "Broadcast Template Detail" page
broadcast_file_id integer body Your broadcast file id that has been uploaded before
name string body Name of broadcast
separator string body Your csv separator. Can be "," or ";"
started_at datetime string body Use this parameter if you want to schedule the broadcast. Use ISO 8601 format

Sample request

curl --location --request POST 'https://multichannel.qiscus.com/api/v3/admin/broadcast/send_broadcast' \
--header 'Qiscus-App-Id: your-app-id' \
--header 'Qiscus-Secret-Key: your-secret-key' \
--header 'Content-Type: application/json' \
--data-raw '{
    "template_detail_id": 172,
    "broadcast_file_id": 2272836,
    "name": "Test Cholis 3",
    "separator": ",",
    "started_at": "2022-03-05T11:59:00.000Z"
}'

Sample response

{
  "data": {
    "broadcast_job": {
      "canceled_at": null,
      "canceled_by": null,
      "channel_id": 534,
      "channel_name": "Qiscus Sandbox 3",
      "created_at": "2022-03-05T11:01:18",
      "id": 14529081,
      "language": "id",
      "name": "Test Cholis 3",
      "started_at": "2022-03-05T11:59:00Z",
      "status": 4,
      "template_detail_id": 172,
      "template_id": 191,
      "template_name": "invoince_update",
      "total_failed": null,
      "total_read": null,
      "total_received": null,
      "total_recipient": 1,
      "total_sent": null,
      "user": {
        "name": "Alena"
      }
    }
  },
  "status": 200
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment