Skip to content

API reference ​

ManyChat AI Agent, OpenAPI 3.0.3.

Generated at build time from the Zod schemas in src/contracts/, which also validate every request at runtime. To change this page, change the schema.

GET /health ​

200 ​

Default Response

GET /ready ​

200 ​

Default Response

POST /v1/channels/manychat/message ​

ManyChat Dynamic Block webhook

Authentication: sharedSecret.

Request body ​

application/json

json
{
  "type": "object",
  "properties": {
    "subscriber_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "number"
        }
      ]
    },
    "text": {
      "type": "string",
      "maxLength": 4096
    },
    "first_name": {
      "nullable": true,
      "type": "string"
    },
    "last_name": {
      "nullable": true,
      "type": "string"
    },
    "locale": {
      "nullable": true,
      "type": "string"
    },
    "channel": {
      "nullable": true,
      "type": "string"
    },
    "ai_token": {
      "nullable": true,
      "type": "string",
      "maxLength": 256
    },
    "course": {
      "nullable": true,
      "type": "string",
      "maxLength": 256
    }
  },
  "required": [
    "subscriber_id",
    "text"
  ],
  "additionalProperties": false
}

200 ​

Default Response

application/json

json
{
  "type": "object",
  "properties": {
    "version": {
      "type": "string",
      "enum": [
        "v2"
      ]
    },
    "content": {
      "type": "object",
      "properties": {
        "messages": {
          "maxItems": 10,
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "text"
                    ]
                  },
                  "text": {
                    "type": "string",
                    "minLength": 1
                  },
                  "buttons": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "url"
                              ]
                            },
                            "caption": {
                              "type": "string"
                            },
                            "url": {
                              "type": "string",
                              "format": "starts_with",
                              "pattern": "^https:\\/\\/.*"
                            }
                          },
                          "required": [
                            "type",
                            "caption",
                            "url"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "call"
                              ]
                            },
                            "caption": {
                              "type": "string"
                            },
                            "phone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "caption",
                            "phone"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "flow"
                              ]
                            },
                            "caption": {
                              "type": "string"
                            },
                            "target": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "caption",
                            "target"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "node"
                              ]
                            },
                            "caption": {
                              "type": "string"
                            },
                            "target": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "caption",
                            "target"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "type",
                  "text"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "image"
                    ]
                  },
                  "url": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^https:\\/\\/.*"
                  },
                  "buttons": {
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "url"
                              ]
                            },
                            "caption": {
                              "type": "string"
                            },
                            "url": {
                              "type": "string",
                              "format": "starts_with",
                              "pattern": "^https:\\/\\/.*"
                            }
                          },
                          "required": [
                            "type",
                            "caption",
                            "url"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "call"
                              ]
                            },
                            "caption": {
                              "type": "string"
                            },
                            "phone": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "caption",
                            "phone"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "flow"
                              ]
                            },
                            "caption": {
                              "type": "string"
                            },
                            "target": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "caption",
                            "target"
                          ],
                          "additionalProperties": false
                        },
                        {
                          "type": "object",
                          "properties": {
                            "type": {
                              "type": "string",
                              "enum": [
                                "node"
                              ]
                            },
                            "caption": {
                              "type": "string"
                            },
                            "target": {
                              "type": "string"
                            }
                          },
                          "required": [
                            "type",
                            "caption",
                            "target"
                          ],
                          "additionalProperties": false
                        }
                      ]
                    }
                  }
                },
                "required": [
                  "type",
                  "url"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "file"
                    ]
                  },
                  "url": {
                    "type": "string",
                    "format": "starts_with",
                    "pattern": "^https:\\/\\/.*"
                  }
                },
                "required": [
                  "type",
                  "url"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "actions": {
          "maxItems": 5,
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "add_tag"
                    ]
                  },
                  "tag_name": {
                    "type": "string"
                  }
                },
                "required": [
                  "action",
                  "tag_name"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "remove_tag"
                    ]
                  },
                  "tag_name": {
                    "type": "string"
                  }
                },
                "required": [
                  "action",
                  "tag_name"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "set_field_value"
                    ]
                  },
                  "field_name": {
                    "type": "string"
                  },
                  "value": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      },
                      {
                        "type": "boolean"
                      }
                    ]
                  }
                },
                "required": [
                  "action",
                  "field_name",
                  "value"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "action": {
                    "type": "string",
                    "enum": [
                      "unset_field_value"
                    ]
                  },
                  "field_name": {
                    "type": "string"
                  }
                },
                "required": [
                  "action",
                  "field_name"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "quick_replies": {
          "maxItems": 11,
          "type": "array",
          "items": {
            "oneOf": [
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "flow"
                    ]
                  },
                  "caption": {
                    "type": "string"
                  },
                  "target": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "caption",
                  "target"
                ],
                "additionalProperties": false
              },
              {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "node"
                    ]
                  },
                  "caption": {
                    "type": "string"
                  },
                  "target": {
                    "type": "string"
                  }
                },
                "required": [
                  "type",
                  "caption",
                  "target"
                ],
                "additionalProperties": false
              }
            ]
          }
        },
        "external_message_callback": {
          "type": "object",
          "properties": {
            "url": {
              "type": "string",
              "format": "starts_with",
              "pattern": "^https:\\/\\/.*"
            },
            "method": {
              "type": "string",
              "enum": [
                "post"
              ]
            },
            "headers": {
              "type": "object",
              "additionalProperties": {
                "type": "string"
              }
            },
            "payload": {
              "type": "object",
              "additionalProperties": {}
            },
            "timeout": {
              "type": "integer",
              "minimum": 0,
              "exclusiveMinimum": true,
              "maximum": 86400
            }
          },
          "required": [
            "url",
            "method",
            "timeout"
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "messages"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "version",
    "content"
  ],
  "additionalProperties": false
}

Full document ​

OpenAPI JSON
json
{
  "openapi": "3.0.3",
  "info": {
    "title": "ManyChat AI Agent",
    "version": "0.1.0"
  },
  "components": {
    "securitySchemes": {
      "sharedSecret": {
        "type": "http",
        "scheme": "bearer"
      }
    },
    "schemas": {}
  },
  "paths": {
    "/health": {
      "get": {
        "responses": {
          "200": {
            "description": "Default Response"
          }
        }
      }
    },
    "/ready": {
      "get": {
        "responses": {
          "200": {
            "description": "Default Response"
          }
        }
      }
    },
    "/v1/channels/manychat/message": {
      "post": {
        "summary": "ManyChat Dynamic Block webhook",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "subscriber_id": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "number"
                      }
                    ]
                  },
                  "text": {
                    "type": "string",
                    "maxLength": 4096
                  },
                  "first_name": {
                    "nullable": true,
                    "type": "string"
                  },
                  "last_name": {
                    "nullable": true,
                    "type": "string"
                  },
                  "locale": {
                    "nullable": true,
                    "type": "string"
                  },
                  "channel": {
                    "nullable": true,
                    "type": "string"
                  },
                  "ai_token": {
                    "nullable": true,
                    "type": "string",
                    "maxLength": 256
                  },
                  "course": {
                    "nullable": true,
                    "type": "string",
                    "maxLength": 256
                  }
                },
                "required": [
                  "subscriber_id",
                  "text"
                ],
                "additionalProperties": false
              }
            }
          }
        },
        "security": [
          {
            "sharedSecret": []
          }
        ],
        "responses": {
          "200": {
            "description": "Default Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "version": {
                      "type": "string",
                      "enum": [
                        "v2"
                      ]
                    },
                    "content": {
                      "type": "object",
                      "properties": {
                        "messages": {
                          "maxItems": 10,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "text"
                                    ]
                                  },
                                  "text": {
                                    "type": "string",
                                    "minLength": 1
                                  },
                                  "buttons": {
                                    "type": "array",
                                    "items": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "enum": [
                                                "url"
                                              ]
                                            },
                                            "caption": {
                                              "type": "string"
                                            },
                                            "url": {
                                              "type": "string",
                                              "format": "starts_with",
                                              "pattern": "^https:\\/\\/.*"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "caption",
                                            "url"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "enum": [
                                                "call"
                                              ]
                                            },
                                            "caption": {
                                              "type": "string"
                                            },
                                            "phone": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "caption",
                                            "phone"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "enum": [
                                                "flow"
                                              ]
                                            },
                                            "caption": {
                                              "type": "string"
                                            },
                                            "target": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "caption",
                                            "target"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "enum": [
                                                "node"
                                              ]
                                            },
                                            "caption": {
                                              "type": "string"
                                            },
                                            "target": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "caption",
                                            "target"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  }
                                },
                                "required": [
                                  "type",
                                  "text"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "image"
                                    ]
                                  },
                                  "url": {
                                    "type": "string",
                                    "format": "starts_with",
                                    "pattern": "^https:\\/\\/.*"
                                  },
                                  "buttons": {
                                    "type": "array",
                                    "items": {
                                      "oneOf": [
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "enum": [
                                                "url"
                                              ]
                                            },
                                            "caption": {
                                              "type": "string"
                                            },
                                            "url": {
                                              "type": "string",
                                              "format": "starts_with",
                                              "pattern": "^https:\\/\\/.*"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "caption",
                                            "url"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "enum": [
                                                "call"
                                              ]
                                            },
                                            "caption": {
                                              "type": "string"
                                            },
                                            "phone": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "caption",
                                            "phone"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "enum": [
                                                "flow"
                                              ]
                                            },
                                            "caption": {
                                              "type": "string"
                                            },
                                            "target": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "caption",
                                            "target"
                                          ],
                                          "additionalProperties": false
                                        },
                                        {
                                          "type": "object",
                                          "properties": {
                                            "type": {
                                              "type": "string",
                                              "enum": [
                                                "node"
                                              ]
                                            },
                                            "caption": {
                                              "type": "string"
                                            },
                                            "target": {
                                              "type": "string"
                                            }
                                          },
                                          "required": [
                                            "type",
                                            "caption",
                                            "target"
                                          ],
                                          "additionalProperties": false
                                        }
                                      ]
                                    }
                                  }
                                },
                                "required": [
                                  "type",
                                  "url"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "file"
                                    ]
                                  },
                                  "url": {
                                    "type": "string",
                                    "format": "starts_with",
                                    "pattern": "^https:\\/\\/.*"
                                  }
                                },
                                "required": [
                                  "type",
                                  "url"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "actions": {
                          "maxItems": 5,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "enum": [
                                      "add_tag"
                                    ]
                                  },
                                  "tag_name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "action",
                                  "tag_name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "enum": [
                                      "remove_tag"
                                    ]
                                  },
                                  "tag_name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "action",
                                  "tag_name"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "enum": [
                                      "set_field_value"
                                    ]
                                  },
                                  "field_name": {
                                    "type": "string"
                                  },
                                  "value": {
                                    "anyOf": [
                                      {
                                        "type": "string"
                                      },
                                      {
                                        "type": "number"
                                      },
                                      {
                                        "type": "boolean"
                                      }
                                    ]
                                  }
                                },
                                "required": [
                                  "action",
                                  "field_name",
                                  "value"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "action": {
                                    "type": "string",
                                    "enum": [
                                      "unset_field_value"
                                    ]
                                  },
                                  "field_name": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "action",
                                  "field_name"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "quick_replies": {
                          "maxItems": 11,
                          "type": "array",
                          "items": {
                            "oneOf": [
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "flow"
                                    ]
                                  },
                                  "caption": {
                                    "type": "string"
                                  },
                                  "target": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "caption",
                                  "target"
                                ],
                                "additionalProperties": false
                              },
                              {
                                "type": "object",
                                "properties": {
                                  "type": {
                                    "type": "string",
                                    "enum": [
                                      "node"
                                    ]
                                  },
                                  "caption": {
                                    "type": "string"
                                  },
                                  "target": {
                                    "type": "string"
                                  }
                                },
                                "required": [
                                  "type",
                                  "caption",
                                  "target"
                                ],
                                "additionalProperties": false
                              }
                            ]
                          }
                        },
                        "external_message_callback": {
                          "type": "object",
                          "properties": {
                            "url": {
                              "type": "string",
                              "format": "starts_with",
                              "pattern": "^https:\\/\\/.*"
                            },
                            "method": {
                              "type": "string",
                              "enum": [
                                "post"
                              ]
                            },
                            "headers": {
                              "type": "object",
                              "additionalProperties": {
                                "type": "string"
                              }
                            },
                            "payload": {
                              "type": "object",
                              "additionalProperties": {}
                            },
                            "timeout": {
                              "type": "integer",
                              "minimum": 0,
                              "exclusiveMinimum": true,
                              "maximum": 86400
                            }
                          },
                          "required": [
                            "url",
                            "method",
                            "timeout"
                          ],
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "messages"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "required": [
                    "version",
                    "content"
                  ],
                  "additionalProperties": false
                }
              }
            }
          }
        }
      }
    }
  }
}