mooc piattaforme digitali per la gestione del territorio - 4.5
TRANSCRIPT
![Page 1: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/1.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
UNIT 4.5
Infrastrutture e tecnologie abilitantiTelegram come piattaforma
![Page 2: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/2.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Torniamo alle interfacce HTTP…
GET /repos/golang/goUser-Agent: NCSA Mosaic/1.0Host: api.github.com
![Page 3: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/3.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
HTTPHTTP/1.1 200 OKServer: GitHub.comContent-Type: application/jsonContent-Length: 5171{"id":23096959,"name":"go","full_name":"golang/go","private":false,"description":"The Go programminglanguage",...
![Page 4: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/4.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
HTTP Verbs
GET
POST
HEAD
PUT
DELETE
![Page 5: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/5.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
HTTP Status
200 OK
201 Created
301 Moved Permanently
400 Bad Request
403 Forbidden
404 Not Found
500 Internal Server Error
![Page 6: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/6.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
RESTful HTTP
GET /posts
GET /posts/1
GET /posts/1/comments
PUT /posts/1/comments
DELETE /posts/2
![Page 7: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/7.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIOPIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
![Page 8: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/8.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Postman
• Client RESTful
• Estensione Chrome o applicazione
• Testing di interfacce HTTP
• Interpretazione di formati standard JSON, XML, HTML
• Generazione automatica di codice per richieste HTTP
![Page 10: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/10.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Telegram
• Nikolai e Pavel Durov
• 100 milioni di utenti attivi
• 15 miliardi di messaggi al giorno
![Page 11: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/11.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Telegram
• Cloud-based
• Ogni account è legato ad un numero telefonico
• Basato su protocollo MTProto
• Gruppi numerosi
• Upload di file
![Page 12: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/12.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Piattaforma
• API e specifiche aperte
• Protocollo di comunicazione di basso livello
• Protocollo bot di alto livello
• Codice server chiuso
• Codice e librerie client open-source
https://telegram.org/apps#source-code
![Page 13: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/13.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Bot
1. Creazione mediante BotFather
2. Ricezione di Token
3. Ricezione/Invio messaggi
• Modalità pull
• Modalità push
![Page 14: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/14.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Bot API
• https://core.telegram.org/bots/api
![Page 15: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/15.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Bot API
• getMe
• sendMessage
• forwardMessage
• sendPhoto
• sendAudio
• sendDocument
• sendSticker
• sendVideo
• sendVoice
• sendLocation
• sendChatAction
• getUserProfilePhotos
• getUpdates
• setWebhook
• getFile
![Page 16: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/16.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Bot API
• getMe
• sendMessage
• sendLocation
• getUpdates
• setWebhook
https://api.telegram.org/bot<token>/METHOD_NAME
![Page 17: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/17.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Esercitazione
1. Registrazione Telegram
2. Creazione di un nuovo BOT
3. Test delle API (getMe)
4. Ricezione dei messaggi (modalità pull)
5. Invio di un messaggio testuale
6. Invio di un messaggio formattato
7. ReplyKeyboard
8. Invio di una posizione
![Page 18: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/18.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Bot API
getUpdates
![Page 19: MOOC Piattaforme digitali per la gestione del territorio - 4.5](https://reader034.vdocuments.net/reader034/viewer/2022042723/5870cb5d1a28ab64768b4761/html5/thumbnails/19.jpg)
PIATTAFORME DIGITALI PER LA GESTIONE DEL TERRITORIO
Bot API
setWebhook