Skip to main content
POST
/
webhooks
/
notification
Spec of webhook to be hosted by External Partners.
curl --request POST \
  --url https://sdp.suki-stage.com/webhooks/notification \
  --header 'Content-Type: application/json' \
  --data '
{
  "encounter_id": "29de56bc-960a-4cd5-b18f-79a798d62874",
  "error_code": "ERROR_CODE_TRANSCRIPTION",
  "error_detail": "Error in transcription",
  "session_id": "20965414-929a-4f71-a3e5-b92bec07d086",
  "status": "failure"
}
'
This response has no body data.
Use this endpoint specification to implement a webhook endpoint in your application that receives notifications from the Suki platform. This endpoint should be hosted by your application to receive notifications about session completion or failure.

Code Examples

from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/webhooks/notification', methods=['POST'])
def handle_webhook():
    """
    Webhook endpoint to receive notifications from Suki platform.
    This endpoint should be hosted by your application.
    """
    # The payload is received in the request body from Suki
    data = request.get_json()  # This is the payload sent by Suki
    
    if not data:
        return jsonify({"error": "Invalid request"}), 400
    
    status = data.get("status")
    
    if status == "success":
        # Handle success notification
        session_id = data.get("session_id")
        encounter_id = data.get("encounter_id")
        sessions = data.get("sessions", [])
        additional_info = data.get("additional_info")
        
        print(f"Session {session_id} completed successfully")
        print(f"Encounter ID: {encounter_id}")
        print(f"Total sessions: {len(sessions)}")
        if additional_info:
            print(f"Additional info: {additional_info}")
        
        # Access links to retrieve content
        if "_links" in data:
            links = data["_links"]
            print("Available links:")
            
            # contents is an array of Link objects
            if "contents" in links:
                print("  Session contents:")
                for link in links["contents"]:
                    print(f"    {link.get('method')} {link.get('href')} - {link.get('name')}")
            
            # encounter_content is an array of Link objects
            if "encounter_content" in links:
                print("  Encounter content:")
                for link in links["encounter_content"]:
                    print(f"    {link.get('method')} {link.get('href')} - {link.get('name')}")
            
            # transcripts is an array of Link objects
            if "transcripts" in links:
                print("  Transcripts:")
                for link in links["transcripts"]:
                    print(f"    {link.get('method')} {link.get('href')} - {link.get('name')}")
            
            # status is an array of Link objects
            if "status" in links:
                print("  Status:")
                for link in links["status"]:
                    print(f"    {link.get('method')} {link.get('href')} - {link.get('name')}")
        
        return jsonify({"message": "Notification received"}), 200
    
    elif status == "failure":
        # Handle failure notification
        session_id = data.get("session_id")
        encounter_id = data.get("encounter_id")
        error_code = data.get("error_code")
        error_detail = data.get("error_detail")
        
        print(f"Session {session_id} failed")
        print(f"Encounter ID: {encounter_id}")
        print(f"Error Code: {error_code}")
        print(f"Error Detail: {error_detail}")
        
        return jsonify({"message": "Failure notification received"}), 200
    
    else:
        return jsonify({"error": "Unknown status"}), 400

if __name__ == '__main__':
    app.run(port=3000)

Body

application/json

FailureNotification

encounter_id
string

Id of the encounter to which the payload belongs.

Example:

"29de56bc-960a-4cd5-b18f-79a798d62874"

error_code
string

Error code.

Example:

"ERROR_CODE_TRANSCRIPTION"

error_detail
string

Details of the error, if any.

Example:

"Error in transcription"

session_id
string

Id of the session that failed.

Example:

"20965414-929a-4f71-a3e5-b92bec07d086"

status
string
Example:

"failure"

Response