How to send a http post request in action?

I tried with something below, there is no error, but it just not invoke. Did I miss anything when declaring the API? Any help appreciated? Thanks

“post”: {
“operationId”: “http post”,
“summary”: “http post action”,
“requestBody”: {
“content”: {
“application/json”: {
“schema”: {
“$ref”: “#/components/schemas/RunRequest”
}
}
},
“required”: true
}

    }

“RunRequest”: {
“title”: “RunRequest”,
“description”: " “,
“type”: “object”,
“properties”: {
“to”: {
“title”: “to number”,
“description”: “send to this number”,
“default”:”+491767355",
“type”: “string”
},
“content”: {
“title”: “content”,
“description”: “send content.”,
“default”:“hello gpt”,
“type”: “string”
}
}

    }
1 Like

I was only able to get it to work by not using any $refs in the body… So put the full definition directly in the post instead of referencing a schema.

thanks for the help!

Tried with no refs as below but still not work, mind share yours for my ref.?

“post”: {
“operationId”: “http post”,
“summary”: “http post action”,
“requestBody”: {
“content”: {
“application/json”: {
“schema”: {
“title”: “RunRequest”,
“description”: " ",
“type”: “object”,
“properties”: {
“to”: {
“title”: “to number”,
“description”: “send to this number”,
“default”:“1234”,
“type”: “string”
},
“content”: {
“title”: “content”,
“description”: “send content.”,
“default”:“hello gpt”,
“type”: “string”
}
}
}
}
},
“required”: true
}

    }

Having the same issues here. Will be great to see an example of this working.

So I managed to get something working here… I had to delete the action and re-create one. I think it was saving some incorrect config in cache.

Here is an example:

{
“openapi”: “3.1.0”,
“info”: {
“title”: “Text”,
“description”: “Sends text to teams”,
“version”: “v1.0.0”
},
“servers”: [
{
“url”: “<webhook_url>”
}
],
“paths”: {
“/”: {
“post”: {
“description”: “send test to teams”,
“operationId”: “Text”,
“parameters”: ,
“requestBody”: {
“content”: {
“application/json”: {
“schema”: {
“properties”: {
“text”: {
“type”: “string”,
“description”: “Text to be sent in message”
}
},
“type”: “object”,
“required”: [
“text”
],
“title”: “Text”
}
}
}
}
},
}
},
“components”: {
“schemas”: {
“Text”: {
“properties”: {
“text”: {
“type”: “string”,
“description”: “Text to be sent in message”
}
},
“type”: “object”,
“required”: [
“text”
],
“title”: “Message”
}
}
}
}

Schema isn’t used in this case

I am having the same issue, this is my schema -

{
  "openapi": "3.1.0",
  "info": {
    "title": "Combined Conversation and Completion API",
    "description": "API for managing conversation threads and handling text completion requests.",
    "version": "v1.0.0"
  },
  "servers": [
    {
      "url": "server-domain"
    }
  ],
  "paths": {
    "/start": {
      "get": {
        "description": "Start a new conversation thread",
        "operationId": "StartConversation",
        "parameters": [],
        "security": [
          {
            "basicAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response with new thread ID",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "thread_id": {
                      "type": "string",
                      "description": "Unique identifier for the newly created thread"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized - Invalid or missing API key"
          },
          "500": {
            "description": "Internal Server Error"
          }
        },
        "deprecated": false
      }
    },
    "/get-completion": {
      "post": {
        "description": "Asynchronously handles a text completion request",
        "operationId": "AsyncTextCompletion",
        "requestBody": {
          "description": "Data for completion request",
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "thread_id": {
                    "type": "string",
                    "description": "Unique identifier for the thread"
                  },
                  "message": {
                    "type": "string",
                    "description": "User input message for processing"
                  }
                },
                "required": ["thread_id", "message"]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response with completion data",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "response": {
                      "type": "string",
                      "description": "Processed response from the server"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request - Missing or invalid parameters"
          },
          "500": {
            "description": "Internal Server Error"
          }
        },
        "deprecated": false
      }
    }
  },
  "components": {
    "schemas": {},
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  }
}

I first make a GET request to the backend (That works fine), the GET request (/start) returns the thread_id, the thread_id is passed along with the POST request (/get-completion) with the prompt entered, but the POST (/get-completion) request is being received as a GET request on the back end, there are no $ref variables being used in my schema, and I deleted it and recreated it too, still no luck, Even after deleting the Custom GPT bot and creating a new one the issue persists

Is this the same issue as described here: Can't manage to use "body" for my custom GPT. It always uses "params" ?

This is the actions I use:
openapi: 3.0.1
info:
title: OpenAI Assistants API Plugin
description: A plugin to interact with OpenAI’s Assistants API, retrieving a list of assistants with sorting and limit options.
version: v1
servers:

  • url: https://api.openai.com/v1
    paths:
    /assistants:
    get:
    operationId: getAssistants
    summary: Retrieve a list of assistants
    parameters:
    - name: order
    in: query
    required: false
    schema:
    type: string
    description: Order of the assistants, either asc or desc
    - name: limit
    in: query
    required: false
    schema:
    type: integer
    description: Number of assistants to retrieve, up to 20
    responses:
    “200”:
    description: A list of assistants
    content:
    application/json:
    schema:
    type: object
    properties:
    object:
    type: string
    data:
    type: array
    items:
    $ref: “#/components/schemas/Assistant”
    first_id:
    type: string
    last_id:
    type: string
    has_more:
    type: boolean
    components:
    schemas:
    Assistant:
    type: object
    properties:
    id:
    type: string
    object:
    type: string
    created_at:
    type: integer
    name:
    type: string
    nullable: true
    description:
    type: string
    nullable: true
    model:
    type: string
    instructions:
    type: string
    nullable: true
    tools:
    type: array
    items:
    type: string
    file_ids:
    type: array
    items:
    type: string
    metadata:
    type: object
    securitySchemes:
    apiKeyAuth:
    type: apiKey
    in: header
    name: Authorization
    security:
  • apiKeyAuth:

But I get a response of:
{
“response_data”: {
“error”: {
“message”: “Invalid URL (GET /v1/assistants)”,
“type”: “invalid_request_error”,
“param”: null,
“code”: null
}
},
“status_code”: 404,
“action_id”: “<<<< I changed the action ID >>>>>>>”
}

This is just to enable GPT to list the assistants in my openai account. So if I can get this to work simply I just setup a GPT to edit my assistants etc.

I lost many days on this, and I think it is going to be something truely simple that I am just not doing.

Can you wrap your code in ``` ? It’s quite difficult to follow otherwise