Skip to content

nuget package which allows connecting to the Megafon VATS service and registers endpoints for callbacks

License

Notifications You must be signed in to change notification settings

skytecs/MegafonPbxApiClient

Repository files navigation

API client for the Megafon cloud pbx

Nuget package which allows connecting to the Megafon VATS service and registers endpoints for callbacks

Getting started

  1. Install Skytecs.MegafonPbxApiClient NuGet package
  2. Add namespace reference to your Startup.cs
using Skytecs.MegafonPbxApiClient;
  1. Place this code in your ConfigureServices method:
services.AddMegafonApi(options =>
{
    options.ApiToken = "your-api-key";
    options.PbxEndpoint = "https://your-pbx-endpoint.megapbx.ru/sys/crm_api.wcgp";
});

This code will register IMegafonApiClient service as a singleton in the DI container.

To add callback support

  1. Add the following code to the ConfigureServices method.
services.AddMegafonCallbacks(options =>
{
    options.OnEvent = async x =>
    {
        Console.WriteLine(x.Phone);
    };
});
  1. And place this code in the Configure method.
app.MapMegafonCallbacks("/<relative-url-to-callbacks>", "<your-crm-token>");

Now you can provide your own implementation for any combination of the following callbacks:

  • OnEvent
  • OnHistory
  • OnContact

About

nuget package which allows connecting to the Megafon VATS service and registers endpoints for callbacks

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages