Skip to content

Commit 63906d6

Browse files
author
aadamgough
committed
oauth to pat and tool fix
1 parent 232de7e commit 63906d6

File tree

10 files changed

+89
-169
lines changed

10 files changed

+89
-169
lines changed

apps/sim/blocks/blocks/grain.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const GrainBlock: BlockConfig = {
77
type: 'grain',
88
name: 'Grain',
99
description: 'Access meeting recordings, transcripts, and AI summaries',
10-
authMode: AuthMode.OAuth,
10+
authMode: AuthMode.ApiKey,
1111
triggerAllowed: true,
1212
longDescription:
1313
'Integrate Grain into your workflow. Access meeting recordings, transcripts, highlights, and AI-generated summaries. Can also trigger workflows based on Grain webhook events.',
@@ -32,11 +32,11 @@ export const GrainBlock: BlockConfig = {
3232
value: () => 'grain_list_recordings',
3333
},
3434
{
35-
id: 'credential',
36-
title: 'Grain Account',
37-
type: 'oauth-input',
38-
serviceId: 'grain',
39-
placeholder: 'Select Grain account',
35+
id: 'apiKey',
36+
title: 'API Key',
37+
type: 'short-input',
38+
placeholder: 'Enter your Grain API key',
39+
password: true,
4040
required: true,
4141
},
4242
// Recording ID (for get_recording and get_transcript)
@@ -232,7 +232,7 @@ export const GrainBlock: BlockConfig = {
232232
},
233233
params: (params) => {
234234
const baseParams: Record<string, unknown> = {
235-
credential: params.credential,
235+
apiKey: params.apiKey,
236236
}
237237

238238
switch (params.operation) {
@@ -313,7 +313,7 @@ export const GrainBlock: BlockConfig = {
313313
},
314314
inputs: {
315315
operation: { type: 'string', description: 'Operation to perform' },
316-
credential: { type: 'string', description: 'Grain access token' },
316+
apiKey: { type: 'string', description: 'Grain API key (Personal Access Token)' },
317317
recordingId: { type: 'string', description: 'Recording UUID' },
318318
cursor: { type: 'string', description: 'Pagination cursor' },
319319
beforeDatetime: {

apps/sim/tools/grain/create_hook.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,12 @@ export const grainCreateHookTool: ToolConfig<GrainCreateHookParams, GrainCreateH
77
description: 'Create a webhook to receive recording events',
88
version: '1.0.0',
99

10-
oauth: {
11-
required: true,
12-
provider: 'grain',
13-
},
14-
1510
params: {
16-
accessToken: {
11+
apiKey: {
1712
type: 'string',
18-
required: false,
19-
visibility: 'hidden',
20-
description: 'OAuth access token (auto-injected)',
13+
required: true,
14+
visibility: 'user-only',
15+
description: 'Grain API key (Personal Access Token)',
2116
},
2217
hookUrl: {
2318
type: 'string',
@@ -78,16 +73,11 @@ export const grainCreateHookTool: ToolConfig<GrainCreateHookParams, GrainCreateH
7873
request: {
7974
url: 'https://api.grain.com/_/public-api/v2/hooks/create',
8075
method: 'POST',
81-
headers: (params) => {
82-
if (!params.accessToken) {
83-
throw new Error('Missing access token for Grain API request')
84-
}
85-
return {
86-
'Content-Type': 'application/json',
87-
Authorization: `Bearer ${params.accessToken}`,
88-
'Public-Api-Version': '2025-10-31',
89-
}
90-
},
76+
headers: (params) => ({
77+
'Content-Type': 'application/json',
78+
Authorization: `Bearer ${params.apiKey}`,
79+
'Public-Api-Version': '2025-10-31',
80+
}),
9181
body: (params) => {
9282
const body: Record<string, any> = {
9383
hook_url: params.hookUrl,

apps/sim/tools/grain/delete_hook.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,12 @@ export const grainDeleteHookTool: ToolConfig<GrainDeleteHookParams, GrainDeleteH
77
description: 'Delete a webhook by ID',
88
version: '1.0.0',
99

10-
oauth: {
11-
required: true,
12-
provider: 'grain',
13-
},
14-
1510
params: {
16-
accessToken: {
11+
apiKey: {
1712
type: 'string',
18-
required: false,
19-
visibility: 'hidden',
20-
description: 'OAuth access token (auto-injected)',
13+
required: true,
14+
visibility: 'user-only',
15+
description: 'Grain API key (Personal Access Token)',
2116
},
2217
hookId: {
2318
type: 'string',
@@ -30,16 +25,11 @@ export const grainDeleteHookTool: ToolConfig<GrainDeleteHookParams, GrainDeleteH
3025
request: {
3126
url: (params) => `https://api.grain.com/_/public-api/v2/hooks/${params.hookId}`,
3227
method: 'DELETE',
33-
headers: (params) => {
34-
if (!params.accessToken) {
35-
throw new Error('Missing access token for Grain API request')
36-
}
37-
return {
38-
'Content-Type': 'application/json',
39-
Authorization: `Bearer ${params.accessToken}`,
40-
'Public-Api-Version': '2025-10-31',
41-
}
42-
},
28+
headers: (params) => ({
29+
'Content-Type': 'application/json',
30+
Authorization: `Bearer ${params.apiKey}`,
31+
'Public-Api-Version': '2025-10-31',
32+
}),
4333
},
4434

4535
transformResponse: async (response) => {

apps/sim/tools/grain/get_recording.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@ export const grainGetRecordingTool: ToolConfig<GrainGetRecordingParams, GrainGet
88
description: 'Get details of a single recording by ID',
99
version: '1.0.0',
1010

11-
oauth: {
12-
required: true,
13-
provider: 'grain',
14-
},
15-
1611
params: {
17-
accessToken: {
12+
apiKey: {
1813
type: 'string',
19-
required: false,
20-
visibility: 'hidden',
21-
description: 'OAuth access token (auto-injected)',
14+
required: true,
15+
visibility: 'user-only',
16+
description: 'Grain API key (Personal Access Token)',
2217
},
2318
recordingId: {
2419
type: 'string',
@@ -61,16 +56,11 @@ export const grainGetRecordingTool: ToolConfig<GrainGetRecordingParams, GrainGet
6156
request: {
6257
url: (params) => `https://api.grain.com/_/public-api/v2/recordings/${params.recordingId}`,
6358
method: 'POST',
64-
headers: (params) => {
65-
if (!params.accessToken) {
66-
throw new Error('Missing access token for Grain API request')
67-
}
68-
return {
69-
'Content-Type': 'application/json',
70-
Authorization: `Bearer ${params.accessToken}`,
71-
'Public-Api-Version': '2025-10-31',
72-
}
73-
},
59+
headers: (params) => ({
60+
'Content-Type': 'application/json',
61+
Authorization: `Bearer ${params.apiKey}`,
62+
'Public-Api-Version': '2025-10-31',
63+
}),
7464
body: (params) => {
7565
const include: Record<string, any> = {}
7666

apps/sim/tools/grain/get_transcript.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@ export const grainGetTranscriptTool: ToolConfig<
1010
description: 'Get the full transcript of a recording',
1111
version: '1.0.0',
1212

13-
oauth: {
14-
required: true,
15-
provider: 'grain',
16-
},
17-
1813
params: {
19-
accessToken: {
14+
apiKey: {
2015
type: 'string',
21-
required: false,
22-
visibility: 'hidden',
23-
description: 'OAuth access token (auto-injected)',
16+
required: true,
17+
visibility: 'user-only',
18+
description: 'Grain API key (Personal Access Token)',
2419
},
2520
recordingId: {
2621
type: 'string',
@@ -34,16 +29,11 @@ export const grainGetTranscriptTool: ToolConfig<
3429
url: (params) =>
3530
`https://api.grain.com/_/public-api/v2/recordings/${params.recordingId}/transcript`,
3631
method: 'GET',
37-
headers: (params) => {
38-
if (!params.accessToken) {
39-
throw new Error('Missing access token for Grain API request')
40-
}
41-
return {
42-
'Content-Type': 'application/json',
43-
Authorization: `Bearer ${params.accessToken}`,
44-
'Public-Api-Version': '2025-10-31',
45-
}
46-
},
32+
headers: (params) => ({
33+
'Content-Type': 'application/json',
34+
Authorization: `Bearer ${params.apiKey}`,
35+
'Public-Api-Version': '2025-10-31',
36+
}),
4737
},
4838

4939
transformResponse: async (response) => {

apps/sim/tools/grain/list_hooks.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,23 @@ export const grainListHooksTool: ToolConfig<GrainListHooksParams, GrainListHooks
77
description: 'List all webhooks for the account',
88
version: '1.0.0',
99

10-
oauth: {
11-
required: true,
12-
provider: 'grain',
13-
},
14-
1510
params: {
16-
accessToken: {
11+
apiKey: {
1712
type: 'string',
18-
required: false,
19-
visibility: 'hidden',
20-
description: 'OAuth access token (auto-injected)',
13+
required: true,
14+
visibility: 'user-only',
15+
description: 'Grain API key (Personal Access Token)',
2116
},
2217
},
2318

2419
request: {
2520
url: 'https://api.grain.com/_/public-api/v2/hooks',
2621
method: 'POST',
27-
headers: (params) => {
28-
if (!params.accessToken) {
29-
throw new Error('Missing access token for Grain API request')
30-
}
31-
return {
32-
'Content-Type': 'application/json',
33-
Authorization: `Bearer ${params.accessToken}`,
34-
'Public-Api-Version': '2025-10-31',
35-
}
36-
},
22+
headers: (params) => ({
23+
'Content-Type': 'application/json',
24+
Authorization: `Bearer ${params.apiKey}`,
25+
'Public-Api-Version': '2025-10-31',
26+
}),
3727
},
3828

3929
transformResponse: async (response) => {

apps/sim/tools/grain/list_meeting_types.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,23 @@ export const grainListMeetingTypesTool: ToolConfig<
1313
description: 'List all meeting types in the workspace',
1414
version: '1.0.0',
1515

16-
oauth: {
17-
required: true,
18-
provider: 'grain',
19-
},
20-
2116
params: {
22-
accessToken: {
17+
apiKey: {
2318
type: 'string',
24-
required: false,
25-
visibility: 'hidden',
26-
description: 'OAuth access token (auto-injected)',
19+
required: true,
20+
visibility: 'user-only',
21+
description: 'Grain API key (Personal Access Token)',
2722
},
2823
},
2924

3025
request: {
3126
url: 'https://api.grain.com/_/public-api/v2/meeting_types',
3227
method: 'POST',
33-
headers: (params) => {
34-
if (!params.accessToken) {
35-
throw new Error('Missing access token for Grain API request')
36-
}
37-
return {
38-
'Content-Type': 'application/json',
39-
Authorization: `Bearer ${params.accessToken}`,
40-
'Public-Api-Version': '2025-10-31',
41-
}
42-
},
28+
headers: (params) => ({
29+
'Content-Type': 'application/json',
30+
Authorization: `Bearer ${params.apiKey}`,
31+
'Public-Api-Version': '2025-10-31',
32+
}),
4333
},
4434

4535
transformResponse: async (response) => {

apps/sim/tools/grain/list_recordings.ts

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,12 @@ export const grainListRecordingsTool: ToolConfig<
1010
description: 'List recordings from Grain with optional filters and pagination',
1111
version: '1.0.0',
1212

13-
oauth: {
14-
required: true,
15-
provider: 'grain',
16-
},
17-
1813
params: {
19-
accessToken: {
14+
apiKey: {
2015
type: 'string',
21-
required: false,
22-
visibility: 'hidden',
23-
description: 'OAuth access token (auto-injected)',
16+
required: true,
17+
visibility: 'user-only',
18+
description: 'Grain API key (Personal Access Token)',
2419
},
2520
cursor: {
2621
type: 'string',
@@ -87,16 +82,11 @@ export const grainListRecordingsTool: ToolConfig<
8782
request: {
8883
url: 'https://api.grain.com/_/public-api/v2/recordings',
8984
method: 'POST',
90-
headers: (params) => {
91-
if (!params.accessToken) {
92-
throw new Error('Missing access token for Grain API request')
93-
}
94-
return {
95-
'Content-Type': 'application/json',
96-
Authorization: `Bearer ${params.accessToken}`,
97-
'Public-Api-Version': '2025-10-31',
98-
}
99-
},
85+
headers: (params) => ({
86+
'Content-Type': 'application/json',
87+
Authorization: `Bearer ${params.apiKey}`,
88+
'Public-Api-Version': '2025-10-31',
89+
}),
10090
body: (params) => {
10191
const body: Record<string, any> = {}
10292

apps/sim/tools/grain/list_teams.ts

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,23 @@ export const grainListTeamsTool: ToolConfig<GrainListTeamsParams, GrainListTeams
77
description: 'List all teams in the workspace',
88
version: '1.0.0',
99

10-
oauth: {
11-
required: true,
12-
provider: 'grain',
13-
},
14-
1510
params: {
16-
accessToken: {
11+
apiKey: {
1712
type: 'string',
18-
required: false,
19-
visibility: 'hidden',
20-
description: 'OAuth access token (auto-injected)',
13+
required: true,
14+
visibility: 'user-only',
15+
description: 'Grain API key (Personal Access Token)',
2116
},
2217
},
2318

2419
request: {
2520
url: 'https://api.grain.com/_/public-api/v2/teams',
26-
method: 'GET',
27-
headers: (params) => {
28-
if (!params.accessToken) {
29-
throw new Error('Missing access token for Grain API request')
30-
}
31-
return {
32-
'Content-Type': 'application/json',
33-
Authorization: `Bearer ${params.accessToken}`,
34-
'Public-Api-Version': '2025-10-31',
35-
}
36-
},
21+
method: 'POST',
22+
headers: (params) => ({
23+
'Content-Type': 'application/json',
24+
Authorization: `Bearer ${params.apiKey}`,
25+
'Public-Api-Version': '2025-10-31',
26+
}),
3727
},
3828

3929
transformResponse: async (response) => {

0 commit comments

Comments
 (0)