Description
When you get an email, you can get the specified URL from mail server.
When you send an email, put "X-Webhook-Keyword:[self-executing keyword]" as a header by mail client,
so that the specified URL can be acquired from mail server.
How to add a mail header is different for each mail client.
If you are not sure about how to add a mail header, please ask the developer of the mail client.
*One Email Address, one keyword, one URL.
Request URL
Mail API v1.0 POST /v1/emails/(uuid:email_id)/webhook
| Parameter | Value | Style | Type | Description |
|---|---|---|---|---|
| X-Auth-Token | - | header | string | User Token |
| email_id | - | URI | UUID | Email ID |
| webhook_url | - | plain | URL | Webhook URL |
| webhook_keyword | - | plain | string | Webhook Keyword |
Response Paramters
| Parameter | Value | Style | Type | Description |
|---|---|---|---|---|
| webhook | - | plain | dict | - |
| webhook_url | - | plain | URL | Webhook URL |
| webhook_keyword | - | plain | string | Webhook Keyword |
Request Json
{
"webhook_url":"http://www.example.com/foo.php?action=doing",
"webhook_keyword":"keyword"
}
Normal response codes
200 - Success
Error response codes
401 - Access Denied
404 - Not Found
409 - Duplicate
Repeatable
No
Example
curl -i -X POST \
-H "Accept: application/json" \
-H "X-Auth-Token: 39be9f8d53044388b7f2e867eba8b140" \
-d
'{
"webhook_url":"http://www.example.com/foo.php?action=doing",
"webhook_keyword":"keyword"
}' \
https://mail-hosting.tyo1.cloud.z.com/v1/emails/19c0ce1d-3839-4684-b080-692613bc6917/webhook
HTTP/1.1 200 Success
Date: Tue, 09 Dec 2014 01:46:58 GMT
Server: Apache
Content-Length: 1003
Content-Type: application/json
{
"webhook": {
"webhook_url": "http://webhook.example.com/asdf.asp",
"webhook_keyword": "keyword"
}
}