send message to group
Closed this issue · 1 comments
dear , I'm sorry for my dumb question , but how to send the message into group ya ,, ? already I got the JID from the GET /api/v1/whatsapp/group, but using those JID as msisdn when send text , I'm trying using new created group , I just got below return:
{
"code": 500,
"status": false,
"message": "",
"data": {
"msgid": "",
"phone_number": "120363161465055095"
}
}
when I'm trying using old JID that having '-' , I got panic with below error messages :
{"time":"2023-08-10T11:24:05.27493061Z","level":"-","prefix":"echo","file":"recover.go","line":"113","message":"[PANIC RECOVER] runtime error: index out of range [0] with length 0 goroutine 347969 [running]:\ngithub.com/labstack/echo/v4/middleware.RecoverWithConfig.func1.1.1()\n\t/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/recover.go:93 +0x14e\npanic({0x1060d60, 0xc00003a438})\n\t/usr/local/go/src/runtime/panic.go:884 +0x212\ngo-whatsapp-multidevice-rest/pkg/whatsapp.WhatsAppGetJID({0xc000ef0550, 0xd}, {0xc000660280, 0x1b})\n\t/go/src/go-whatsapp-multidevice-rest/pkg/whatsapp/whatsapp.go:299 +0x225\ngo-whatsapp-multidevice-rest/pkg/whatsapp.WhatsAppSendText({0x1ae7af8, 0xc000a3c4c0}, {0xc000ef0550, 0xd}, {0xc000a1e21c, 0x16}, {0xc000ef05e0, 0xc})\n\t/go/src/go-whatsapp-multidevice-rest/pkg/whatsapp/whatsapp.go:375 +0x1a5\ngo-whatsapp-multidevice-rest/internal/whatsapp.SendText({0x1af56f8, 0xc0008421e0})\n\t/go/src/go-whatsapp-multidevice-rest/internal/whatsapp/whatsapp.go:177 +0x173\ngithub.com/labstack/echo/v4/middleware.JWTWithConfig.func1.1({0x1af56f8, 0xc0008421e0})\n\t/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/jwt.go:236 +0x3c4\ngithub.com/labstack/echo/v4.(*Echo).add.func1({0x1af56f8, 0xc0008421e0})\n\t/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/echo.go:575 +0x51\ngo-whatsapp-multidevice-rest/pkg/router.HttpRealIP.func1.1({0x1af56f8, 0xc0008421e0})\n\t/go/src/go-whatsapp-multidevice-rest/pkg/router/middleware.go:24 +0x19f\ngithub.com/SporkHubr/echo-http-cache.(*Client).Middleware.func1.1({0x1af56f8, 0xc0008421e0})\n\t/go/src/go-whatsapp-multidevice-rest/vendor/github.com/SporkHubr/echo-http-cache/cache.go:197 +0x910\ngithub.com/labstack/echo/v4/middleware.BodyLimitWithConfig.func1.1({0x1af56f8?, 0xc0008421e0})\n\t/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/body_limit.go:87 +0x1b2\ngithub.com/labstack/echo/v4/middleware.SecureWithConfig.func1.1({0x1af56f8, 0xc0008421e0})\n\t/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/secure.go:142 +0x966\ngithub.com/labstack/echo/v4/middleware.CORSWithConfig.func1.1({0x1af56f8, 0xc0008421e0})\n\t/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/cors.go:199 +0x47e\ngithub.com/labstack/echo/v4/middleware.GzipWithConfig.func1.1({0x1af56f8, 0xc0008421e0})\n\t/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/compress.go:98 +0x423\ngithub.com/labstack/echo/v4/middleware.RecoverWithConfig.func1.1({0x1af56f8, 0xc0008421e0})\n\t/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/recover.go:119 +0xfe\ngithub.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc00049a900, {0x1ae6f98?, 0xc00083a700}, 0xc000832400)\n\t/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/echo.go:662 +0x3d1\nnet/http.serverHandler.ServeHTTP({0x1ae48a0?}, {0x1ae6f98, 0xc00083a700}, 0xc000832400)\n\t/usr/local/go/src/net/http/server.go:2941 +0x30c\nnet/http.(*conn).serve(0xc0004326e0, {0x1ae7ba0, 0xc000a1c180})\n\t/usr/local/go/src/net/http/server.go:1991 +0x607\ncreated by net/http.(*Server).Serve\n\t/usr/local/go/src/net/http/server.go:3096 +0x4db\n\ngoroutine 1 [chan receive, 45193 minutes]:\nmain.main()\n\t/go/src/go-whatsapp-multidevice-rest/cmd/main/main.go:152 +0xe35\n\ngoroutine 7 [select, 45193 minutes]:\ndatabase/sql.(*DB).connectionOpener(0xc0005d2750, {0x1ae7af8, 0xc0004d2f80})\n\t/usr/local/go/src/database/sql/sql.go:1224 +0x8d\ncreated by database/sql.OpenDB\n\t/usr/local/go/src/database/sql/sql.go:792 +0x18d\n\ngoroutine 122043 [chan send, 34834 minutes]:\ngo-whatsapp-multidevice-rest/pkg/whatsapp.WhatsAppGenerateQR.func1()\n\t/go/src/go-whatsapp-multidevice-rest/pkg/whatsapp/whatsapp.go:161 +0xe9\ncreated by go-whatsapp-multidevice-rest/pkg/whatsapp.WhatsAppGenerateQR\n\t/go/src/go-whatsapp-multidevice-rest/pkg/whatsapp/whatsapp.go:158 +0xae\n\ngoroutine 122305 [chan send, 34828 minutes]:\ngo-whatsapp-multidevice-rest/pkg/whatsapp.WhatsAppGenerateQR.func1()\n\t/go/src/go-whatsapp-multidevice-rest/pkg/whatsapp/whatsapp.go:161 +0xe9\ncreated by go-whatsapp-multidevice-rest/pkg/whatsapp.WhatsAppGenerateQR\n\t/go/src/go-whatsapp-multidevice-rest/pkg/whatsapp/whatsapp.go:158 +0x\n"}
echo: http: panic serving 192.168.88.1:52600: runtime error: invalid memory address or nil pointer dereference
goroutine 347969 [running]:
net/http.(*conn).serve.func1()
/usr/local/go/src/net/http/server.go:1850 +0xbf
panic({0xfaa9e0, 0x22806f0})
/usr/local/go/src/runtime/panic.go:890 +0x262
go-whatsapp-multidevice-rest/pkg/router.HttpErrorHandler({0x7f19e77a3f40?, 0xc00003a438?}, {0x1af56f8, 0xc0008421e0})
/go/src/go-whatsapp-multidevice-rest/pkg/router/handler.go:15 +0x48
github.com/labstack/echo/v4.(*context).Error(0xc000709900?, {0x7f19e77a3f40?, 0xc00003a438?})
/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/context.go:607 +0x3e
github.com/labstack/echo/v4/middleware.RecoverWithConfig.func1.1.1()
/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/recover.go:116 +0x58b
panic({0x1060d60, 0xc00003a438})
/usr/local/go/src/runtime/panic.go:884 +0x212
go-whatsapp-multidevice-rest/pkg/whatsapp.WhatsAppGetJID({0xc000ef0550, 0xd}, {0xc000660280, 0x1b})
/go/src/go-whatsapp-multidevice-rest/pkg/whatsapp/whatsapp.go:299 +0x225
go-whatsapp-multidevice-rest/pkg/whatsapp.WhatsAppSendText({0x1ae7af8, 0xc000a3c4c0}, {0xc000ef0550, 0xd}, {0xc000a1e21c, 0x16}, {0xc000ef05e0, 0xc})
/go/src/go-whatsapp-multidevice-rest/pkg/whatsapp/whatsapp.go:375 +0x1a5
go-whatsapp-multidevice-rest/internal/whatsapp.SendText({0x1af56f8, 0xc0008421e0})
/go/src/go-whatsapp-multidevice-rest/internal/whatsapp/whatsapp.go:177 +0x173
github.com/labstack/echo/v4/middleware.JWTWithConfig.func1.1({0x1af56f8, 0xc0008421e0})
/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/jwt.go:236 +0x3c4
github.com/labstack/echo/v4.(*Echo).add.func1({0x1af56f8, 0xc0008421e0})
/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/echo.go:575 +0x51
go-whatsapp-multidevice-rest/pkg/router.HttpRealIP.func1.1({0x1af56f8, 0xc0008421e0})
/go/src/go-whatsapp-multidevice-rest/pkg/router/middleware.go:24 +0x19f
github.com/SporkHubr/echo-http-cache.(*Client).Middleware.func1.1({0x1af56f8, 0xc0008421e0})
/go/src/go-whatsapp-multidevice-rest/vendor/github.com/SporkHubr/echo-http-cache/cache.go:197 +0x910
github.com/labstack/echo/v4/middleware.BodyLimitWithConfig.func1.1({0x1af56f8?, 0xc0008421e0})
/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/body_limit.go:87 +0x1b2
github.com/labstack/echo/v4/middleware.SecureWithConfig.func1.1({0x1af56f8, 0xc0008421e0})
/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/secure.go:142 +0x966
github.com/labstack/echo/v4/middleware.CORSWithConfig.func1.1({0x1af56f8, 0xc0008421e0})
/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/cors.go:199 +0x47e
github.com/labstack/echo/v4/middleware.GzipWithConfig.func1.1({0x1af56f8, 0xc0008421e0})
/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/compress.go:98 +0x423
github.com/labstack/echo/v4/middleware.RecoverWithConfig.func1.1({0x1af56f8, 0xc0008421e0})
/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/middleware/recover.go:119 +0xfe
github.com/labstack/echo/v4.(*Echo).ServeHTTP(0xc00049a900, {0x1ae6f98?, 0xc00083a700}, 0xc000832400)
/go/src/go-whatsapp-multidevice-rest/vendor/github.com/labstack/echo/v4/echo.go:662 +0x3d1
net/http.serverHandler.ServeHTTP({0x1ae48a0?}, {0x1ae6f98, 0xc00083a700}, 0xc000832400)
/usr/local/go/src/net/http/server.go:2941 +0x30c
net/http.(*conn).serve(0xc0004326e0, {0x1ae7ba0, 0xc000a1c180})
/usr/local/go/src/net/http/server.go:1991 +0x607
created by net/http.(*Server).Serve
/usr/local/go/src/net/http/server.go:3096 +0x4db
can somebody explain me on how to send message to group please ?
Thank you in advance for any help
Hai @wahyu-pratomo /api/v1/whatsapp/group is to GET any group joined by the msisdn
if you want to sent message to group use /api/v1/whatsapp/send/text use POST method where the msisdn in the Group ID (GID)