aboutsummaryrefslogtreecommitdiff
path: root/examples/example_1.go
diff options
context:
space:
mode:
authorAlexander Kiryukhin <alexander@kiryukhin.su>2019-03-29 17:51:51 +0300
committerAlexander Kiryukhin <alexander@kiryukhin.su>2019-03-29 17:52:03 +0300
commit4f343e00669f96451bb5a11b7e83c7ecd8503e5a (patch)
treeb14f524a4ac7418c9df4a0eb790c44caa3200368 /examples/example_1.go
parent2c25c4bbfdd9b1c22c9375e8703c4ba0355417d7 (diff)
Api version 1.0.3
GetUpdatesLoop
Diffstat (limited to 'examples/example_1.go')
-rw-r--r--examples/example_1.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/examples/example_1.go b/examples/example_1.go
index 428b99a..a1fb967 100644
--- a/examples/example_1.go
+++ b/examples/example_1.go
@@ -1,5 +1,8 @@
// +build ignore
+/**
+ * Webhook example
+ */
package main
import (
@@ -23,9 +26,12 @@ func main() {
log.Printf("Get chat: %#v %#v", chat, err)
msgs, err := api.GetMessages(chats.Chats[0].ChatId, nil, 0, 0, 0)
log.Printf("Get messages: %#v %#v", msgs, err)
-
+ subs, _ := api.GetSubscriptions()
+ for _, s := range subs.Subscriptions {
+ _, _ = api.Unsubscribe(s.Url)
+ }
subscriptionResp, err := api.Subscribe(&tamtam.SubscriptionRequestBody{
- Url: "https://4940675e.ngrok.io/webhook", // Replace by your webhook!
+ Url: " https://576df2ec.ngrok.io/webhook", // Replace by your webhook!
})
log.Printf("Subscription: %#v %#v", subscriptionResp, err)