# Line Broadcast

**Penjelasan komponen :**

| Nama Field    | Deskripsi                                                                                                                                                                                                     | Required                                      |
| ------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------- |
| Authorization | Token id yang tergenerate                                                                                                                                                                                     | Ya                                            |
| name          | Nama dari broadcast Anda                                                                                                                                                                                      | Ya                                            |
| channel       | Channel id dari channel yang Anda gunakan                                                                                                                                                                     | Ya                                            |
| sendingMode   | <p>Metode pengiriman yang akan Anda gunakan. Saat ini ada 2 mode pengiriman, yaitu : pengiriman langsung (now) dan pengiriman terjadwal (scheduled).</p><p></p><p>Possible value: <em>Now, Scheduled</em></p> | Ya                                            |
| scheduledDate | <p>Tanggal dan waktu yang dijadwalkan untuk mengirim broadcast.</p><p></p><p>Format field: "yyyy-mm-dd hh:mm:sss"</p>                                                                                         | Ya, saat mode pengiriman adalah *'Scheduled'* |
| templateId    | Id template yang ingin Anda gunakan untuk broadcast Anda.                                                                                                                                                     | <p>Tidak</p><p></p>                           |
| recipient     | recipient id Anda                                                                                                                                                                                             | Tidak                                         |
| content       | <p>Konten dari pesan broadcast Anda.</p><p></p><p>Catatan : Untuk Channel Line jumlah konten maksimal yang dapat dikirim dalam satu broadcast adalah 5.</p>                                                   | Ya                                            |

### Send Broadcast Text

| Method     | POST                                                  |
| ---------- | ----------------------------------------------------- |
| Media Type | application/json                                      |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast&#xD; |
| Header     | Authorization: Bearer \[generatedToken]               |

#### Body :

```
{
    "name":"your-broadcast-name",
    "channel":"channel-used-for-broadcast",
    "sendingMode":"sending-mode",
    "scheduledDate":"2021-01-01 23:30:334", 
    "content" : [
        { 
        "type" : "text", 
        "message": "First broadcast" 
      } 
    ]
}
```

#### Response : 200

```
{
  "status": "success",
  "data": {
    "id": "[broadcast-id]"
  },
  "message": "Successfully make Broadcast Item",
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}
```

### Send Broadcast Image

| Method     | POST                                                  |
| ---------- | ----------------------------------------------------- |
| Media Type | application/json                                      |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast&#xD; |
| Header     | Authorization : Bearer \[generatedToken]              |

#### Body :

```
{
    "name":"your-broadcast-name",
    "channel":"channel-used-for-broadcast",
    "sendingMode":"sending-mode",
    "scheduledDate":"2021-01-01 23:30:334", 
    "content" : [
      {
        "type": "image",
        "url": "your-url-for-video", | url https, format jpg/png
      },
    ]
}
```

#### Response : 200

```
{
  "status": "success",
  "data": {
    "id": "[broadcast-id]"
  },
  "message": "Successfully make Broadcast Item",
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}
```

### Send Broadcast Video

| Method     | POST                                                  |
| ---------- | ----------------------------------------------------- |
| Media Type | application/json                                      |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast&#xD; |
| Header     | Authorization : Bearer \[generatedToken]              |

#### Body :

```
{
    "name":"your-broadcast-name",
    "channel":"channel-used-for-broadcast",
    "sendingMode":"sending-mode",
    "scheduledDate":"2021-01-01 23:30:334", 
    "content" : [
      {
            "type": "video",
            "url": "your-url-for-video", | url https, format mp4
            "thumbnailUrl" : "your-url-for-thumbnail"
        }
    ]
}
```

#### Response : 200

```
{
  "status": "success",
  "data": {
    "id": "[broadcast-id]"
  },
  "message": "Successfully make Broadcast Item",
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}
```

### Create Multiple Broadcast

Multiple broadcast memungkinkan Anda membuat lebih dari satu broadcast sekaligus.

| Method     | POST                                                                                                                                          |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
| Media Type | application/json                                                                                                                              |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast/multiple&#xD;[&#xD;](https://venom.3dolphins.ai:9443/dolphin/apiv1/graph/broadcast/multiple) |
| Header     | Authorization : Bearer \[generatedToken]                                                                                                      |

#### Body :

```
[ 
*code untuk request broadcast pertama 
{ 
"name":"your-broadcast-name", 
"channel":"channel-used-for-broadcast", 
"sendingMode":"sending-mode" Values: "Now" | "Scheduled"
"scheduledDate":"2021-01-01 23:30:334", | *Required saat sendingMode adalah Scheduled 
"content" : [ 
     { 
        "type" : "text", 
        "message": "First broadcast" 
      } 
   ] 
},
*code untuk request broadcast kedua
{ 
"name":"your-broadcast-name", 
"channel":"channel-used-for-broadcast", 
"sendingMode":"sending-mode" Values: "Now" | "Scheduled"
"scheduledDate":"2021-01-01 23:30:334", | *Required saat sendingMode adalah Scheduled 
"content" : [ 
     { 
        "type" : "text", 
        "message": "Second broadcast" 
      } 
   ] 
}
]
```

#### Response

Response status : 200

```
{
  "status": "success",
  "data": [
    {
      "id": "[id]",
      "message": "Successfully make Broadcast Item",
      "status": "success"
    },
     {
      "id": "[id]",
      "message": "Successfully make Broadcast Item",
      "status": "success"
    }
  ],
  "hasMore": false,
  "nextIndex": 0,
  "prevIndex": 0,
  "totalResults": 0
}
```

### Get Broadcast detail by ID

| Method     | GET                                                                                                                                         |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| Media Type | application/json                                                                                                                            |
| URL        | https\://\[server]/dolphin/apiv1/graph/broadcast/detail&#xD;[&#xD;](https://venom.3dolphins.ai:9443/dolphin/apiv1/graph/broadcast/multiple) |
| Header     | <p>Authorization : Bearer \[generatedToken]</p><p>Broadcast id: \[broadcast id]</p>                                                         |

#### Response

Response status : 200

```
{
    "status": "success",
    "data": {
        "id": "your-broadcast-id",
        "spell": [
            "New Notification",
            "{\"header\":[],\"body\":[{\"type\":\"static\",\"key\":\"{{1}}\",\"value\":\"{value}\"},{\"type\":\"static\",\"key\":\"{{2}}\",\"value\":\"{value}\"}]}"
        ],
        "owner": "owner-id",
        "createdDate": 1614657234000,
        "createdBy": "created-by-id",
        "modifiedDate": 1614657340548,
        "modifiedBy": "system",
        "templateId": "template-id",
        "actionDate": 1614657339000,
        "name": "New Notification",
        "message": "{\"header\":[],\"body\":[{\"type\":\"static\",\"key\":\"{{1}}\",\"value\":\"{value}\"},{\"type\":\"static\",\"key\":\"{{2}}\",\"value\":\"{value}\"}]}",
        "recipient": [
            "{\"type\":\"contact\",\"id\":\"{recipient-id}\",\"phone\":\"{phone-number}\",\"selected\":true}"
        ],
        "status": "Sent",
        "channel": "your-channel-id",
        "channelType": "your-channel-type",
        "sendingMode": "Now",
        "scheduledDate": 1614657339000,
        "scheduledTime": "10:55"
    },
    "hasMore": false,
    "nextIndex": 0,
    "prevIndex": 0,
    "totalResults": 0
}
```
