What is your goal?
I have a verified app on make.com marketplace named Frejun. After some non breaking changes in our backend api were made, i tried to update the make.com custom app as well. I had to save the email query parameter that will be received in the response to be able to use that email query param on each subsequent request through BASE. But currently itâs not being saved similar to how I was able to save accessToken and refreshToken. I tried hardcoding it as well, but still it is not working. Please take a look at it so we can work on updating our make.com scenario
What is the problem & what have you tried?
The problem is because the email is not getting persisted to BASE through connection which should be saved in the custom appâs connection section. Since connection.email comes out to be empty in the BASE, it leads to no email parameter being send to be able to register the webhook on the backend.
Why is the email not getting saved to connection?
Error messages or input/output bundles
Here is the BASE for my app
{
// Default request configuration
"baseUrl": "https://api.frejun.com/api/v2/", // Default base URL for all modules and RPCs.
"headers": { // Default HTTP headers for all modules and RPCs.
"authorization": "Bearer {{connection.accessToken}}" // Authorization by API key, which user will provide in the connection as parameter.
},
"qs": {
"email": "{{connection.email}}"
},
// Default response handling
"response": {
"error": { // Error handling
"message": "[{{statusCode}}]-- {{body.error}}" // On error, returns error message as "[statusCode] error text".
}
},
"log": {
"sanitize": [ // Excludes sensitive parameters from logs.
"request.headers.authorization"
// "request.qs.email"
]
}
}
CONNECTION
{
// Step 1: OAuth2 authorization request
// See OAuth2 documentation: https://www.oauth.com/oauth2-servers/server-side-apps/authorization-code/
"authorize": {
"url": "https://product.frejun.com/oauth/authorize/", // Endpoint for authorization.
"qs": {
"client_id": "{{common.client_id}}" // Client ID either provided in common parameters (below) or by the user.
},
// Authorization response handling
// See OAuth2 documentation https://www.oauth.com/oauth2-servers/authorization/the-authorization-response/
"response": {
// Store received "code" into temporary storage.
"temp": {
"code": "{{query.code}}",
"email": "{{query.email}}"
}
}
},
// Step 2: OAuth2 token request
"token": {
"condition": "{{temp.code}}", // Checks if "code" has been correctly received by authorization response.
"url": "https://api.frejun.com/api/v2/oauth/token/",
"headers": {
"authorization": "Bearer {{ base64(common.client_id + ':' + common.client_secret) }}"
},
"qs": {
"email": "{{temp.email}}",
"code": "{{temp.code}}" // Uses stored "code" from authorization response.
},
// Token response handling
"response": {
"data": {
"expires": "{{addSeconds(now, body.expires_in)}}", // Stores the expiration date of accessToken.
"accessToken": "{{body.access_token}}", // Stores the accessToken.
"refreshToken": "{{body.refresh_token}}", // Stores the refreshToken.
"email": "chakri@frejun.com"
}
}
// "log": {
// "sanitize": [ // Excludes sensitive parameters from logs.
// "request.headers.authorization",
// "request.body.code",
// "request.body.client_secret",
// "response.body.access_token",
// "response.body.refresh_token"
// ]
// }
},
// Step 3: Refresh token
// See OAuth2 documentation https://www.oauth.com/oauth2-servers/access-tokens/refreshing-access-tokens/
"refresh": {
"condition": "{{data.expires < addMinutes(now, 1)}}", // Executes the request if accessToken is expired.
"url": "https://api.frejun.com/api/v2/oauth/token/refresh/",
"method": "POST",
"headers": {
"authorization": "Bearer {{ base64(common.client_id + ':' + common.client_secret) }}"
},
"qs": {
"email": "{{temp.email}}"
},
"body": {
"refresh": "{{data.refreshToken}}"
},
"type": "urlencoded",
"response": {
"data": {
"expires": "{{addSeconds(now, body.expires_in)}}", // Stores the expiration date of the new accessToken.
"accessToken": "{{body.access}}", // Stores the new accessToken.
"refreshToken": "{{body.refresh}}", // Stores the new refreshToken.
"email": "chakri@frejun.com"
}
}
// "log": {
// "sanitize": [
// "request.headers.authorization",
// "request.body.client_secret",
// "request.body.refresh_token",
// "response.body.access_token",
// "response.body.refresh_token"
// ]
// }
}
}
Webhook ATTACH section
{
// Request
"url": "/integrations/webhooks/make/",
// uses the qs from base
"method": "POST",
"body": {
"event": "call.status",
"callback_url": "{{webhook.url}}"
},
// Response handling
"response": {
"data": {
"externalHookId": "{{body.data.id}}" // Stores the webhook's ID to be used in the detach remote procedure. It is accessible via "{{webhook.externalHookId}}"
},
"error": { // Error handling
"message": "[{{statusCode}}] {{body.message}}" // On error, returns error message as "[statusCode] error text".
}
}
}
