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.
- In administration, go to Facebook Messenger channel detail. If you don't have any, connect Facebook Page first.
- Copy the channel ID in detail page for later use.
- 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.
How to get a contact
There are several ways how to get a contact. All possible cases are listed in Entry Points chapter.
- Click on contacts tab and copy Id of your user.
- As a last attribute you will need
organisation_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 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
andfacebook_messenger.contact.id
.
Updated about 1 month ago