メッセージ送信

開発者はAPIを通じて指定した会話にメッセージを送信できます。

リクエスト方式

POST

呼び出しアドレス

https://livedesk-api.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages

呼び出し検証

詳細はAPI概要の認証方式の説明を参照してください。

通常のテキストリクエスト

リクエスト例

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": "エージェントからのメッセージ送信、正常ですか", "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": "エージェントからのメッセージ送信、正常ですか",  
    "private": false,
    "content_attributes": {
        "in_reply_to": 29   
    }
}'

            
このコードブロックはフローティングウィンドウ内に表示されます

リクエストヘッダー

フィールド タイプ 説明
Authorization string Authorization: Basic base64(API Key:API Secret)を使用して認証を行います。APIキーページにアクセスしてAPI KeyとAPI Secretを取得し、両者をコロンで連結した後にBase64エンコードしてください。
Content-Type application/json データタイプ。通常のテキストメッセージにはapplication/jsonを使用します。

パスパラメータ

フィールド タイプ 必須 説明
conversation_id string はい 会話ID。

リクエストボディパラメータ

フィールド タイプ 必須 説明
content String はい メッセージ内容。
private Boolean いいえ プライベートメッセージかどうか。デフォルトはfalse。
content_attributes Object いいえ コンテンツ属性。例えば、特定のメッセージに返信する場合、in_reply_toフィールドを使用してメッセージIDを指定します。

通常のテキストレスポンス例

成功レスポンス

{ "id": 3030, "content": "エージェントからのメッセージ送信、正常ですか", "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": "エージェントからのメッセージ送信、正常ですか",
    "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 Int メッセージID。
content String メッセージ内容。
inbox_id Int 受信トレイID。
conversation_id Int 会話ID。
message_type Int メッセージタイプ。
content_type String コンテンツタイプ。
status String メッセージステータス。"sent"、"delivered"など。
content_attributes Object コンテンツ属性。
created_at Int メッセージ作成タイムスタンプ。
private Boolean プライベートメッセージかどうか。
source_id Int ソースID。
sorting_id Int ソートID。
sender Object 送信者情報
id Int 送信者ID。
name String 送信者名。
available_name String 送信者表示名。
avatar_url String 送信者アバターURL。
type String 送信者タイプ(例:user)。
availability_status String 送信者オンラインステータス(例:offline)。
thumbnail String 送信者サムネイル。

画像/音声等ファイルリクエスト

リクエスト例

curl -X POST "https://livedesk.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages" \ -H "Authorization: Basic base64(api_key:api_secret)" \ -F "attachments[]=@attachments[]=@/path/to/your/file.jpg" \ -F "content=詳細画像は以下の通り"
              
              curl -X POST "https://livedesk.engagelab.com/api/v2/accounts/conversations/:conversation_id/messages" \
  -H "Authorization: Basic base64(api_key:api_secret)" \
  -F "attachments[]=@attachments[]=@/path/to/your/file.jpg" \
  -F "content=詳細画像は以下の通り" 

            
このコードブロックはフローティングウィンドウ内に表示されます

パスパラメータ

フィールド タイプ 必須 説明
conversation_id string はい 会話ID。

画像/音声等ファイルレスポンス例

成功レスポンス

{ "id": 3031, "content": "詳細画像は以下の通り", "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/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBamNUIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--727ba7469d64f90790d242c743f254b5c9013fe1/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--63c890cbf173eb3dc92a8786fcc3e120c329852d/android-icon-48x48.png", "file_size": 589136, "width": null, "height": null } ] }
              
              {
    "id": 3031,
    "content": "詳細画像は以下の通り",
    "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/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaHBBamNUIiwiZXhwIjpudWxsLCJwdXIiOiJibG9iX2lkIn19--727ba7469d64f90790d242c743f254b5c9013fe1/eyJfcmFpbHMiOnsibWVzc2FnZSI6IkJBaDdCem9MWm05eWJXRjBTU0lJY0c1bkJqb0dSVlE2RTNKbGMybDZaVjkwYjE5bWFXeHNXd2RwQWZvdyIsImV4cCI6bnVsbCwicHVyIjoidmFyaWF0aW9uIn19--63c890cbf173eb3dc92a8786fcc3e120c329852d/android-icon-48x48.png",
            "file_size": 589136,
            "width": null,
            "height": null
        }
    ]
}

            
このコードブロックはフローティングウィンドウ内に表示されます

レスポンスパラメータ

フィールド タイプ 説明
id Int メッセージID。
content String メッセージ内容。
inbox_id Int 受信トレイID。
conversation_id Int 会話ID。
message_type Int メッセージタイプ。
content_type String コンテンツタイプ。
status String メッセージステータス。"sent"、"delivered"など。
content_attributes Object コンテンツ属性。
created_at Int メッセージ作成タイムスタンプ。
private Boolean プライベートメッセージかどうか。
source_id Int ソースID。
sorting_id Int ソートID。
sender Object 送信者情報。
id Int 送信者ID。
name String 送信者名。
available_name String 送信者表示名。
avatar_url String 送信者アバターURL。
type String 送信者タイプ(例:user)。
availability_status String 送信者オンラインステータス(例:offline)。
thumbnail String 送信者サムネイル。
attachments Array 添付ファイル情報リスト。
id Int 添付ファイルID。
message_id Int 所属メッセージID。
file_type String ファイルタイプ(例:image)。
account_id Int アカウントID。
extension String ファイル拡張子。
data_url String ファイルURL。
thumb_url String サムネイルURL(画像タイプのみ)。
file_size Int ファイルサイズ(バイト)。
width Int ファイル幅(画像タイプのみ)。
height Int ファイル高さ(画像タイプのみ)。
icon
お問い合わせ