▪️Activity: WebHook

Smartico platform can make HTTP-API callbacks to your platform initiated by any activity in the system.

For example, you can notify your system using an HTTP POST call every time the user gets a Mini-game spin attempt, upgraded in levels, purchased in the store, started, or converted in a specific campaign. Any event happening in the context of the user can be used as a trigger for the API call.

There are 2 main places where you can initiate the API call:

  • as part of the campaign journey, you can use a special block called "WebHook"

  • as part of the automation rule, you can select the activity "WebHook"

Both ways are working the same way, but giving you the possibility either to build a simple "if-this-do-api-call" scenario using Automation rules, or trigger API calls as part of the complex marketing flow activity.

Try to use automation rule whenever possible in order to get the best performance and reaction on the event.

As part of the WebHook setup you need to set:

  • HTTP URL of your API endpoint

  • Preferred method - POST or GET. POST is suggested

  • Content type, application/json is suggested

  • Body, for the POST method, where you need to structure the JSON template with the possibility to use either property of the user state, like {{state.some_property_name}}. Or details of the event, like {{event.some_data_field}}

Example of the POST body structured as JSON for the trigger "Mini-game spin issued"

{
	"saw_template_id": "{{event.saw_template_id}}",
	"minigame_spins_count": "{{event.minigame_spins_count}}",
	"smartico_user_id": "{{state.user_id}}",
	"user_ext_id": "{{state.user_ext_id}}",
	"user_ext_id_clean": "{{state.user_ext_id_clean}}",
	"brand": "{{state.core_sm_brand_id}}"
}

Even though some of the properties in the given example are "numerics", like {{event.minigame_spins_count}}, we still suggest passing them as strings in order to keep a valid JSON.

It's highly not recommended to pass string-based properties that potentially could have quotes or special symbols inside, e.g. if your level name is called "My level with " inside",

the middle quote will break the structure of JSON and you will wrongly format POST.

For testing purpose, you can use the Smartico Echo service, where you can do test API calls and see how the results are passed via API.

You can send GET or POST requests to the URL like https://img.smr.vc/echo-send/some-secret-123/

And you can see the last 100 POST requested using the URL like https://img.smr.vc/echo-list/some-secret-123/

For the case of "Mini games attempts" you can see real-life examples of API calls on this echo bucket - https://img.smr.vc/echo-list/smartico-secret-x423g4/

Last updated