POST
/
webhooks
/
on-condition
curl --request POST \
  --url https://tudominio.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 coming out of a condition node.

If you do this, the HTTP request body sent to the endpoint configured in Treble will add the following field in 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 about the condition evaluation event

Evento que se dispara cuando se evalúa un nodo condicional en la conversación

Response

200 - application/json

Respuesta para actualizar o agregar información a la sesión

Objeto JSON con la nueva información que será reemplazada o agregada a la sesión para uso futuro. El servicio debe responder en menos de 10 segundos.