Send Message

In order to be able to send a message to the user, you have to obtain a contact id. There are several ways how to get a contact - see Entry Points for a complete list.

For the purpose of this tutorial we will get contact id using a Facebook Messenger plug-in built into Amio app.

  1. In administration, go to Facebook Messenger channel detail. If you don't have any, connect Facebook Page first.
  2. Copy the channel ID in detail page for later use.
  3. Press the Send to Messenger button. It will send you a message to your Messenger account and will create a contact in Amio, see Send to Messenger button for more details.
572

๐Ÿ“˜

How to get a contact

There are several ways how to get a contact. All possible cases are listed in Entry Points chapter.

  1. Click on contacts tab and copy Id of your user.
  2. As a last attribute you will need organisation_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 Facebook Messenger 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, facebook_messenger.channel.id and facebook_messenger.contact.id.


Whatโ€™s Next

Receive incoming message.