Golang module for working with VK API

VK SDK for Golang

Build Status PkgGoDev VK Developers codecov VK chat release license

VK SDK for Golang ready implementation of the main VK API functions for Go.

Russian documentation

Features

Version API 5.131.

  • API
    • 400+ methods
    • Ability to change the request handler
    • Ability to modify HTTP client
    • Request Limiter
    • Token pool
  • Callback API
    • Tracking tool for users activity in your VK communities
    • Supports all events
    • Auto setting callback
  • Bots Long Poll API
    • Allows you to work with community events in real time
    • Supports all events
    • Ability to modify HTTP client
  • User Long Poll API
    • Allows you to work with user events in real time
    • Ability to modify HTTP client
  • Streaming API
    • Receiving public data from VK by specified keywords
    • Ability to modify HTTP client
  • FOAF
    • Machine-readable ontology describing persons
    • Works with users and groups
    • The only place to get page creation date
  • Games
    • Checking launch parameters
    • Intermediate http handler
  • VK Mini Apps
    • Checking launch parameters
    • Intermediate http handler
  • Payments API
    • Processes payment notifications
  • Marusia Skills
    • For creating Marusia Skills
    • Support SSML

Install

# go mod init mymodulename
go get github.com/SevereCloud/vksdk/v2@latest

Use by

Example

package main

import (
	"context"
	"log"

	"github.com/SevereCloud/vksdk/v2/api"
	"github.com/SevereCloud/vksdk/v2/api/params"
	"github.com/SevereCloud/vksdk/v2/events"
	"github.com/SevereCloud/vksdk/v2/longpoll-bot"
)

func main() {
	token := "<TOKEN>" // use os.Getenv("TOKEN")
	vk := api.NewVK(token)

	// get information about the group
	group, err := vk.GroupsGetByID(nil)
	if err != nil {
		log.Fatal(err)
	}

	// Initializing Long Poll
	lp, err := longpoll.NewLongPoll(vk, group[0].ID)
	if err != nil {
		log.Fatal(err)
	}

	// New message event
	lp.MessageNew(func(_ context.Context, obj events.MessageNewObject) {
		log.Printf("%d: %s", obj.Message.PeerID, obj.Message.Text)

		if obj.Message.Text == "ping" {
			b := params.NewMessagesSendBuilder()
			b.Message("pong")
			b.RandomID(0)
			b.PeerID(obj.Message.PeerID)

			_, err := vk.MessagesSend(b.Params)
			if err != nil {
				log.Fatal(err)
			}
		}
	})

	// Run Bots Long Poll
	log.Println("Start Long Poll")
	if err := lp.Run(); err != nil {
		log.Fatal(err)
	}
}

LICENSE

FOSSA Status

Comments
  • Не работают некоторые методы в Long Poll

    Не работают некоторые методы в Long Poll

    подключаю сообщество, и мне приходят сообщения только с типом

    lp.MessageNew(func(ctx context.Context, mno events.MessageNewObject) {
    		fmt.Println(mno.Message.Text)
    	})
    

    Typing, Read, Edit, Delete - почему то у меня не доходят из вк

  • Fix track_id type in marusia skill

    Fix track_id type in marusia skill

    Fix track_id type to int according to example: https://dev.vk.com/marusia/player#player_status.

    {
        "client_player_status": {
            "track_id": 456239080
        }
    }
    
  • [bug] wall.get error

    [bug] wall.get error

    Привет, такая ошибка на wall.get, похоже что когда на стене в посте есть вложение "товар"

    json: cannot unmarshal bool into Go struct field WallWallpostAttachment.items.attachments.market of type object.MarketMarketItem
    
  • BanInfo может не быть в GroupsGroup

    BanInfo может не быть в GroupsGroup

    Как определить, заблокирован я в сообществе или нет? SDK по умолчанию определяет тип BanInfo как ненулевую структуру.

    ВК пишут, что ban_info может возвращаться только если получать группу отдельно (через https://dev.vk.com/method/groups.getById). Но опять же, информации о блокировке там может не быть.

  • chore(deps): bump github.com/klauspost/compress from 1.15.9 to 1.15.13

    chore(deps): bump github.com/klauspost/compress from 1.15.9 to 1.15.13

    Bumps github.com/klauspost/compress from 1.15.9 to 1.15.13.

    Release notes

    Sourced from github.com/klauspost/compress's releases.

    v1.15.13

    What's Changed

    Full Changelog: https://github.com/klauspost/compress/compare/v1.15.12...v1.15.13

    v1.15.12

    What's Changed

    Full Changelog: https://github.com/klauspost/compress/compare/v1.15.11...v1.15.12

    v1.15.11

    What's Changed

    New Contributors

    Full Changelog: https://github.com/klauspost/compress/compare/v1.15.10...v1.15.11

    v1.15.10

    What's Changed

    ... (truncated)

    Commits
    • 6810f22 zstd: Import xxhash v2.2.0 (#708)
    • 0d2a371 zstd: sync xxhash with final accepted patch upstream (#707)
    • a0c1f61 zstd: Select best match using selection trees (#706)
    • 48791b0 zstd: Improve best compression's match selection (#705)
    • e5c6ce2 huff0: Check for zeros earlier in Scratch.countSimple (#704)
    • dfaad36 zstd: Use individual reset threshold (#703)
    • d3349be zstd: Write table clearing in a way that the compiler recognizes (#702)
    • b7c48cb zstd: Rewrite matchLen to make it inlineable (#701)
    • 6efddf2 zstd: Revert #699 (#700)
    • 2878205 zstd: Improve throughput of SpeedBestCompression encoder (#699)
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • Проблема с получением множественных аттачментов в LongPoll

    Проблема с получением множественных аттачментов в LongPoll

    Если количество фото в сообщении > 5 то почему то в

    obj vktypes.MessagesMessage
    logValue,_ := json.Marshal(obj)
    logger.Infof(ctx,"Incoming raw message from vk: %s",string(logValue))
    

    будет только 1ое фото, которое было приложенно

    "attachments": [
            {
              ...,
              "photo":{
                    "sizes": [
                        {
                            "height": 78,
                            "url": "https://sun4-15.userapi.com/s/v1/if2/6gkD070_CULm4aaOYFR29xGH0iA2KIigSkaCm-QzB3O1qTeFvlUqYICFU3LSI2mTOp8WWK70vXNH1i5XA_8Ekssz.jpg?size=130x78\u0026quality=96\u0026type=album",
                            "width": 130,
                            "type": "m"
                        },
             ....
                    ],
                    "thumb_id": 0,
                    "thumb_src": "",
                    "title": "",
                    "updated": 0,
                    "color": ""
                },
    

    image

    на меньшее кол-во аттачментов: все ок

    Go version: 1.18 весрия либы: github.com/SevereCloud/vksdk/v2 v2.14.0

  • chore(deps): bump github.com/klauspost/compress from 1.15.9 to 1.15.12

    chore(deps): bump github.com/klauspost/compress from 1.15.9 to 1.15.12

    Bumps github.com/klauspost/compress from 1.15.9 to 1.15.12.

    Release notes

    Sourced from github.com/klauspost/compress's releases.

    v1.15.12

    What's Changed

    Full Changelog: https://github.com/klauspost/compress/compare/v1.15.11...v1.15.12

    v1.15.11

    What's Changed

    New Contributors

    Full Changelog: https://github.com/klauspost/compress/compare/v1.15.10...v1.15.11

    v1.15.10

    What's Changed

    Full Changelog: https://github.com/klauspost/compress/compare/v1.15.9...v1.15.10

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump golang.org/x/text from 0.3.7 to 0.4.0

    chore(deps): bump golang.org/x/text from 0.3.7 to 0.4.0

    Bumps golang.org/x/text from 0.3.7 to 0.4.0.

    Commits
    • 1bdb400 language: remove compatibility with go < 1.2
    • 252bee0 go.mod: ignore cyclic dependency for tagging
    • ecab6e5 go.mod: ignore cyclic dependency for tagging
    • 369c86b all: fix a few function names on comments
    • 434eadc language: reject excessively large Accept-Language strings
    • 23407e7 go.mod: ignore cyclic dependency for tagging
    • b18d3dd secure/precis: replace bytes.Compare with bytes.Equal
    • 795e854 all: replace io/ioutil with io and os package
    • b0ca10f internal/language: bump script types to uint16 and update registry
    • ba9b0e1 go.mod: update x/tools to HEAD
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump golang.org/x/text from 0.3.7 to 0.3.8

    chore(deps): bump golang.org/x/text from 0.3.7 to 0.3.8

    Bumps golang.org/x/text from 0.3.7 to 0.3.8.

    Commits
    • 434eadc language: reject excessively large Accept-Language strings
    • 23407e7 go.mod: ignore cyclic dependency for tagging
    • b18d3dd secure/precis: replace bytes.Compare with bytes.Equal
    • 795e854 all: replace io/ioutil with io and os package
    • b0ca10f internal/language: bump script types to uint16 and update registry
    • ba9b0e1 go.mod: update x/tools to HEAD
    • d03b418 A+C: delete AUTHORS and CONTRIBUTORS
    • b4bca84 language/display: fix Tag method comment
    • ea49e3e go.mod: update x/tools to HEAD
    • 78819d0 go.mod: update to golang.org/x/text v0.1.10
    • Additional commits viewable in compare view

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/klauspost/compress from 1.15.9 to 1.15.11

    chore(deps): bump github.com/klauspost/compress from 1.15.9 to 1.15.11

    Bumps github.com/klauspost/compress from 1.15.9 to 1.15.11.

    Release notes

    Sourced from github.com/klauspost/compress's releases.

    v1.15.11

    What's Changed

    New Contributors

    Full Changelog: https://github.com/klauspost/compress/compare/v1.15.10...v1.15.11

    v1.15.10

    What's Changed

    Full Changelog: https://github.com/klauspost/compress/compare/v1.15.9...v1.15.10

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
  • chore(deps): bump github.com/klauspost/compress from 1.15.9 to 1.15.10

    chore(deps): bump github.com/klauspost/compress from 1.15.9 to 1.15.10

    Bumps github.com/klauspost/compress from 1.15.9 to 1.15.10.

    Release notes

    Sourced from github.com/klauspost/compress's releases.

    v1.15.10

    What's Changed

    Full Changelog: https://github.com/klauspost/compress/compare/v1.15.9...v1.15.10

    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
A GO API library for working with Marathon

Go-Marathon Go-marathon is a API library for working with Marathon. It currently supports Application and group deployment Helper filters for pulling

Dec 28, 2022
A Go client for working with the Cryptohopper API

GoGoCryptohopper A Go client for working with the Cryptohopper API Structure of the client Request/Response The definitions for request and response f

Dec 23, 2021
Go module for communicating with the Veryfi OCR API
Go module for communicating with the Veryfi OCR API

veryfi-go is a Go module for communicating with the Veryfi OCR API Installing This package can be installed by cloning this directory: git clone https

Jan 5, 2023
Go SDK for working with the Nightfall Developer Platform

Nightfall Go SDK nightfall-go-sdk is a Go client library for accessing the Nightfall API. It allows you to add functionality to your applications to s

Jun 20, 2022
Repo for working on Cloud-based projects in Go

GoCloud Repo for working on Cloud-based projects in Go AWS checkout SDK: https://github.com/awsdocs/aws-doc-sdk-examples/tree/main/gov2/s3 cd into /ho

Jan 10, 2022
Gophercises-quiz-one - Working solution of Gophercises Quiz 1 Course

Gophercises Quiz 1 Working Solution Description Create a program that will read

Feb 2, 2022
Go package providing opinionated tools and methods for working with the `aws-sdk-go/service/cloudfront` package.

go-aws-cloudfront Go package providing opinionated tools and methods for working with the aws-sdk-go/service/cloudfront package. Documentation Tools $

Feb 2, 2022
Golang ergonomic declarative generics module inspired by Rust, including Result, Option, and more.

gust Golang ergonomic declarative generics module inspired by Rust. Go Version go≥1.18 Features Result Avoid if err != nil, handle result with chain m

Jan 7, 2023
Simple-Weather-API - Simple weather api app created using golang and Open Weather API key
Simple-Weather-API - Simple weather api app created using golang and Open Weather API key

Simple Weather API Simple weather api app created using golang and Open Weather

Feb 6, 2022
Go module to work with Postman Collections

go-postman-collection Go module to work with Postman Collections. This module aims to provide a simple way to work with Postman collections. Using thi

Dec 29, 2022
This program performs stress testing for the Cosmos module

Cosmos Modules Testing Program ?? Overview This program performs stress testing for the Cosmos module. Support: Liquidity , IBC transfer Note: Require

May 25, 2022
A Lambda function built with SAM (Serverless Application Module)

AWS SAM Lambda Function © Israel Pereira Tavares da Silva The AWS Serverless Application Model (SAM) is an open-source framework for building serverle

Dec 19, 2021
An API client for the Notion API implemented in Golang

An API client for the Notion API implemented in Golang

Dec 30, 2022
A API scanner written in GOLANG to scan files recursively and look for API keys and IDs.

GO FIND APIS _____ ____ ______ _____ _ _ _____ _____ _____ _____ / ____|/ __ \ | ____|_ _| \ | | __ \ /\ | __ \_

Oct 25, 2021
Arweave-api - Arweave API implementation in golang

Arweave API Go implementation of the Arweave API Todo A list of endpoints that a

Jan 16, 2022
Reservationbox-api - Reservationbox Api with golang
Reservationbox-api - Reservationbox Api with golang

reservationbox-api How to set up application Cloning git on this link : https://

Jan 30, 2022
Go api infra - Infrastructure for making api on golang so easy

Go Infra Api Infrastructre methods and types for make api simple Response abstra

Jun 18, 2022
A GoLang wrapper for Politics & War's API. Forego the hassle of accessing the API directly!

A GoLang wrapper for Politics & War's API. Forego the hassle of accessing the API directly!

Mar 5, 2022
Golang API for Whatsapp API MultiDevice version
Golang API for Whatsapp API MultiDevice version

Go Whatsapp API Multi Device Version Required Mac OS: brew install vips export C

Jan 3, 2023