Sign inSign up

bigslycat/tg-app-validate-service

By bigslycat

•Updated over 2 years ago

Telegram Mini App toolkit monorepo

Image
0

399

bigslycat/tg-app-validate-service repository overview

⁠tg-app-validate-service⁠

Publish Docker image

REST and GraphQL server for validating data received via the Telegram Mini App⁠.

⁠Usage

⁠Run Docker container

We use this docker image⁠:

ducker run bigslycat/tg-app-validate-service \
  -p 80:80 \
  -e BOT_TOKEN='...'
⁠GraphQL

You can send GraphQL requests to path /graphql and use GraphiQL playground on server root.

⁠GraphQL schema
type Query {
  webAppInitData(initData: String!): WebAppInitData!
}

type WebAppInitData {
  queryId: String
  user: WebAppUser
  receiver: WebAppUser
  chat: WebAppUser
  chatType: ChatType
  chatInstance: String
  startParam: String
  canSendAfter: Int
  authDate: Int!
  hash: String!
}

type WebAppUser {
  id: Int!
  isBot: Boolean
  firstName: String!
  lastName: String
  username: String
  languageCode: String
  isPremium: Boolean
  addedToAttachmentMenu: Boolean
  allowsWriteToPm: Boolean
  photoUrl: String
}

enum ChatType {
  SENDER
  PRIVATE
  GROUP
  SUPER_GROUP
  CHANNEL
}

schema {
  query: Query
}
⁠REST

You can send GET request to path /parse with initData in query string as is and receive WebAppUser JSON object in response:

GET /parse?<initData>
⁠OpenAPI

You can use OpenAPI in 3 ways:

  • Swagger-UI⁠. Just set SWAGGER_UI env variable:

    ducker run bigslycat/tg-app-validate-service \
      -p 80:80 \
      -e BOT_TOKEN='...'
      -e SWAGGER_UI=true
    

    And you can get the documentation this path: /swagger-ui.

  • RapiDoc⁠. Set RAPIDOC env variable:

    ducker run bigslycat/tg-app-validate-service \
      -p 80:80 \
      -e BOT_TOKEN='...'
      -e RAPIDOC=true
    

    And you can get the documentation this path: /rapidoc.

  • Redocly⁠. Set REDOC env variable:

    ducker run bigslycat/tg-app-validate-service \
      -p 80:80 \
      -e BOT_TOKEN='...'
      -e REDOC=true
    

    And you can get the documentation this path: /redoc.

Tag summary

Content type

Image

Digest

sha256:6951b0a58…

Size

11.7 MB

Last updated

over 2 years ago

docker pull bigslycat/tg-app-validate-service