Synapse Info Method

Rok Kovač
Rok Kovač
  • Updated

Synapse Info method is used to provide description and authentication settings for the custom Synapse, by returning a SynapseInfo class instance. It allows you to configure fields that will be visible to the end user in the synapse setup wizard, and use those in your synapse’s code.

Configuring Synapse Info object

In the returned SynapseInfo instance, It’s mandatory to  include the name and supportedAuthTypes attributes, while the rest of the available fields are optional.

Within the supportedAuthTypes attributes you need to specify the supported authentication types for this custom Synapse. This attribute is mandatory, even when no authentication is needed (in which case, the AuthType.API_KEY NONE should be set). It’s possible to list multiple supportedAuthTypes.

In the configuredFields attributes you can specify any additional fields that are needed to support API requests, for example a value of endpoint or webhookIdentifiers.

Values from user inputs in UI configured fields can be accessed from either the authConfig or metaConfig objects. 

Bellow is an example of how to access one of the default authentication fields accessToken.

# Field config
AuthField(name='accessToken', label='API Key',dataType=DataType.PASSWORD)
# Field variable

When a field that is not part of the default values is set in the supportedAuthTypes, it'll get automatically stored in the additionalHeaders dict.

# Field config
AuthField(name='custom_value', label='API Key',dataType=DataType.PASSWORD)
# Field variable:

Under configuredFields, you can set fields that are available on the first page of the setup wizard. Usually these are reserved for endpoints or any additional metadata that needs to be configured by the end user. Setting any default fields (like endpoint for example) will be accessible via authConfig, however any custom fields will be available under metaConfig dict.

# Field config
AuthField(name='custom_field', label='API Key',dataType=DataType.PASSWORD)
# Field variable

The synapse_info instance can also have a oauthInfo dict set, which includes oAuth metadata when suing oAuth authentication and apiMaxCrudSize, which is the maximum number of records that are passed to create, update and delete methods at each method invocation. When not set, the system will default to 20 records.

Example Code

Bellow is an example of a synapse_info method from our Pipedrive Synapse.

def synapse_info(self) - SynapseInfo:
return SynapseInfo(
       supportedAuthTypes=[AuthMetadata(authType=AuthType.API_KEY, label='Api Key',
       fields=[AuthField(name='accessToken', label='API Key',dataType=DataType.PASSWORD)])],
       configuredFields=[AuthField(name='endpoint', label='Endpoint URL',dataType=DataType.STRING)])


Share this

Was this article helpful?

0 out of 0 found this helpful