# Listen Workflow Trigger

Wait for a call to a Webhook trigger in the workflow's draft: send a request to the trigger's URL while this waits. The first call that arrives after it starts is saved as the trigger's sample output, so the steps can reference its query, body and headers, and answered with status received. With none in 30 seconds it answers status noCall: listen again. Every call to the URL is recorded, published or not; only calls during a listen become the sample.

`POST https://connect.mindcloud.co/v2/workflows/:workflowId/triggers/:triggerId/listen`

Permissions: `workflow:edit`.

## Parameters

### Path

- `workflowId` (string, required): The workflow's id, from List Workflows.
- `triggerId` (string, required): The trigger's id, from List Workflow Triggers.

### Headers

- `X-Company-Id` (string): Optional. The id of the organization to act in. Leave it out to act in the API key's own organization. A key can also act in its child organizations, and, with "Use this key across all of your organizations" on, in every organization its creator can open in the app. List them with GET /v2/companies. Every response's X-Company-Id header names the organization it acted in. See [Organizations](https://mindcloud.co/docs/api/rest/introduction/organizations).

## Example request

```bash
curl --request POST \
  --url 'https://connect.mindcloud.co/v2/workflows/Wq3kZ8pLx2Nb/triggers/Tg5mW2xQp8Lr/listen' \
  --header 'Authorization: Bearer $MINDCLOUD_API_TOKEN' \
  --header 'Content-Type: application/json' \
  --data '{}'
```

## Response fields

- `status` (string): received: a call came in and is now the sample. noCall: none came within 30 seconds; listen again.
  Allowed values:
    - `received`
    - `noCall`
- `receivedOn` (date): When the call came in. Null for noCall.
- `output` (object): The call as the trigger answers it, now its sample output: [{ query, body, params, url, method, headers }]. Null for noCall.
- `outputFields` (array of objects): The fields of the trigger's output, learned from its sample and offered to the steps.
  - `key` (string): The field's path in each record: dotted, with [] marking an array (lines[].sku). Reference it as {{ steps.<stepId>.output[0].<key> }}.
  - `type` (string): Its type as seen in the sample: string, number, boolean, object, date, a type with [] for an array, or mixed.
- `revision` (string): The draft's revision: send it in If-Match on your next change to the draft.
