Instantiating Templates

Instantiating templates via the SDK can sometimes be confusing.

Invalid ID

When instantiating a template, you need to reference it by the correct ID. If you’re referencing a template made by another organization (such as DryMerge), you must ensure that the organization name is spelled correctly (they’re case sensitive).

my_user_id = '-exampleid'
# This won't work because the organization is not listed! (unless your organization also has a google/new-spreadsheet-row-webhook.template, but this is unlikely)
client.template(DryId(name='new-spreadsheet-row-webhook', namespace='google', type_='template') {
'identifier': f'{my_user_id}',
'oauth_gateway': 'google/oauth-integration.gateway',
'access_token': f'{{{{{my_user_id}.connection}}}}',
'spreadsheet_id': '1PokjiacviBzBGXcVnqqs0-SD8sWCxvKg2l3tLen4AkQ',
'sheet_name': 'Sheet1',
'webhook_url': ''
}, my_user_id')

Oauth Doesn’t Work

By default, templates don’t automatically use oauth in case you want to provide your own access tokens. If you DO want to use oauth, you need to specify the oauth gateway and access token in the template. Here’s some things to keep in mind:

  1. The gateway referenced must be a valid gateway that you’ve already instantiated. You can find a guide to do that here.
  2. The access token must reference a connection to the gateway you specified. This looks like {{oauth.<my-oauth-connection>}} where <my-oauth-connection> is the ID of the connection created.
  • DryMerge templates will often implicitly create these connections for you. In that case, the format will fit {{oauth.<connection_name><tenant_id>.connection}} where <connection_name> is a combination of the service and oauth (e.g. google/oauth) and <tenant_id> is the ID of the tenant that the connection was created for (e.g. what you put for `identifier).