5

I'm trying to work out a means of calling Salesforce Marketing Cloud's REST API via a third party webhook to write to a data extension. The issue I'm having involves refreshing the oauth token. We've worked out a means of retrieving the access token within the third party tool's UI, but the volume will be such that we don't want to be refreshing the token with every single request, nor do we have the ability to handle storing it and conditionally refreshing it within that tool. Is there some means of directly calling a Marketing Cloud REST API endpoint with static credentials for such use cases? Support recommended using a Web App with authorization code functionality...

https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-app-development.meta/mc-app-development/integration-app-auth-code.htm

...but I honestly don't see how this would solve the issue, as it seems it would still require the creation of a middle tier app.

I've seen solutions to a similar problem with Salesforce via keeping the token alive with a cron job...

Customer.io: webhook access_token update

...but I'm not thinking such a workaround would apply to Marketing Cloud's access tokens, which if I'm not mistaken have a hard 20 minute lifespan.

I'm thinking we could create a server process pointing at the server-to-server integration package to handle this and manage the tokens, and direct the third party tool to that, but we're trying to avoid the need for such an additional layer if at all possible.

  • 2
    If you can come up with another method for authentication, you can always just create a Code Resource type CloudPage that does the DE upsert in AMPscript or SSJS. – Adam Spriggs Nov 20 '19 at 19:26
  • Good point. I've considered a CloudPage solution, and have leveraged them in similar scenarios, but in this case I'm concerned about the sheer volume of impressions that would be involved. – andrewb Nov 20 '19 at 19:56
  • 1
    Utilising code resources does not count towards your Super Message count. However please verify with your Salesforce Account Executive – Lukas Lunow Nov 20 '19 at 21:51
  • It's a good idea you do not want to refresh the auth token in every single request, but the best way to prevent the expiration of the auth token is to refresh it before it expires, here you can use your logics to refresh it on a time basis or after few requests. I think this will be achievable without the need for such an additional layer. – Pratyush Dec 6 '19 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.