Nachricht senden
Entwickler können über die API gezielt Nachrichten an bestimmte Konversationen senden.
Anfragemethode
POST
Anfrage-URL
https://livedesk-api.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages
Authentifizierung
Weitere Informationen zur Authentifizierung finden Sie in der API-Übersicht.
Textnachricht über die API senden
Beispielanfrage
curl -X POST 'https://livedesk-api.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic base64(api_key:api_secret)' \
-d '{
"content": "Agent sendet Nachricht, ist das normal?",
"private": false,
"content_attributes": {
"in_reply_to": 29
}
}'
curl -X POST 'https://livedesk-api.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic base64(api_key:api_secret)' \
-d '{
"content": "Agent sendet Nachricht, ist das normal?",
"private": false,
"content_attributes": {
"in_reply_to": 29
}
}'
Diesen Codeblock im schwebenden Fenster anzeigen
Anfrage-Header
| Feld | Typ | Beschreibung |
|---|---|---|
| Authorization | string | Verwenden Sie zur Authentifizierung Authorization: Basic base64(API Key:API Secret). Den API Key und das API Secret finden Sie auf der API-Key-Seite. Verbinden Sie beide mit einem Doppelpunkt und kodieren Sie sie anschließend in Base64. |
| Content-Type | application/json | Datentyp, für reine Textnachrichten verwenden Sie application/json. |
Pfadparameter
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
| conversation_id | string | Ja | Konversations-ID. |
Anfrage-Body-Parameter
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
| content | String | Ja | Nachrichteninhalt. |
| private | Boolean | Nein | Gibt an, ob es sich um eine private Nachricht handelt. Standardwert: false. |
| content_attributes | Object | Nein | Inhaltsattribute, z. B. beim Antworten auf eine Nachricht das Feld in_reply_to angeben. |
Beispiel für Textantwort
Erfolgreiche Antwort
{
"id": 3030,
"content": "Agent sendet Nachricht, ist das normal?",
"inbox_id": 79,
"conversation_id": 141,
"message_type": 1,
"content_type": "text",
"status": "sent",
"content_attributes": {},
"created_at": 1762331029,
"private": false,
"source_id": null,
"sorting_id": 4,
"sender": {
"id": 3,
"name": "TEST",
"available_name": "TEST",
"avatar_url": "",
"type": "user",
"availability_status": "offline",
"thumbnail": ""
}
}
{
"id": 3030,
"content": "Agent sendet Nachricht, ist das normal?",
"inbox_id": 79,
"conversation_id": 141,
"message_type": 1,
"content_type": "text",
"status": "sent",
"content_attributes": {},
"created_at": 1762331029,
"private": false,
"source_id": null,
"sorting_id": 4,
"sender": {
"id": 3,
"name": "TEST",
"available_name": "TEST",
"avatar_url": "",
"type": "user",
"availability_status": "offline",
"thumbnail": ""
}
}
Diesen Codeblock im schwebenden Fenster anzeigen
Antwortparameter
| Feld | Typ | Beschreibung |
|---|---|---|
| id | Int | Nachrichten-ID. |
| content | String | Nachrichteninhalt. |
| inbox_id | Int | Posteingangs-ID. |
| conversation_id | Int | Konversations-ID. |
| message_type | Int | Nachrichtentyp. |
| content_type | String | Inhaltstyp. |
| status | String | Nachrichtenstatus, z. B. „sent“, „delivered“ usw. |
| content_attributes | Object | Inhaltsattribute. |
| created_at | Int | Zeitstempel der Erstellung der Nachricht. |
| private | Boolean | Gibt an, ob es sich um eine private Nachricht handelt. |
| source_id | Int | Quell-ID. |
| sorting_id | Int | Sortier-ID. |
| sender | Object | Informationen zum Absender. |
| ├─ id | Int | Absender-ID. |
| ├─ name | String | Name des Absenders. |
| ├─ available_name | String | Anzeigename des Absenders. |
| ├─ avatar_url | String | Avatar-URL des Absenders. |
| ├─ type | String | Typ des Absenders (z. B. user). |
| ├─ availability_status | String | Online-Status des Absenders (z. B. offline). |
| └─ thumbnail | String | Thumbnail des Absenders. |
Bild-/Audio-/Dateianfrage über die API senden
Beispielanfrage
curl -X POST "https://livedesk.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages" \
-H "Authorization: Basic base64(api_key:api_secret)" \
-F "attachments[]=@/path/to/your/file.jpg" \
-F "content=Detailliertes Bild wie folgt"
curl -X POST "https://livedesk.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages" \
-H "Authorization: Basic base64(api_key:api_secret)" \
-F "attachments[]=@/path/to/your/file.jpg" \
-F "content=Detailliertes Bild wie folgt"
Diesen Codeblock im schwebenden Fenster anzeigen
Pfadparameter
| Feld | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
| conversation_id | string | Ja | Konversations-ID. |
Beispiel für Bild-/Audio-/Dateiantwort
Erfolgreiche Antwort
{
"id": 3031,
"content": "Detailliertes Bild wie folgt",
"inbox_id": 79,
"conversation_id": 141,
"message_type": 1,
"content_type": "text",
"status": "sent",
"content_attributes": {},
"created_at": 1762331762,
"private": false,
"source_id": null,
"sorting_id": 5,
"sender": {
"id": 3,
"name": "Wenjie Yu",
"available_name": "Wenjie Yu",
"avatar_url": "",
"type": "user",
"availability_status": "offline",
"thumbnail": ""
},
"attachments": [
{
"id": 199,
"message_id": 3031,
"file_type": "image",
"account_id": 14,
"extension": null,
"data_url": "https://livedesk.engagelab.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBamNUIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--727ba7469d64f90790d242c743f254b5c9013fe1/android-icon-48x48.png",
"thumb_url": "https://livedesk.engagelab.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--63c890cbf173eb3dc92a8786fcc3e120c329852d/android-icon-48x48.png",
"file_size": 589136,
"width": null,
"height": null
}
]
}
{
"id": 3031,
"content": "Detailliertes Bild wie folgt",
"inbox_id": 79,
"conversation_id": 141,
"message_type": 1,
"content_type": "text",
"status": "sent",
"content_attributes": {},
"created_at": 1762331762,
"private": false,
"source_id": null,
"sorting_id": 5,
"sender": {
"id": 3,
"name": "Wenjie Yu",
"available_name": "Wenjie Yu",
"avatar_url": "",
"type": "user",
"availability_status": "offline",
"thumbnail": ""
},
"attachments": [
{
"id": 199,
"message_id": 3031,
"file_type": "image",
"account_id": 14,
"extension": null,
"data_url": "https://livedesk.engagelab.com/rails/active_storage/blobs/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBamNUIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--727ba7469d64f90790d242c743f254b5c9013fe1/android-icon-48x48.png",
"thumb_url": "https://livedesk.engagelab.com/rails/active_storage/representations/redirect/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--63c890cbf173eb3dc92a8786fcc3e120c329852d/android-icon-48x48.png",
"file_size": 589136,
"width": null,
"height": null
}
]
}
Diesen Codeblock im schwebenden Fenster anzeigen
Antwortparameter
| Feld | Typ | Beschreibung |
|---|---|---|
| id | Int | Nachrichten-ID. |
| content | String | Nachrichteninhalt. |
| inbox_id | Int | Posteingangs-ID. |
| conversation_id | Int | Konversations-ID. |
| message_type | Int | Nachrichtentyp. |
| content_type | String | Inhaltstyp. |
| status | String | Nachrichtenstatus, z. B. „sent“, „delivered“ usw. |
| content_attributes | Object | Inhaltsattribute. |
| created_at | Int | Zeitstempel der Erstellung der Nachricht. |
| private | Boolean | Gibt an, ob es sich um eine private Nachricht handelt. |
| source_id | Int | Quell-ID. |
| sorting_id | Int | Sortier-ID. |
| sender | Object | Informationen zum Absender. |
| ├─ id | Int | Absender-ID. |
| ├─ name | String | Name des Absenders. |
| ├─ available_name | String | Anzeigename des Absenders. |
| ├─ avatar_url | String | Avatar-URL des Absenders. |
| ├─ type | String | Typ des Absenders (z. B. user). |
| ├─ availability_status | String | Online-Status des Absenders (z. B. offline). |
| └─ thumbnail | String | Thumbnail des Absenders. |
| attachments | Array | Liste der Anhangsinformationen. |
| ├─ id | Int | Anhangs-ID. |
| ├─ message_id | Int | ID der zugehörigen Nachricht. |
| ├─ file_type | String | Dateityp (z. B. image). |
| ├─ account_id | Int | Account-ID. |
| ├─ extension | String | Dateiendung. |
| ├─ data_url | String | Datei-URL. |
| ├─ thumb_url | String | Thumbnail-URL (nur bei Bildern). |
| ├─ file_size | Int | Dateigröße in Byte. |
| ├─ width | Int | Bildbreite (nur bei Bildern). |
| └─ height | Int | Bildhöhe (nur bei Bildern). |

