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

  1. In administration, open your Telegram channel. If you don't have any, connect Telegram first.
  2. Copy the channel ID in detail page for later use.
748
  1. 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".)
  2. As the last attribute, you will need organization_access_token. Go to Settings - API and copy your secret access token.
  3. 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!"
        }
      }'
  1. 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 and telegram.contact.id.


What’s Next