Send Message
Get the First Contact
In order to be able to send a message, you need to have a contact to send the message to. Open the Telegram bot you've connected in the previous tutorial and send it a message. We usually use the web version of Telegram.
Send a Message
- In administration, open your Telegram channel. If you don't have any, connect Telegram first.
- Copy the channel ID in detail page for later use.
- Go to Contacts tab and copy an ID of a contact. (If you don't see any, check the above section "Get the First Contact".)
- As the last attribute, you will need
organization_access_token
. Go to Settings - API and copy your secret access token. - Send a text message to the user using Send Text Message API.
curl -X POST \
https://api.amio.io/v1/messages \
-H 'authorization: Bearer {{organization_access_token}}' \
-H 'content-type: application/json' \
-d '{
"channel": {
"id": "{{channel_id}}"
},
"contact": {
"id": "{{contact_id}}"
},
"content": {
"type": "text",
"payload": "Hello world!"
}
}'
- Open your Telegram bot and observe that the message was received.
Postman
Use Postman to test all different message types. Don't forget to set environment properties:
access_token
,telegram.channel.id
andtelegram.contact.id
.
Updated over 5 years ago
What’s Next