messageapi / messageapi-php
Send and receive messages from any chat app, using one API
dev-master
2017-09-17 13:34 UTC
Requires
- php: >=5.3.2
This package is not auto-updated.
Last update: 2024-04-17 01:11:26 UTC
README
To authorize, use this code:
require_once ('messageapi.php'); $messageapi=new \messageapi\messageapi('<YOUR_APP_SECRET>');
Quick example:
Create Integration
$result=$messageapi->integrations->Create('{ "type":"line", "bot_id":"<BOT_ID>", "access_token":"<ACCESS_TOKEN>" }');
Create Customer
$result=$messageapi->customers->Create('{ "email":"email@domain.com", "line":{"user_id":"225451339750443406022273244"} }')
Send message
$result=$messageapi->messaging->SendMessage('{ "_customer_id":"customer_id", "messengerType":"line", "message":{ "type":"text", "content":"your text" } }')
Add Webhook
$result=$messageapi->webhooks->Create('{ "event":"received_message", "webhook_url":"http://yourpath.com/path" }')
More Examples:
Integrations
Get
$messageapi->integrations->Get('<ID_INTEGRATION>');
$messageapi->integrations->GetAll();
Create
$messageapi->integrations->Create('{ "type":"line", "bot_id":"<BOT_ID>", "access_token":"<ACCESS_TOKEN>"}');
Update
$messageapi->integrations->Update('<ID_INTEGRATION>','{ "type":"line", "bot_id":"<BOT_ID>", "access_token":"<ACCESS_TOKEN>"}');
Delete
$messageapi->integrations->Remove('<ID_INTEGRATION>');
Customers
Get
$messageapi->customers->Get('<ID_CUSTOMER>');
$messageapi->customers->GetAll();
Create
$messageapi->customers->Create('{ "email":"email@domain.com", "line":{"user_id":"<USER_ID_OF_LINE>"}}');
Update
$messageapi->customers->Create('<ID_CUSTOMER>','{ "email":"email@domain.com", "line":{"user_id":"<USER_ID_OF_LINE>"}}');
Delete
$messageapi->customers->Remove('<ID_CUSTOMER>');