Skip to content

Instantly share code, notes, and snippets.

@edele
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save edele/83ea5a104fefb6f9bd15 to your computer and use it in GitHub Desktop.

Select an option

Save edele/83ea5a104fefb6f9bd15 to your computer and use it in GitHub Desktop.

Создание карточки в трелло из Слэка

=>

Создаете слэшкоманду в Слэке и отправляете POST на указанный ниже php файл на своем серваке

Вам понадобятся:

<?php
header('Access-Control-Allow-Origin: *');

file_put_contents("log.json", json_encode($_POST));

if ($_POST["token"] !== "<<<SLACK_TOKEN>>>")
    exit("wrong token");

if (!isset($_POST["text"]))
    exit("text was not provided");

$text = htmlspecialchars($_POST["text"]);

if( $curl = curl_init() ) {
    curl_setopt($curl, CURLOPT_URL, 'https://api.trello.com/1/lists/<<<TRELLO_LIST_ID>>>/cards/');
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_POST, true);
    curl_setopt($curl, CURLOPT_POSTFIELDS, "key=<<<TRELLO_KEY>>>&token=<<<TRELLO_TOKEN>>>&name=$text&due=null");
    $out = curl_exec($curl);
    echo $out;
    curl_close($curl);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment