Platform Integration
Year of Work | 2023
Tools Used | Node.js, JavaScript, Visual Studio
Features | API, Automation, Webhooks
The following is stripped down version of notes of a unused prototype that I had envisioned for the company I was working for at the time to use. We were using Discord for daily messaging, Notion to keep documentation and Linear for task management. For a particular workflow for our product management, I wanted to automate our information and workflow. The idea was at the start of the process, a page would be created or updated in Notion; the page would be in a database and would have a property that was the status of the page. The notion page would get a default status (marking it was at the start of the process) and the page would get a Linear task associated with it and would be assigned to a group in the company based on its status. The group would be notifed in Discord that there is a task in Linear for them to do, and as the Notion page gets pushed to a new stage (after the group is done with it), a different group would be assigned to look at the notion page and be notified. Each status is associated with a different group and in the Notion page, it would be a collaboration effort between all these groups, but certain groups need to edit and check the document after certain people. The status order is already set, groups for each status is already set in different Notion databases, so the program would use that information to update or create new Linear tasks for the new group and each group when know when to look at the document by Discord. The end result was a program that could poll for changes in Notion and create a Discord messages that have the correct Notion page and Linear task linked while also updating the Notion page or Linear task for new information.
__
Day 1: Had to become workspace owner to get a token. Installed Node.js. Got a better understanding of API docs.
Downloaded Postman https://www.postman.com/downloads/
API Reference: https://developers.notion.com/reference/retrieve-a-database
Integrations Secrets: https://www.notion.so/my-integrations/internal/7142ce818d8c4c8095fd5edb2ba0a0fc
Initial Integration Steps: https://developers.notion.com/docs/create-a-notion-integration
Example Integrations: https://github.com/makenotion/notion-sdk-js/tree/main/examples/database-email-update
Other nice video: https://www.youtube.com/watch?v=ec5m6t77eYM
End: Trying to figure out how to install notion library to project in Visual Studio.
Day 2: Figured out how to the install notion library. Got server responses from Notion.
Filter Types https://developers.notion.com/reference/post-database-query-filter#the-filter-object
Page IDs are everything after the title of the page in the URL. Database IDs are everything before the ? in the URL.
End: Cannot use webhooks in Discord because I am not an admin. Requested access.
Day 3: Figured out how to get property data from databases in Notion. Started to create functions for detecting changes.
End: Using mock data to detect changes in notion page’s property stage.
End Result:

For next time: Link changes to Discord server.
Day 4:
Notion: Program will find differences in stage for notion pages and post them to discord.
End product of Notion phase: Pictured is discord message.

Linear: Exploring Linear Docs. Had to install Linear SDK ( npm install @linear/sdk ). Got Linear to give appropriate responses for queries.
End Day 4: Will need to clean up app.js . Will need to be able to fulfill workflow:
Create page in Notion.
Be notified of notion page creation in Discord with Notion Link to general channel.
Be notified of notion page status in Discord with Linear Link to correct group Discord channel.
Change status of notion page in Notion.
Be notified of notion page status change in Discord with Notion Link to general channel.
Be notified of notion page status task in Discord with Linear Link to correct group Discord Channel.
Discord Notification:
{Notion Page Name} changed to {Status} {Notion Link or Linear Task}
Notion page creation function to be put into polling loop. Any changes (status or creation) will need to be pushed to correct group channel.
Notion → Linear → Discord
TODO:
[x] Make discord channels for groups
[x] Add discord channels to program
[x] Turn Notion Section to functions
[x] Determine which group should get what changes in Discord
[x] Get groups property from notion database and make a set for it to be used in Linear part of program
[x] Detect notion page create
[ ] Create Linear tasks for each status and group (or reuse first task) with Notion Link.
Linear Docs (Basic): https://developers.linear.app/docs/sdk/getting-started
Linear Docs (Schema): https://studio.apollographql.com/public/Linear-API/variant/current/home
In Linear API Info: https://linear.app/threespacelab/settings/api
Specific Issue Schema: https://studio.apollographql.com/public/Linear-API/variant/current/schema/reference/inputs/IssueCreateInput
Day 5:
Did items in TODO list except last one. Last one may not be as good to do since the only way to identify past tasks would be from it’s name and I am doubtful that the name will be the notion page’s name since most are very long. Nice ways of identifying past status tasks would either every notion page have a pretty name in Notion to be used as the task name and that cannot change, having a program that will connect the Linear Task and Notion page in a dictionary and update the dictionary with any updates to keep the two linked to another or the notion page can have a link to its current Linear Task and that link can be broken down to it’s identifier to find the task in Linear. I’m doing the last one for now.
End Day 5: A notion page in Notion can have its status changed and it’s corresponding Linear Task is updated (not deleted or recreated) to be assigned to the new group and have a new title. Tomorrow I should find out why it is posting on discord twice. Also will look into posting on threads.
Day 6:
Made it so new notion pages get a task created and linked in their notion page. Notion pages that have their status changed get checked for a linear task url so they can update the task or if they don’t have a task already, then one gets created for them for the new phase. Three different cases are covered:
Notion page with Linear Task URL change Status
Notion page without Linear Task URL change Status
New Notion Page created
End result for new notion pages:

End result for status changes:
