ABSTRACT
Creating Scopes to work with the 3rd parties webhooks.
TABLE OF CONTENTS
1: Scopes
Scopes
At this point you are coming along on your integration so far accomplishing. Creating a unique IPaaS.com integration, setting up your workspace, Letting IPaaS.com know that it is connected to the 3rd party API, and created your models of data to be moved between the two. Now with all this in motion IPaaS.com essentially has a nice dossier of information and what to do with it but will never know when to so we move onto hooks and scopes.
1: Go to MetaData.cs.
2: go to the function GetScopes().
3: Add available scopes here.
In this function based on a 3rd parties' scopes under its webhooks documentation you would make something similar to this line above in GREEN. In this case as said before we have been working with a customer. This scope lets IPaaS.com look out for the trigger event of a customer being created to then work with the model of a customer.
Syntax:
Scopes.add(new Scope() {name= “scope name”, description = “some words about it”, MappingCollectionTypeId = (int)Constants.TM_MappingCollectionType.[specific type here] });
Example Above:
Scopes.Add(new Scope() {Name = "Customer/Created", Description = "Customer has been created", MappingCollectionTypeId = (int)Constants.TM_MappingCollectionType.CUSTOMER });
A 3rd Party system can have an array of differing words to describe scopes (some examples are: Topic, Type) however for the most part can be found via a search for the 3rd party system and will be present within its hooks documentation.
Dynamic Receiver
IPaaS.com has a dynamic webhook receiver.Once a System/Integration has been registered (system1 has
SystemTypeID:42) on staging, you can now manage the way IPaaS will process webhooks received by that system. You will
find the End-Points for configuration here:
https://stagingapi.ipaas.com/integrations/index.html ---See section: Webhook Configuration
iPaaS requires 3 specific settings for each inbound webhook.
- The AuthToken that iPaaS issued for the users subscription,
- The scope which matches the scopes defined in the Integration Metadata to translate into a DataType
- finally, a unique identifier for the data type which will be passed back to the processing method: E.g. Product_Get that you created in the Integration.
Here is a sample body to configure a dynamic hook receiver for Shopify:
{
"system_type_id": 54,
"url_path": "shopify",
"has_multiple": false,
"field_definitions": [
{
"value_name": "AuthToken",
"retrieval_type": "Header",
"retrieval_value": "X-Shopify-Hmac-Sha256",
"processing_type": "AsIs"
},
{
"value_name": "Scope",
"retrieval_type": "Header",
"retrieval_value": "X-Shopify-Topic",
"processing_type": "AsIs"
},
{
"value_name": "ExternalID",
"retrieval_type": "BodyJsonPath",
"retrieval_value": "$.id",
"processing_type": "AsIs"
}
]
}