# Create conversation form

POST https://services.leadconnectorhq.com/ad-publishing/facebook/conversation-forms

Create a Messenger conversation form. Note the created record is returned in its raw stored form rather than the shape the listing endpoint uses: the identifier comes back as `_id` instead of `id`, and the internal `__v` version key is included.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `adPublishing.write`

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v4"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/ad-publishing/facebook/conversation-forms": {
      "post": {
        "summary": "Create conversation form",
        "operationId": "createConversationForm",
        "description": "Create a Messenger conversation form. Note the created record is returned in its raw stored form rather than the shape the listing endpoint uses: the identifier comes back as `_id` instead of `id`, and the internal `__v` version key is included.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v4"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateConversationFormDTO"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The stored conversation form",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FacebookCreatedConversationFormDTO"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerErrorDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "adPublishing.write"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "CreateConversationFormDTO": {
        "type": "object",
        "properties": {
          "locationId": {
            "type": "string",
            "description": "Location identifier",
            "example": "loc_abc123"
          },
          "name": {
            "type": "string",
            "description": "Conversation form name",
            "example": "Welcome Form"
          },
          "text": {
            "type": "string",
            "description": "Welcome message text",
            "example": "Hi! How can we help?"
          },
          "questions": {
            "description": "Quick-reply questions shown in the welcome message of the conversation form",
            "example": [
              {
                "question": "How can we help?",
                "response": "Thanks for reaching out! A team member will assist you shortly."
              },
              {
                "question": "I want to learn more",
                "response": "Great! Here is a link to our services."
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "question": {
                  "type": "string",
                  "description": "Question title text",
                  "example": "How can we help?"
                },
                "response": {
                  "type": "string",
                  "description": "Auto-response message",
                  "example": "Thanks for reaching out"
                }
              },
              "required": [
                "question"
              ],
              "title": "WelcomeMessageQuestion"
            }
          }
        },
        "required": [
          "locationId",
          "name",
          "text",
          "questions"
        ],
        "title": "CreateConversationFormDTO"
      },
      "FacebookCreatedConversationFormDTO": {
        "type": "object",
        "properties": {
          "_id": {
            "type": "string",
            "description": "Conversation form id. Note `_id`, not the `id` the listing endpoint returns for the same record.",
            "example": "6a8666ec867e604d24f5a49b"
          },
          "name": {
            "type": "string",
            "description": "Form name",
            "example": "Untitled form 20 Aug 26, 08:00 AM"
          },
          "text": {
            "type": "string",
            "description": "Opening message",
            "example": "Hi there! Please let us know how we can help you."
          },
          "locationId": {
            "type": "string",
            "description": "Owning location",
            "example": "fRMewNQIxSyZ5R4nQyit"
          },
          "questions": {
            "description": "Prompt and canned-reply pairs as stored",
            "example": [
              {
                "question": "Your question",
                "response": "Click the link below to view the product page.",
                "_id": "6a831fb01aa9a84ff992aefd"
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "question": {
                  "type": "string",
                  "description": "Prompt offered to the user as a tappable reply",
                  "example": "Your question"
                },
                "response": {
                  "type": "string",
                  "description": "Canned answer sent when the prompt is chosen. Omitted entirely on some records and an empty string on others, so treat missing and blank as the same thing.",
                  "example": "Click the link below to view the product page."
                },
                "_id": {
                  "type": "string",
                  "description": "Mongo subdocument id. Internal — do not depend on it.",
                  "example": "6a831fb01aa9a84ff992aefd"
                }
              },
              "required": [
                "question"
              ],
              "title": "FacebookConversationFormQuestionDTO"
            }
          },
          "createdAt": {
            "type": "string",
            "description": "Creation time, ISO-8601",
            "example": "2026-08-20T02:31:08.055Z"
          },
          "updatedAt": {
            "type": "string",
            "description": "Last modification time, ISO-8601",
            "example": "2026-08-20T02:31:08.055Z"
          },
          "__v": {
            "type": "number",
            "description": "Mongo document version key, leaked by this branch only. Not part of the contract.",
            "example": 0
          }
        },
        "required": [
          "_id",
          "name",
          "text",
          "locationId",
          "questions",
          "createdAt",
          "updatedAt"
        ],
        "title": "FacebookCreatedConversationFormDTO"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      },
      "InternalServerErrorDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code for an unexpected server error",
            "example": 500
          },
          "message": {
            "type": "string",
            "description": "Error message describing the server failure",
            "example": "Internal Server Error"
          }
        },
        "title": "InternalServerErrorDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/ad-publishing/facebook/conversation-forms' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v4' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "locationId": "loc_abc123",
  "name": "Welcome Form",
  "text": "Hi! How can we help?",
  "questions": [
    {
      "question": "How can we help?",
      "response": "Thanks for reaching out! A team member will assist you shortly."
    },
    {
      "question": "I want to learn more",
      "response": "Great! Here is a link to our services."
    }
  ]
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v4',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "locationId": "loc_abc123",
      "name": "Welcome Form",
      "text": "Hi! How can we help?",
      "questions": [
        {
          "question": "How can we help?",
          "response": "Thanks for reaching out! A team member will assist you shortly."
        },
        {
          "question": "I want to learn more",
          "response": "Great! Here is a link to our services."
        }
      ]
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/facebook/conversation-forms', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/ad-publishing/facebook/conversation-forms"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v4"
}

payload = {
    "locationId": "loc_abc123",
    "name": "Welcome Form",
    "text": "Hi! How can we help?",
    "questions": [
        {
            "question": "How can we help?",
            "response": "Thanks for reaching out! A team member will assist you shortly."
        },
        {
            "question": "I want to learn more",
            "response": "Great! Here is a link to our services."
        }
    ]
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/ad-publishing/facebook/conversation-forms',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v4',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "locationId": "loc_abc123",
  "name": "Welcome Form",
  "text": "Hi! How can we help?",
  "questions": [
    {
      "question": "How can we help?",
      "response": "Thanks for reaching out! A team member will assist you shortly."
    },
    {
      "question": "I want to learn more",
      "response": "Great! Here is a link to our services."
    }
  ]
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/ad-publishing/facebook/conversation-forms")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v4")
  .header("Content-Type", "application/json")
  .body("{\"locationId\":\"loc_abc123\",\"name\":\"Welcome Form\",\"text\":\"Hi! How can we help?\",\"questions\":[{\"question\":\"How can we help?\",\"response\":\"Thanks for reaching out! A team member will assist you shortly.\"},{\"question\":\"I want to learn more\",\"response\":\"Great! Here is a link to our services.\"}]}")
  .asString();
```

**Go**

```go
package main

import (
  "fmt"
  "net/http"
  "io"
  "strings"
)

func main() {
  url := "https://services.leadconnectorhq.com/ad-publishing/facebook/conversation-forms"
  payload := strings.NewReader(`{
  "locationId": "loc_abc123",
  "name": "Welcome Form",
  "text": "Hi! How can we help?",
  "questions": [
    {
      "question": "How can we help?",
      "response": "Thanks for reaching out! A team member will assist you shortly."
    },
    {
      "question": "I want to learn more",
      "response": "Great! Here is a link to our services."
    }
  ]
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v4")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

```ruby
require 'uri'
require 'net/http'

url = URI("https://services.leadconnectorhq.com/ad-publishing/facebook/conversation-forms")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v4"
request["Content-Type"] = "application/json"
request.body = '{
  "locationId": "loc_abc123",
  "name": "Welcome Form",
  "text": "Hi! How can we help?",
  "questions": [
    {
      "question": "How can we help?",
      "response": "Thanks for reaching out! A team member will assist you shortly."
    },
    {
      "question": "I want to learn more",
      "response": "Great! Here is a link to our services."
    }
  ]
}'

response = http.request(request)
puts response.read_body
```

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v4"
}

$body = '{
  "locationId": "loc_abc123",
  "name": "Welcome Form",
  "text": "Hi! How can we help?",
  "questions": [
    {
      "question": "How can we help?",
      "response": "Thanks for reaching out! A team member will assist you shortly."
    },
    {
      "question": "I want to learn more",
      "response": "Great! Here is a link to our services."
    }
  ]
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/ad-publishing/facebook/conversation-forms' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
