Each app optionally gets its own bot. Bots have a name and an avatar, and you can use them to send and receive messages to and from your users.
What can I use a bot for?
What you use a bot for is limited only by your imagination:
- A reminder app can use a Reminder bot to send reminders
- A travel bot can let users search for and book flights through chat
- You can create a support bot to receive questions and provide answers to users
How do I get a bot for my app?
You can enable your app's bot during the app creation process in the Advanced info section. You will see your bot's identifier and bot token on enabling your Bot. Any messages sent to your app's bot will be sent at this identifier. You can use the token to make method calls on behalf of the bot e.g. sending messages to a user.
How do I set my Bot's name and Avatar?
Your bot will automatically assume your App's name followed by "Bot" and your App's icon as its default avatar
How will my App Bot be visible to my users?
Once you enable your bot, any users who install or have installed your app will see your app's bot in their contact list.
How do I send and receive messages using bots?
You can send a message using the chat.sendMessage method. Authenticate the method call using your bot's token.
POST /v1/chat.sendMessage HTTP/1.1 Host: api.flock.co Content-Type: application/x-www-form-urlencoded Content-Length: 70 to=u:513a9f4ae409&text=hello&token=632542db-1a23-4e06-8b39-01f8b0868d57
To receive a message, listen for the chat.receiveMessage event on your event listener URL.
{ "name": "chat.receiveMessage", "message": { "from": "<sender identifier>", "to": "<bot identifier>", "text": "<message text>" } }
Can a Bot join a group?
No.