Skip to content

Commit 6f7c92b

Browse files
committed
use updated kissflow auth
1 parent f7344b5 commit 6f7c92b

File tree

4 files changed

+30
-15
lines changed

4 files changed

+30
-15
lines changed

.env.example

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ AWS_REGION='us-east-1'
55
SES_FROM_EMAIL=''
66
TURNSTILE_SITE_KEY=''
77
TURNSTILE_SECRET_KEY=''
8-
KISSFLOW_API_KEY=''
8+
KISSFLOW_SUBDOMAIN='ethereum'
9+
KISSFLOW_ACCESS_KEY_ID=''
10+
KISSFLOW_ACCESS_KEY_SECRET=''
911
KISSFLOW_ACCOUNT_ID=''
1012
KISSFLOW_PROCESS_ID=''

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ The application now supports automatic integration with Kissflow for KYC submiss
3434
To enable Kissflow integration:
3535
1. Add the following to your `.env` file:
3636
```
37-
KISSFLOW_API_KEY=your_api_key
37+
KISSFLOW_SUBDOMAIN=ethereum
38+
KISSFLOW_ACCESS_KEY_ID=your_access_key_id
39+
KISSFLOW_ACCESS_KEY_SECRET=your_access_key_secret
3840
KISSFLOW_ACCOUNT_ID=your_account_id
3941
KISSFLOW_PROCESS_ID=your_aog_process_id
4042
```

server.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -191,20 +191,24 @@ def find_aog_item_by_grant_id(grant_id):
191191
Returns the item ID if found, None otherwise.
192192
"""
193193
try:
194-
api_key = os.getenv('KISSFLOW_API_KEY')
194+
subdomain = os.getenv('KISSFLOW_SUBDOMAIN', 'ethereum')
195+
access_key_id = os.getenv('KISSFLOW_ACCESS_KEY_ID')
196+
access_key_secret = os.getenv('KISSFLOW_ACCESS_KEY_SECRET')
195197
account_id = os.getenv('KISSFLOW_ACCOUNT_ID')
196198
process_id = os.getenv('KISSFLOW_PROCESS_ID')
197199

198-
if not all([api_key, account_id, process_id]):
200+
if not all([access_key_id, access_key_secret, account_id, process_id]):
199201
logging.error("Missing Kissflow configuration")
200202
return None
201203

202204
# Kissflow API endpoint to search for items
203-
url = f"https://api.kissflow.com/api/v1/accounts/{account_id}/processes/{process_id}/items"
205+
url = f"https://{subdomain}.kissflow.com/process/2/{account_id}/{process_id}/items"
204206

205207
headers = {
206-
'Authorization': f'Bearer {api_key}',
207-
'Content-Type': 'application/json'
208+
'Accept': 'application/json',
209+
'Content-Type': 'application/json',
210+
'X-Access-Key-Id': access_key_id,
211+
'X-Access-Key-Secret': access_key_secret
208212
}
209213

210214
# Search for items with matching Grant ID in Request_number field
@@ -233,20 +237,24 @@ def update_aog_kyc_comments(item_id, legal_identifier):
233237
Updates the KYC_Comments field in a Kissflow AOG item with the legal identifier.
234238
"""
235239
try:
236-
api_key = os.getenv('KISSFLOW_API_KEY')
240+
subdomain = os.getenv('KISSFLOW_SUBDOMAIN', 'ethereum')
241+
access_key_id = os.getenv('KISSFLOW_ACCESS_KEY_ID')
242+
access_key_secret = os.getenv('KISSFLOW_ACCESS_KEY_SECRET')
237243
account_id = os.getenv('KISSFLOW_ACCOUNT_ID')
238244
process_id = os.getenv('KISSFLOW_PROCESS_ID')
239245

240-
if not all([api_key, account_id, process_id]):
246+
if not all([access_key_id, access_key_secret, account_id, process_id]):
241247
logging.error("Missing Kissflow configuration")
242248
return False
243249

244250
# Kissflow API endpoint to update an item
245-
url = f"https://api.kissflow.com/api/v1/accounts/{account_id}/processes/{process_id}/items/{item_id}"
251+
url = f"https://{subdomain}.kissflow.com/process/2/{account_id}/{process_id}/items/{item_id}"
246252

247253
headers = {
248-
'Authorization': f'Bearer {api_key}',
249-
'Content-Type': 'application/json'
254+
'Accept': 'application/json',
255+
'Content-Type': 'application/json',
256+
'X-Access-Key-Id': access_key_id,
257+
'X-Access-Key-Secret': access_key_secret
250258
}
251259

252260
# Update the KYC_Comments field

test_kissflow_integration.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,17 @@ def test_environment_variables():
2828
"""Test that all required Kissflow environment variables are set"""
2929
print("Testing environment variables...")
3030

31-
required_vars = ['KISSFLOW_API_KEY', 'KISSFLOW_ACCOUNT_ID', 'KISSFLOW_PROCESS_ID']
31+
required_vars = ['KISSFLOW_SUBDOMAIN', 'KISSFLOW_ACCESS_KEY_ID', 'KISSFLOW_ACCESS_KEY_SECRET', 'KISSFLOW_ACCOUNT_ID', 'KISSFLOW_PROCESS_ID']
3232
missing_vars = []
3333

3434
for var in required_vars:
3535
value = os.getenv(var)
3636
if value:
37-
# Mask the value for security
38-
masked_value = value[:4] + '...' + value[-4:] if len(value) > 8 else '***'
37+
# Mask the value for security (except subdomain)
38+
if var == 'KISSFLOW_SUBDOMAIN':
39+
masked_value = value
40+
else:
41+
masked_value = value[:4] + '...' + value[-4:] if len(value) > 8 else '***'
3942
print(f"✓ {var}: {masked_value}")
4043
else:
4144
print(f"✗ {var}: NOT SET")

0 commit comments

Comments
 (0)