Skip to main content
POST
/
webhooks
/
on-condition
Webhook - When a conditional node is evaluated
curl --request POST \
  --url https://yourdomain.com/webhooks/on-condition \
  --header 'Content-Type: application/json' \
  --data '{
  "country_code": "+57",
  "cellphone": "3161234567",
  "session_id": "abcsderfwer3252432423-1324325235",
  "conversation_id": 1234,
  "variable": {
    "name": "age",
    "value": "18"
  },
  "condition": {
    "operator": "EQ",
    "value": "18"
  },
  "user_session_keys": [
    {
      "key": "age",
      "value": "18",
      "type": null
    },
    {
      "key": "user_id",
      "value": "12345",
      "type": null
    }
  ]
}'
{}
You can also configure the response webhook for each path that exits from a condition node. Configure condition node webhook If you do this, the HTTP request body that is sent to the endpoint configured in Treble will add the following field to the request body:
{
    "condition": {
	    "operator": "EQ",
        "value": "18"
    }
}
The condition is an object with an operator property to show which action was used in the condition and a value for the condition action to be evaluated:
  • Equal: EQ
  • Different: DIFF
  • Greater than: GT
  • Less than: LT
  • Greater than or equal to: GTEQ
  • Less than or equal to: LTEQ
  • Contains: CONT
  • Does not contain: NCONT
  • Default path: DEFAULT
The response can also have new variables for the session that can be updated or created for later use in the session. That is, you can add them in the webhook response as part of the user_session_keys.

Body

application/json

Information of the condition evaluation event

Event that is triggered when a conditional node is evaluated in the conversation

country_code
string
required

Country code of the user

cellphone
string
required

User's phone number without the country code

session_id
string
required

ID of the user's session

conversation_id
integer
required

ID of the conversation

variable
object
required

Variable that is evaluated in the condition

condition
object
required

Condition that is evaluated

user_session_keys
object[]
required

User session keys collected during the conversation or provided during the deployment

Response

200 - application/json

Response to update or add information to the session

JSON object with the new information that will be replaced or added to the session for future use. The service must respond in less than 10 seconds.

I