Skip to content

A sample application to demonstrate how signed callbacks work in the Voice API.

License

Notifications You must be signed in to change notification settings

sinch/voice-api-webhook-nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sinch Voice API Callback application Node.js

Callback Request Signing

The Sinch Platform can initiate callback requests to a URL you define (Callback URL) on events like call initiation, call answer, and call disconnect. All callback requests are signed using your Application key and secret pair found on the Sinch Dashboard. The signature is included in the authorization header of the HTTP request.

This code sample will:

  1. Validate the signature to ensure the call event originates from Sinch.
  2. Respond with a Sinch Voice Application Markup Language (SVAML) example on the ICE event (Conference connect).
  3. Respond with 200OK for the DICE event.

Requirements

Install

  1. Use environment variables for your application key and secret. Create an .env file with your credentials for your application from the Sinch dashboard in the format shown:

    APP_KEY="YOUR_app_key"
    APP_SECRET="YOUR_app_secret"
  2. Run npm install to install the required dependencies.

  3. Start the server using the following command: node index.js

  4. Start ngrok using ngrok http 8000

    ngrok

  5. Take the ngrok URL example https://97e8-147-28-76-39.ngrok.io

  6. Copy it to the Voice & Video application you are using Sinch dashboard

    callback settings

  7. Click Save and test your connection!

  8. Make that call! You can test direct from the Sinch dashboard or use the samples here

If you want to inspect the incoming call events please set DEBUG=ON in the .env file.

About

A sample application to demonstrate how signed callbacks work in the Voice API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published