Create Webhook
Create a new webhook to receive real-time notifications about message events and other activities from Sinch Conversation API.
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
--target/-t: Target URL where webhook events will be sent (required)--triggers/-T: Comma-separated list of event triggers (required)--secret/-s: Secret token for validating webhook requests (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 target webhook URL? (must be HTTPS)"
- Ask: "🔔 Which triggers do you want? (comma-separated, or type 'list' to see available triggers)"
- If user types 'list', show the Available Triggers section, then ask again
- Ask: "🔐 Do you want to set a custom secret? (optional, press Enter to auto-generate)"
- 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
--targetis provided and is a valid HTTPS URL - Validate that
--triggersis provided and non-empty - Parse triggers as a comma-separated list
- Validate each trigger against the available trigger types
- If
--secretis not provided, generate a random secret
- 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_APP_ID
- CONVERSATION_KEY_ID
- CONVERSATION_KEY_SECRET
- If any are missing, report: "Sinch API is not configured. Please set the required environment variables."
Check for duplicate webhooks:
- List existing webhooks using the same API endpoint
- Check if a webhook with the same target URL already exists
- If duplicate found, ask user: "A webhook with target '{target}' already exists. Do you want to update it instead?"
Create the webhook using the Sinch Conversation API:
- Endpoint:
POST https://{region}.conversation.api.sinch.com/v1/projects/{projectId}/webhooks - Use OAuth2 authentication with key ID and secret to generate access token
- Include request body with target, triggers, and secret
- Endpoint:
Display the created webhook details:
- Webhook ID
- Target URL
- Configured triggers
- Secret (show only once for security)
Handle errors gracefully:
- If configuration is incomplete, report: "Sinch API is not configured. Please set the required environment variables."
- If validation fails, provide clear error messages about what needs to be fixed
- If the API call fails, display the error message with status code and error description
Examples
Create a webhook with multiple triggers:
/sinch-api-webhooks-create --target=https://example.com/webhook --triggers=MESSAGE_DELIVERY,MESSAGE_INBOUND
Create with a custom secret:
/sinch-api-webhooks-create -t https://example.com/webhook -T MESSAGE_DELIVERY -s my-secret-token
API Reference
- MCP Tool:
mcp__sinch__sinch-mcp-configuration(for getting configuration) - API Endpoint:
POST /v1/projects/{projectId}/apps/{appId}/webhooks - Documentation: https://developers.sinch.com/docs/conversation/api-reference/conversation/tag/Webhooks/#tag/Webhooks/operation/Webhooks_CreateWebhook
Request Body Example
{
"target": "https://example.com/webhook",
"target_type": "HTTP",
"triggers": [
"MESSAGE_DELIVERY",
"MESSAGE_INBOUND"
],
"secret": "your-webhook-secret"
}
Available Triggers
Message-related triggers:
MESSAGE_DELIVERY- Delivery receipts for sent messagesMESSAGE_INBOUND- Inbound messages from end usersMESSAGE_SUBMIT- Message submission eventsMESSAGE_INBOUND_SMART_CONVERSATION_REDACTION- Smart conversation redaction events
Other triggers:
EVENT_DELIVERY- Event delivery receiptsEVENT_INBOUND- Inbound events from end usersCONVERSATION_START- New conversation startedCONVERSATION_STOP- Conversation stoppedCONVERSATION_DELETE- Conversation deletedCONTACT_CREATE- Contact createdCONTACT_DELETE- Contact deletedCONTACT_MERGE- Contacts mergedCONTACT_UPDATE- Contact updatedCONTACT_IDENTITIES_DUPLICATION- Duplicate contact identitiesOPT_IN- User opted inOPT_OUT- User opted outCAPABILITY- Channel capability changesCHANNEL_EVENT- Channel-specific eventsSMART_CONVERSATION- Smart conversation eventsRECORD_NOTIFICATION- Record notification eventsUNSUPPORTED- Unsupported events
Notes
- Target URL must be publicly accessible and use HTTPS
- The secret is used to sign webhook requests for validation
- Store the webhook secret securely - it's shown only once
- You can configure multiple triggers for a single webhook
- Webhook requests include a signature header for verification