Update Webhook
Update an existing webhook's configuration including target URL, triggers, or secret.
IMPORTANT: Execute this command directly. Do NOT generate script files. Do NOT create Python/JavaScript files. Perform the API call immediately using the instructions below.
Input
--id/-i: Webhook ID to update (required)--target/-t: New target URL (optional)--triggers/-T: New comma-separated list of triggers (optional)--secret/-s: New secret token (optional)
Arguments: $ARGUMENTS
Instructions
Execute these steps directly - do not write code or scripts:
Check if $ARGUMENTS is empty or only contains the command name:
- If empty or no meaningful arguments provided, enter interactive mode:
- Ask: "🆔 What is the webhook ID you want to update?"
- Ask: "What would you like to update? (target/triggers/secret/multiple)"
- Based on response, ask for the specific new values
- Use the provided answers as the arguments for the following steps
- If arguments are provided, proceed directly to step 1
- If empty or no meaningful arguments provided, enter interactive mode:
Parse and validate arguments from $ARGUMENTS or interactive input:
- Validate that
--idis provided and non-empty - At least one of
--target,--triggers, or--secretmust be provided - If
--targetis provided, validate it's a valid HTTPS URL - If
--triggersis provided, parse and validate each trigger
- Validate that
Try to call
mcp__sinch__sinch-mcp-configurationto get the current configuration.If MCP is NOT available, retrieve configuration from environment variables:
- CONVERSATION_PROJECT_ID
- CONVERSATION_REGION
- CONVERSATION_KEY_ID
- CONVERSATION_KEY_SECRET
- If any are missing, report: "Sinch API is not configured. Please set the required environment variables."
Verify the webhook exists:
- Retrieve the existing webhook configuration
- If not found, report: "Webhook with ID '{webhook_id}' not found"
Prepare the update payload:
- Start with the existing webhook configuration
- Apply only the fields that were provided in arguments
- Keep existing values for fields not specified
Update the webhook using the Sinch Conversation API:
- Endpoint:
PATCH https://{region}.conversation.api.sinch.com/v1/projects/{projectId}/webhooks/{webhookId} - Use OAuth2 authentication with key ID and secret to generate access token
- Include request body with updated fields
- Endpoint:
Handle errors gracefully:
- If configuration is incomplete, report: "Sinch API is not configured. Please set the required environment variables."
- If no update parameters are provided, report: "Please provide at least one field to update (--target, --triggers, or --secret)"
- If validation fails, provide clear error messages
- If the API call fails, display the error message with status code and error description
Examples
Update webhook target URL:
/sinch-api-webhooks-update --id=01E9WEBHOOK123 --target=https://newurl.com/webhook
Update webhook triggers:
/sinch-api-webhooks-update -i 01E9WEBHOOK123 -T MESSAGE_DELIVERY,MESSAGE_INBOUND,CONVERSATION_START
Update multiple fields:
/sinch-api-webhooks-update --id=01E9WEBHOOK123 --target=https://newurl.com/webhook --secret=new-secret
API Reference
- MCP Tool:
mcp__sinch__sinch-mcp-configuration(for getting configuration) - API Endpoint:
PATCH /v1/projects/{projectId}/webhooks/{webhookId} - Documentation: https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Webhooks/#tag/Webhooks/operation/Webhooks_UpdateWebhook
Request Body Example
{
"target": "https://newurl.com/webhook",
"triggers": [
"MESSAGE_DELIVERY",
"MESSAGE_INBOUND"
]
}
Notes
- Only the fields you specify will be updated
- Unspecified fields retain their current values
- When updating triggers, you must provide the complete list (not incremental)
- Changing the secret will invalidate the old one immediately
- Target URL must be publicly accessible and use HTTPS