Send message through Amio API

In previous tutorial, we have made a webpage that can send and receive messages through Amio Chat. We will now test that when a message is sent through Amio API, we will receive that message in the webpage.

📘

Postman

We recommend you to test different API calls via Postman. Setup takes about 3 minutes.

Send message

Send a text message to your Amio Chat channel using Send Text Message API. To make the call below work, replace the placeholders:

  • {{channel_id}} - is located in your Amio Chat channel in administration
  • {{contact_id}} - is under Contacts tab of your channel. There should be at least one contact, since we have already sent some messages in the previous step of this tutorial.
  • {{organization_access_token}} - find it in Settings - 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!"
  }
}'

Check browser received message

Open your chat in the browser. If you followed the previous tutorials, you should see a similar view.

1859