Custom integrations


When developing a widget, you can make direct calls to your custom backend using the fetch API, but you can also use Fouita custom integration to use middleware for a specific list of services.

You can find the supported integrations under the integrations section


When you edit the widget code, click on "Set Integrations" on the top bar

fouita integrations


This will open a list of possible integrations

fouita integrations



Now you can click select on the integration you would like to use for your widget.
We can pick slack for this example. You can take a look at how to integrate slack, or when you open the integration details, you can click on "Documentation"

fouita integtation slack


Operations
An operation represents the exact name that would be used to execute the call to the service provider (slack).  
This operation meant to send a message to a slack channel using the webhook URL that you provided.

When creating the function that executes the desired integration call, you need call the Fouita integtation utility function. It will look something like the following

<script>
 // this is needed to get this widget integration
 export let __service

 function sendToSlack() {
  Fouita.Integration().call(__service, "sendMessage", {
      text: "My message to slack"
  })
 } 

</script>

<button on:click={sentToSlack}> Send to slack </button>

That's it! now our widget is able to send slack messages.

You will find more details about the data to send for each service in the related integration details page.





https://img.fouita.com/0x2729/media/imgs/logoblanc-1633435942147.png?/rs:fit:130:130
The missing pieces of your website.
kairouan, tunisia
built using fouita!