@Karuppu_Samy ,
It is not possible to use the template compiler outside of platform feature such as request API.
if you want to use third party package, then you need to pass the actual value in the request.
@Karuppu_Samy ,
so, you are trying to invoke an SMI call from the installation page, or on the app setup events, you are trying to get the access_token? can you please clarify?
but why can’t you use the request API to solve your case or is there any blocker to use the request API?
Hi @Karuppu_Samy ,
It is not possible with the straightforward approach,
but there is a workaround that you can use the middleware to solve your use case,
step 1:
on app setup events (on Install) → you need to pass the Access token via request API with template literal to the middleware, and store the access token and generate webhook and pass it to middleware
step 2:
use your third party package to call the middleware and attach the access token from middleware and pass it to your backend
step 3:
if the token is expired, use the external events to make any API to refresh the access token and pass it in your middleware
another alternative which I suggest:
use API token instead of Oauth.
When the middleware realizes that API call has failed:
Make an API call to webhook that’s generated using external events
The execution context of onExternalEvent should make a request to 3rd party. Since this time the access token fails, the platform will refresh it.
Retry making the same request or platform will automatically retry with the new access token. The request should ideally succeed in confirming that the access token is refreshed.
In the same execution context make an API call to middleware with the access token.
This time middleware can make an API call to 3rd party with an attachment on it.