Update Call Context
Update Call Context
The Flyflow API allows you to update the context of an ongoing call by making a POST request to the /call/context
endpoint. This endpoint enables you to provide additional context or information to the agent during the call.
Request
Endpoint
POST /call/context
Headers
Authorization
: The API key prefixed withBearer
. Example:Bearer your_api_key
.Content-Type
: The content type of the request body. Must be set toapplication/json
.
Request Body
The request body should be a JSON object containing the following properties:
id
(string, required): The unique identifier of the call for which you want to update the context.context
(string, required): The updated context or additional information to be provided to the agent during the call.
cURL Example
curl -X POST \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{
"id": "call_id",
"context": "The customer has a pending invoice."
}' \
"https://api.flyflow.dev/v1/call/context"
Replace call_id
with the actual ID of the call for which you want to update the context.
Python Client Example
from flyflowclient import Flyflow
client = Flyflow(api_key='your_api_key')
call_id = 'call_id'
updated_context = 'The customer has a pending invoice.'
updated_call = client.set_call_context(call_id, updated_context)
print(updated_call)
Replace call_id
with the actual ID of the call for which you want to update the context.
Response
Status Codes
200 OK
: The call context was successfully updated.400 Bad Request
: The request body is missing required fields or contains invalid data.401 Unauthorized
: The API key is missing or invalid.404 Not Found
: The specified call ID does not exist.500 Internal Server Error
: An unexpected error occurred on the server side.
Response Body
If the call context is successfully updated, the response body will be a JSON object containing the updated call details:
{
"id": "call_id",
"agent_id": "agent_id",
"from": "+1234567890",
"to": "+9876543210",
"context": "The customer has a pending invoice.",
"status": "in_progress",
"created_at": "timestamp",
"updated_at": "timestamp"
}
id
(string): The unique identifier of the call.agent_id
(string): The identifier of the agent associated with the call.from
(string): The phone number of the agent who initiated the call.to
(string): The recipient phone number.context
(string): The updated context provided for the call.status
(string): The current status of the call (e.g.,"in_progress"
).created_at
(string): The timestamp indicating when the call was created.updated_at
(string): The timestamp indicating when the call context was last updated.
Error Handling
If an error occurs while updating the call context, the API will return an appropriate error response with a corresponding status code and error message in the response body.
For example, if the specified call ID does not exist:
{
"error": "Not Found",
"message": "Call not found"
}
Make sure to handle errors appropriately in your application and provide the correct call ID and context in the request body.
Conclusion
Updating the context of an ongoing call using the Flyflow API is a straightforward process. By making a POST request to the /call/context
endpoint with the required call ID and updated context in the request body, you can provide additional information to the agent during the call. The API will return the updated call details upon success. Remember to handle errors and provide the necessary authentication, call ID, and context to ensure a smooth integration with the Flyflow platform.
Updated 6 months ago