CreateWebhook

Creates a Webhook.

rpc CreateWebhook

webhook_api.v1.CreateWebhook

Creates a Webhook.

requests CreateWebhookRequest

webhook_api.v1.CreateWebhookRequest

FieldTypeDescription
api_keystringAPI Key as a JWT
namestringWebhook name.
supported_eventsEventType enum
FieldNumberDescription
EVENT_TYPE_UNSPECIFIED0List of supported_events.Event Type Unspecified.
EVENT_TYPE_WALLET_CREATED1List of supported_events.Event Type Wallet Created.
EVENT_TYPE_PROMISSORY_RECEIVED2List of supported_events.Event Type Promissory File Received.
EVENT_TYPE_PING3List of supported_events.Event Type Ping.
EVENT_TYPE_CONTRACT_PROPOSAL_COMPLETED4List of supported_events.Event Type Contract Proposal Completed.
EVENT_TYPE_CONTRACT_PAYMENT_COMPLETED5List of supported_events.Event Type Contract Payment Completed.
webhook_urlstringSpecified webhook URL.
delivery_methodDeliveryMethodType enum
FieldNumberDescription
DELIVERY_METHOD_TYPE_UNSPECIFIED0Specification of delivery method.Delivery Method Unspecified.
DELIVERY_METHOD_TYPE_HTTP1Specification of delivery method.Delivery Method using HTTP.
DELIVERY_METHOD_TYPE_GRPC2Specification of delivery method.Delivery Method using GRPC.
resp, _ := webhookManagerService.CreateWebhook(ctx, &v1.CreateWebhookRequest{
  ApiKey: "API_KEY",
  DeliveryMethod: v1.DeliveryMethodType_DELIVERY_METHOD_TYPE_UNSPECIFIED,
  Name: "NAME",
  WebhookUrl: "WEBHOOK_URL",
  SupportedEvents: []v1.EventType{
    v1.EventType_EVENT_TYPE_UNSPECIFIED,
    v1.EventType_EVENT_TYPE_WALLET_CREATED,
    v1.EventType_EVENT_TYPE_PROMISSORY_RECEIVED,
  },
})
fmt.Println(resp)
const createwebhookrequest = new CreateWebhookRequest();
createwebhookrequest.setApiKey("API_KEY");
createwebhookrequest.setDeliveryMethod(DeliveryMethodType.DELIVERY_METHOD_TYPE_GRPC);
createwebhookrequest.setName("NAME");
createwebhookrequest.setWebhookUrl("WEBHOOK_URL");
createwebhookrequest.setSupportedEventsList([EventType.EVENT_TYPE_PROMISSORY_RECEIVED, EventType.EVENT_TYPE_UNSPECIFIED, EventType.EVENT_TYPE_PROMISSORY_RECEIVED]);

service.createWebhook(createwebhookrequest, (err, value:CreateWebhookResponse|null) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
using System;
using Grpc.Core;
using WebhookApi.V1;

namespace main
{
  class Program
  {
    static void Main(string[] args)
    {
      Channel channel = new Channel("YOUR_WEBHOOK_URL:443", ChannelCredentials.Insecure); 
      var client = new WebhookManagerService.WebhookManagerServiceClient(channel); 
      var headers = new Metadata();
      var createWebhookRequest = new CreateWebhookRequest{
        ApiKey = "API_KEY",
        DeliveryMethod = DeliveryMethodType.Delivery_method_type_unspecified,
        Name = "NAME",
        WebhookUrl = "WEBHOOK_URL",
        SupportedEvents = {EventType.Event_type_unspecified, EventType.Event_type_wallet_created, EventType.Event_type_promissory_received},
      };
      var reply = client.CreateWebhook(createWebhookRequest, headers);
      Console.WriteLine("Response: " + reply);
      channel.ShutdownAsync().Wait();
    }
  }
}
package demo;

import io.grpc.Channel;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import webhook_api.v1.Webhook.CreateWebhookRequest;
import webhook_api.v1.Webhook.CreateWebhookResponse;
import webhook_api.v1.Webhook.DeliveryMethodType;
import webhook_api.v1.Webhook.EventType;
import webhook_api.v1.WebhookManagerServiceGrpc;

public class App {
  public static void main(String[] args) {
    ManagedChannel channel = ManagedChannelBuilder
      .forAddress("YOUR_WEBHOOK_URL", 443)
      .usePlaintext()
      .build();
    WebhookManagerServiceGrpc.WebhookManagerServiceBlockingStub blockStub =
        WebhookManagerServiceGrpc.newBlockingStub(channel);
    
    CreateWebhookRequest req_CreateWebhookRequest =
        CreateWebhookRequest.newBuilder()
          .setApiKey("API_KEY")
          .setDeliveryMethod(DeliveryMethodType.DELIVERY_METHOD_TYPE_UNSPECIFIED)
          .setName("NAME")
          .setWebhookUrl("WEBHOOK_URL")
          .addSupportedEvents(EventType.EVENT_TYPE_UNSPECIFIED)
          .addSupportedEvents(EventType.EVENT_TYPE_WALLET_CREATED)
          .addSupportedEvents(EventType.EVENT_TYPE_PROMISSORY_RECEIVED)
          .build();
    CreateWebhookResponse resp = blockStub.createWebhook(req_CreateWebhookRequest);
    System.out.println(resp);
    channel.shutdown();
  }
}
const createwebhookrequest = new CreateWebhookRequest();
createwebhookrequest.setApiKey("API_KEY");
createwebhookrequest.setDeliveryMethod(DeliveryMethodType.DELIVERY_METHOD_TYPE_GRPC);
createwebhookrequest.setName("NAME");
createwebhookrequest.setWebhookUrl("WEBHOOK_URL");
createwebhookrequest.setSupportedEventsList([EventType.EVENT_TYPE_PING, EventType.EVENT_TYPE_CONTRACT_PROPOSAL_COMPLETED, EventType.EVENT_TYPE_WALLET_CREATED]);

service.createWebhook(createwebhookrequest, (err, value) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
extern crate grpc-sdks;
use tonic::transport::Channel;

use grpc-sdks::webhook_api::v1::CreateWebhookRequest;
use grpc-sdks::webhook_api::v1::webhook_manager_service_client::WebhookManagerServiceClient;
use grpc-sdks::webhook_api::v1::DeliveryMethodType;
use grpc-sdks::webhook_api::v1::EventType;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
  let channel = Channel::from_static("YOUR_WEBHOOK_URL")
    .connect()
    .await?;
  let mut client = WebhookManagerServiceClient::new(channel); 

  let request = tonic::Request::new(
    CreateWebhookRequest{
      api_key: String::from("API_KEY"),
      delivery_method: DeliveryMethodType::DeliveryMethodTypeUnspecified as i32,
      name: String::from("NAME"),
      supported_events: Vec::from([EventType::EventTypeUnspecified as i32, EventType::EventTypeWalletCreated as i32, EventType::EventTypePromissoryReceived as i32]),
      webhook_url: String::from("WEBHOOK_URL")
    });
// sending request and waiting for response
  let response = client.create_webhook(request).await?.into_inner();
  println!("RESPONSE={:?}", response);
  Ok(())
}
package app

import io.grpc.ManagedChannelBuilder
import webhook_api.v1.Webhook.CreateWebhookRequest
import webhook_api.v1.Webhook.CreateWebhookResponse
import webhook_api.v1.Webhook.DeliveryMethodType
import webhook_api.v1.Webhook.EventType
import webhook_api.v1.WebhookManagerServiceGrpc

fun main() {
    val channel = ManagedChannelBuilder
            .forAddress("YOUR_WEBHOOK_URL", 443)
            .usePlaintext()
            .build()
    var blockStub = WebhookManagerServiceGrpc.newBlockingStub(channel)
    
    val req_CreateWebhookRequest = CreateWebhookRequest.newBuilder()
          .setApiKey("API_KEY")
          .setDeliveryMethod(DeliveryMethodType.DELIVERY_METHOD_TYPE_UNSPECIFIED)
          .setName("NAME")
          .setWebhookUrl("WEBHOOK_URL")
          .addSupportedEvents(EventType.EVENT_TYPE_UNSPECIFIED)
          .addSupportedEvents(EventType.EVENT_TYPE_WALLET_CREATED)
          .addSupportedEvents(EventType.EVENT_TYPE_PROMISSORY_RECEIVED)
          .build()
    val resp = blockStub.createWebhook(req_CreateWebhookRequest)
    println(resp)
    channel.shutdown()
}


returns CreateWebhookResponse

webhook_api.v1.CreateWebhookResponse

FieldTypeDescription
webhook_public_keystringWebhook Public Key
webhookWebhookWebhook
{
  "webhook_public_key": "zWebhookMultibase58Encoded",
  "webhook": {
    "id": "ID1",
    "owner_id": "eyJwtHeader.eyJwtPayload.Secret1",
    "name": "NAME1",
    "webhook_url": "WEBHOOK_URL1",
    "supported_events": [
      0,
      1
    ],
    "delivery_method": 0
  }
}