Skip to content

Instantly share code, notes, and snippets.

@yoshida-mediba
Last active September 13, 2016 06:55
Show Gist options
  • Save yoshida-mediba/87c71a2c38ee56172de8e8bd54364dfd to your computer and use it in GitHub Desktop.
Save yoshida-mediba/87c71a2c38ee56172de8e8bd54364dfd to your computer and use it in GitHub Desktop.
BacklogからIssueをとってきてTalknoteに投げるスクリプト
#!/bin/bash
apiurl="https://example.backlog.jp/api/v2/"
project="1"
apikey="apikey"
jqbody=".[].summary, .[].assignee.name, .[].dueDate"
function sendMailTalknote() {
head="Content-Type: text/plain; charset=ISO-2022-JP";
from="From: notifier@example.com"
addr="To: g-00000-000000@mail.talknote.com"
body="$1"
body=$(echo "${body}" | nkf -Wj)
echo -e "${from}\n${addr}\n${head}\n\n${body}" | /usr/sbin/sendmail -t -i
}
function getBacklogIssue() {
curl -sS "${apiurl}issues?projectId\[\]=${project}&count=1&dueDateSince=`date -I -d yesterday`&dueDateUntil=`date -I -d today`&apiKey=${apikey}" | jq -r "${jqbody}"
}
sendMailTalknote "$(getBacklogIssue)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment