# Coversation Starter for Botpress

<main id="bkmrk-botpress-chat-apis">**Webchat API**

<p class="callout info">https://webchat.botpress.cloud/11cf5d84-ba87-4ff7-8393-914d3e60c257</p>

**Webhook API**

<p class="callout info">https://webhook.botpress.cloud/b4deb74d-8be2-4373-90e1-c28bebcbf58d</p>

<p class="callout warning">Replace `YOUR_USER_KEY` and `YOUR_WEBHOOK_SECRET` with the applicable credentials.</p>

## Chat Operations

##### **Create User**

<section class="endpoint open" id="bkmrk-post-users"><p class="callout info"><span class="method">POST </span><span class="path">/users</span></p>

Submit a request to create a webchat user.

##### Headers

<div class="body"><table class="tbl"><tbody><tr><th>Name</th><th>Value</th><th>Description</th></tr><tr><td>`Content-Type`</td><td>`application/json`</td><td>Request body format.</td></tr></tbody></table>

</div>##### Request body

The supplied request sends an empty JSON object.

```json
{}
```

##### Curl

```bash
curl --location --request POST \
  --url 'https://webchat.botpress.cloud/11cf5d84-ba87-4ff7-8393-914d3e60c257/users' \
  --header 'Content-Type: application/json' \
  --data '{}'
```

##### Responses

<p class="callout info">No response sample was supplied. HTTP status codes and response fields are not documented here.</p>

</section>##### **Create Conversation**

<section class="endpoint open" id="bkmrk-post-conversations"><p class="callout info"><span class="method">POST </span><span class="path">/conversations</span></p>

Submit a request to create a conversation using the supplied user key.

##### Headers

<div class="body"><table class="tbl"><tbody><tr><th>Name</th><th>Value</th><th>Description</th></tr><tr><td>`x-user-key`</td><td>`YOUR_USER_KEY`</td><td>User credential for the request.</td></tr><tr><td>`Content-Type`</td><td>`application/json`</td><td>Request body format.</td></tr></tbody></table>

</div>##### Request body

The supplied request sends an empty JSON object.

```json
{}
```

##### Curl

```bash
curl --location --request POST \
  --url 'https://webchat.botpress.cloud/11cf5d84-ba87-4ff7-8393-914d3e60c257/conversations' \
  --header 'x-user-key: YOUR_USER_KEY' \
  --header 'Content-Type: application/json' \
  --data '{}'
```

##### Responses

<p class="callout info">No response sample was supplied. HTTP status codes and response fields are not documented here.</p>

</section>## Webhook Operations

##### **Submit Buyer and Seller Details**

<section class="endpoint open" id="bkmrk-post-webhook"><p class="callout info"><span class="method">POST </span><span class="path">https://webhook.botpress.cloud/b4deb74d-8be2-4373-90e1-c28bebcbf58d</span></p>

Send a name, seller identifier and buyer identifier to the configured webhook.

##### Headers

<div class="body"><table class="tbl"><tbody><tr><th>Name</th><th>Value</th><th>Description</th></tr><tr><td>`Content-Type`</td><td>`application/json`</td><td>Request body format.</td></tr><tr><td>`x-bp-secret`</td><td>`YOUR_WEBHOOK_SECRET`</td><td>Secret configured for the webhook.</td></tr></tbody></table>

</div>##### Request body parameters

<div class="body"><table class="tbl"><tbody><tr><th>Name</th><th>Type</th><th>Description</th></tr><tr><td>`name`</td><td>string</td><td>Name supplied to the webhook. Example: `rahul`.</td></tr><tr><td>`seller_id`</td><td>string</td><td>Seller identifier. Example: `14321376`.</td></tr><tr><td>`buyer_id`</td><td>string</td><td>Buyer identifier. Example: `65857057`.</td></tr></tbody></table>

</div>##### Curl

```bash
curl --location --request POST \
  --url 'https://webhook.botpress.cloud/b4deb74d-8be2-4373-90e1-c28bebcbf58d' \
  --header 'Content-Type: application/json' \
  --header 'x-bp-secret: YOUR_WEBHOOK_SECRET' \
  --data '{
    "name": "rahul",
    "seller_id": "14321376",
    "buyer_id": "65857057"
  }'
```

##### Responses

<p class="callout info">No response sample was supplied. HTTP status codes, response fields and downstream processing are not documented here.</p>

The supplied webhook request does not include a user or conversation identifier. How these details are associated with a webchat conversation is not established by this sample.

</section>## Message Operations

##### **Send Text Message**

<section class="endpoint open" id="bkmrk-post-messages"><p class="callout info"><span class="method">POST </span><span class="path">/messages</span></p>

Submit a text message to the specified conversation using the user key.

##### Headers

<div class="body"><table class="tbl"><tbody><tr><th>Name</th><th>Value</th><th>Description</th></tr><tr><td>`x-user-key`</td><td>`YOUR_USER_KEY`</td><td>User credential for the request.</td></tr><tr><td>`Content-Type`</td><td>`application/json`</td><td>Request body format.</td></tr></tbody></table>

</div>##### Request body parameters

<div class="body"><table class="tbl"><tbody><tr><th>Name</th><th>Type</th><th>Description</th></tr><tr><td>`conversationId`</td><td>string</td><td>Identifier of the conversation receiving the message. Replace the example with your conversation identifier.</td></tr><tr><td>`payload`</td><td>object</td><td>Message content.</td></tr><tr><td>`payload.type`</td><td>string</td><td>`text` in this example.</td></tr><tr><td>`payload.text`</td><td>string</td><td>Text to send.</td></tr></tbody></table>

</div>##### Curl

```bash
curl --location --request POST \
  --url 'https://webchat.botpress.cloud/11cf5d84-ba87-4ff7-8393-914d3e60c257/messages' \
  --header 'x-user-key: YOUR_USER_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "conversationId": "conv_01M527QRHTG4M0MBPYHCAPDQ0B",
    "payload": {
      "type": "text",
      "text": "i need cnc cutting machine"
    }
  }'
```

##### Responses

<p class="callout info">No response sample was supplied. HTTP status codes, response fields and bot reply delivery are not documented here.</p>

</section></main>