Skip to content
This repository has been archived by the owner on Apr 5, 2020. It is now read-only.

Commit

Permalink
Webhook is receiving data from post variables
Browse files Browse the repository at this point in the history
  • Loading branch information
fguillot committed Oct 24, 2015
1 parent ef0425e commit 772b837
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Controller/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ public function receiver()
$this->checkWebhookToken();

$handler = new EmailHandler($this->container);
echo $handler->receiveEmail($this->request->getJson()) ? 'PARSED' : 'IGNORED';
echo $handler->receiveEmail($_POST) ? 'PARSED' : 'IGNORED';
}
}
6 changes: 3 additions & 3 deletions EmailHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,21 +63,21 @@ public function receiveEmail(array $payload)
$user = $this->user->getByEmail($envelope['from']);

if (empty($user)) {
$this->container['logger']->debug('SendgridWebhook: ignored => user not found');
$this->logger->debug('SendgridWebhook: ignored => user not found');
return false;
}

// The project must have a short name
$project = $this->project->getByIdentifier(Tool::getMailboxHash($sender));

if (empty($project)) {
$this->container['logger']->debug('SendgridWebhook: ignored => project not found');
$this->logger->debug('SendgridWebhook: ignored => project not found');
return false;
}

// The user must be member of the project
if (! $this->projectPermission->isMember($project['id'], $user['id'])) {
$this->container['logger']->debug('SendgridWebhook: ignored => user is not member of the project');
$this->logger->debug('SendgridWebhook: ignored => user is not member of the project');
return false;
}

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,10 @@ The Kanboard webhook url is displayed in **Settings > Integrations > Sendgrid**
1. Be sure that your users have an email address in their profiles
2. Assign a project identifier to the desired projects: **Project settings > Edit**
3. Try to send an email to your project: [email protected]

The sender must have the same email address in Kanboard and must be member of the project.

Troubleshooting
---------------

- Enable debug mode and check logs

0 comments on commit 772b837

Please sign in to comment.