A library for registering the contents of Trello to kintone.
See here for sample code for transcribing Trello Card to kintone using Trekin. https://github.com/korosuke613/trekin-sample
Use the package manager npm to install trekin.
npm i trekin
- createCard
- updateCard
- copyCard
- createList
- updateList
- createLabel
- updateLabel
- addLabelToCard
- removeLabelFromCard
- addMemberToCard
- removeMemberFromCard
- commentCard
- addAttachmentToCard
https://developer.atlassian.com/cloud/trello/guides/rest-api/action-types/
import { Trekin } from "trekin";
const trekin = new Trekin(
{
baseUrl: "https://example.cybozu.com/", // Your domain
defaultKintoneUserCode: "john", // Your kintone user code
cards: {
id: "1", // Your kintone app ID for Card
token: "...", // Your kintone app API token for Card
},
labels: {
id: "2", // Your kintone app ID for Label
token: "...", // Your kintone app API token for Label
},
lists: {
id: "3", // Your kintone app ID for List
token: "...", // Your kintone app API token for List
},
members: {
id: "4", // Your kintone app ID for Member
token: "...", // Your kintone app API token for Member
},
},
{
apiKey: "...", // Your Trello user API key
apiToken: "...", // Your Trello user API token
}
);
Turn Trello's webhook response into an object.
const trelloWebhookAction: Action = JSON.parse(
await fs.readFileSync("trelloEvent.json", "utf8")
).body.action;
const result = await trekin.operation(trelloWebhookAction);
console.info("Operation\n" + JSON.stringify(result));
const postResult = await trekin.postOperation(trelloWebhookAction);
console.info("Post operation\n" + JSON.stringify(postResult));
Trekin support Card exclusion settings. If all the conditions enclosed in braces are met, the event is skipped.
option | type | default | description |
---|---|---|---|
charactersOrLess | number | If the card name is less than or equal to the set value, exclude it. | |
match | regexp | If the card name matches to the set regular expression, exclude it. |
trekin.guardian.setting = {
excludes: [
{
charactersOrLess: 12,
match: "\\d{2}\\/\\d{2}\\/\\d{4}",
},
{
match: "Test!!"
}
],
};
- Card name is ⬆️27/09/2020, skip.
- Card name is Prepare for the event on 27/09/2020., not skip.
- Card name is This is createCard Test!!, skip.
Trekin can add the date and time the card was moved to the Done list to the record. It needs to be turned on in the settings.
option | type | default | description |
---|---|---|---|
isAddDoneTime | boolean | false | Register the date and time the card was moved to the Done list in the record. |
doneListName | string | "Done" | The list name corresponding to "Done". |
trekin.guardian.setting = {
isAddDoneTime: true,
doneListName: "🎉Done"
};
- Move card at 2020/11/30 13:00(UTC). (
👦Todo
→🎉Done
) - Update Record. (Done time:
2020/11/30 13:00
)
Trekin gives the record ID to the top of the card. By assigning a record ID, you can use kintone's record ID link feature.
option | type | default | description |
---|---|---|---|
prefixRecordId | string | "DEFAULT" | Record ID prefix name |
trekin.guardian.setting = {
prefixRecordId: "EPTRE",
};
- Create Card. (Card name:
This is test
) - Add Card to Record. (Record name:
EPTRE-123: This is test
) - Update Card name. (Card name:
EPTRE-123: This is test
) - The attached record link to Card. (Link name:
EPTRE-123
)