CreateScheduledReaction

Creates a Scheduled Reaction.

rpc CreateScheduledReaction

webhook_api.v1.CreateScheduledReaction

Creates a Scheduled Reaction.

requests CreateScheduledReactionRequest

webhook_api.v1.CreateScheduledReactionRequest

FieldTypeDescription
api_keystringAPI Key as a JWT
namestringWebhook name.
reaction_typeScheduleReactionType enum
FieldNumberDescription
SCHEDULE_REACTION_TYPE_UNSPECIFIED0Reaction type.Scheduled Reaction Type Unspecified.
SCHEDULE_REACTION_TYPE_CREATE_CONTRACT1Reaction type.Scheduled Reaction Type Wallet Created.
cron_tabstringRecurring schedule is in the form of a crontab, requiring five values. This example will execute once per minute.
┌───────────── minute (0 - 59)
⏐ ┌───────────── hour (0 - 23)
⏐ ⏐ ┌───────────── day of the month (1 - 31)
⏐ ⏐ ⏐ ┌───────────── month (1 - 12)
⏐ ⏐ ⏐ ⏐ ┌───────────── day of the week (0 - 6) (Sunday to Saturday
⏐ ⏐ ⏐ ⏐ ⏐
⏐ ⏐ ⏐ ⏐ ⏐
* * * * *
reaction_payloadoneof
FieldTypeDescription
create_contract_payloadCreateContractReactionPayloadReaction Payload for sending payment.
resp, _ := webhookManagerService.CreateScheduledReaction(ctx, &v1.CreateScheduledReactionRequest{
  ApiKey: "API_KEY",
  CronTab: "*****",
  Name: "REACTION_NAME1",
  ReactionType: v1.ScheduleReactionType_SCHEDULE_REACTION_TYPE_CREATE_CONTRACT,
  ReactionPayload: &v1.CreateScheduledReactionRequest_CreateContractPayload{
    CreateContractPayload:&v1.CreateContractReactionPayload{
    Memo: "MEMO",
    SenderWalletId: "SENDER_WALLET_ID1",
    TimeoutSecs: 10000,
    Commitments: []*common.Commitment{
      &common.Commitment{
        Amount: &common.Amount{
          Amount: 100,
          CurrencyCode: "USD",
          Decimals: 2,
        },
        Recipient: "zRecipientPublicKey",
        Sender: "zSenderPublicKey",
      },
      &common.Commitment{
        Amount: &common.Amount{
          Amount: 500,
          CurrencyCode: "USD",
          Decimals: 2,
        },
        Recipient: "zRecipientPublicKey2",
        Sender: "zSenderPublicKey2",
      },
    },
    Conditions: []*common.Condition{
      &common.Condition{
        Condition: &common.Condition_Hash{
          Hash:&common.HashCondition{
          Hash: []byte{215,126,121,211,126,116,107,206,188,213,207,56},
          Presenter: "PresenterPublicKey",
        },
        },
      },
      &common.Condition{
        Condition: &common.Condition_Hash{
          Hash:&common.HashCondition{
          Hash: []byte{215,126,121,211,126,116,107,206,188,213,207,56},
          Presenter: "PresenterPublicKey",
        },
        },
      },
    },
  },
  },
})
fmt.Println(resp)
const hashcondition = new HashCondition();
hashcondition.setHash(Uint8Array.from([215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56]));
hashcondition.setPresenter("PresenterPublicKey");
const condition = new Condition();
condition.setHash(hashcondition);
const hashcondition1 = new HashCondition();
hashcondition1.setHash(Uint8Array.from([215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56]));
hashcondition1.setPresenter("PresenterPublicKey");
const condition1 = new Condition();
condition1.setHash(hashcondition1);
const amount = new Amount();
amount.setAmount(100);
amount.setCurrencyCode("USD");
amount.setDecimals(2);
const commitment = new Commitment();
commitment.setAmount(amount);
commitment.setRecipient("zRecipientPublicKey");
commitment.setSender("zSenderPublicKey");
const amount1 = new Amount();
amount1.setAmount(500);
amount1.setCurrencyCode("USD");
amount1.setDecimals(2);
const commitment1 = new Commitment();
commitment1.setAmount(amount1);
commitment1.setRecipient("zRecipientPublicKey2");
commitment1.setSender("zSenderPublicKey2");
const createcontractreactionpayload = new CreateContractReactionPayload();
createcontractreactionpayload.setMemo("MEMO");
createcontractreactionpayload.setSenderWalletId("SENDER_WALLET_ID1");
createcontractreactionpayload.setTimeoutSecs(10000);
createcontractreactionpayload.setConditionsList([condition, condition1]);
createcontractreactionpayload.setCommitmentsList([commitment, commitment1]);
const createscheduledreactionrequest = new CreateScheduledReactionRequest();
createscheduledreactionrequest.setApiKey("API_KEY");
createscheduledreactionrequest.setCronTab("*****");
createscheduledreactionrequest.setName("REACTION_NAME1");
createscheduledreactionrequest.setReactionType(ScheduleReactionType.SCHEDULE_REACTION_TYPE_CREATE_CONTRACT);
createscheduledreactionrequest.setCreateContractPayload(createcontractreactionpayload);

service.createScheduledReaction(createscheduledreactionrequest, (err, value:CreateScheduledReactionResponse|null) => {
    const resp = JSON.stringify(err ? err : value);
    console.log("received ", resp);
})
using System;
using Grpc.Core;
using Common;
using Google.Protobuf;
using System.Text;
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 amount = new Amount{
        Amount = 100,
        CurrencyCode = "USD",
        Decimals = 2,
      };
      var commitment = new Commitment{
        Amount = amount,
        Recipient = "zRecipientPublicKey",
        Sender = "zSenderPublicKey",
      };
      var amount1 = new Amount{
        Amount = 500,
        CurrencyCode = "USD",
        Decimals = 2,
      };
      var commitment1 = new Commitment{
        Amount = amount1,
        Recipient = "zRecipientPublicKey2",
        Sender = "zSenderPublicKey2",
      };
      var hashCondition = new HashCondition{
        Hash = ByteString.CopyFrom(new byte[]{215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56}),
        Presenter = "PresenterPublicKey",
      };
      var condition = new Condition{
        Hash = hashCondition,
      };
      var hashCondition1 = new HashCondition{
        Hash = ByteString.CopyFrom(new byte[]{215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56}),
        Presenter = "PresenterPublicKey",
      };
      var condition1 = new Condition{
        Hash = hashCondition1,
      };
      var createContractReactionPayload = new CreateContractReactionPayload{
        Memo = "MEMO",
        SenderWalletId = "SENDER_WALLET_ID1",
        TimeoutSecs = 10000,
        Commitments = {commitment, commitment1},
        Conditions = {condition, condition1},
      };
      var createScheduledReactionRequest = new CreateScheduledReactionRequest{
        ApiKey = "API_KEY",
        CronTab = "*****",
        Name = "REACTION_NAME1",
        ReactionType = ScheduleReactionType.Schedule_reaction_type_create_contract,
        CreateContractPayload = createContractReactionPayload,
      };
      var reply = client.CreateScheduledReaction(createScheduledReactionRequest, headers);
      Console.WriteLine("Response: " + reply);
      channel.ShutdownAsync().Wait();
    }
  }
}
package demo;

import io.grpc.Channel;
import io.grpc.ManagedChannel;
import io.grpc.ManagedChannelBuilder;
import common.Common.Amount;
import common.Packet.Commitment;
import common.Packet.Condition;
import common.Packet.HashCondition;
import webhook_api.v1.Webhook.CreateContractReactionPayload;
import webhook_api.v1.Webhook.CreateScheduledReactionRequest;
import webhook_api.v1.Webhook.CreateScheduledReactionResponse;
import webhook_api.v1.Webhook.ScheduleReactionType;
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);
    
    Amount req_Amount =
        Amount.newBuilder()
          .setAmount(100)
          .setCurrencyCode("USD")
          .setDecimals(2)
          .build();
    Commitment req_Commitment =
        Commitment.newBuilder()
          .setAmount(req_Amount)
          .setRecipient("zRecipientPublicKey")
          .setSender("zSenderPublicKey")
          .build();
    Amount req_Amount2 =
        Amount.newBuilder()
          .setAmount(500)
          .setCurrencyCode("USD")
          .setDecimals(2)
          .build();
    Commitment req_Commitment2 =
        Commitment.newBuilder()
          .setAmount(req_Amount2)
          .setRecipient("zRecipientPublicKey2")
          .setSender("zSenderPublicKey2")
          .build();
    HashCondition req_HashCondition =
        HashCondition.newBuilder()
          .setHash(com.google.protobuf.ByteString.copyFrom(new byte[]{215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56}))
          .setPresenter("PresenterPublicKey")
          .build();
    Condition req_Condition =
        Condition.newBuilder()
          .setHash(req_HashCondition)
          .build();
    HashCondition req_HashCondition2 =
        HashCondition.newBuilder()
          .setHash(com.google.protobuf.ByteString.copyFrom(new byte[]{215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56}))
          .setPresenter("PresenterPublicKey")
          .build();
    Condition req_Condition2 =
        Condition.newBuilder()
          .setHash(req_HashCondition2)
          .build();
    CreateContractReactionPayload req_CreateContractReactionPayload =
        CreateContractReactionPayload.newBuilder()
          .setMemo("MEMO")
          .setSenderWalletId("SENDER_WALLET_ID1")
          .setTimeoutSecs(10000)
          .addCommitments(req_Commitment)
          .addCommitments(req_Commitment2)
          .addConditions(req_Condition)
          .addConditions(req_Condition2)
          .build();
    CreateScheduledReactionRequest req_CreateScheduledReactionRequest =
        CreateScheduledReactionRequest.newBuilder()
          .setApiKey("API_KEY")
          .setCronTab("*****")
          .setName("REACTION_NAME1")
          .setReactionType(ScheduleReactionType.SCHEDULE_REACTION_TYPE_CREATE_CONTRACT)
          .setCreateContractPayload(req_CreateContractReactionPayload)
          .build();
    CreateScheduledReactionResponse resp = blockStub.createScheduledReaction(req_CreateScheduledReactionRequest);
    System.out.println(resp);
    channel.shutdown();
  }
}
const amount = new Amount();
amount.setAmount(100);
amount.setCurrencyCode("USD");
amount.setDecimals(2);
const commitment = new Commitment();
commitment.setAmount(amount);
commitment.setRecipient("zRecipientPublicKey");
commitment.setSender("zSenderPublicKey");
const amount1 = new Amount();
amount1.setAmount(500);
amount1.setCurrencyCode("USD");
amount1.setDecimals(2);
const commitment1 = new Commitment();
commitment1.setAmount(amount1);
commitment1.setRecipient("zRecipientPublicKey2");
commitment1.setSender("zSenderPublicKey2");
const hashcondition = new HashCondition();
hashcondition.setHash(Uint8Array.from([215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56]));
hashcondition.setPresenter("PresenterPublicKey");
const condition = new Condition();
condition.setHash(hashcondition);
const hashcondition1 = new HashCondition();
hashcondition1.setHash(Uint8Array.from([215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56]));
hashcondition1.setPresenter("PresenterPublicKey");
const condition1 = new Condition();
condition1.setHash(hashcondition1);
const createcontractreactionpayload = new CreateContractReactionPayload();
createcontractreactionpayload.setMemo("MEMO");
createcontractreactionpayload.setSenderWalletId("SENDER_WALLET_ID1");
createcontractreactionpayload.setTimeoutSecs(10000);
createcontractreactionpayload.setCommitmentsList([commitment, commitment1]);
createcontractreactionpayload.setConditionsList([condition, condition1]);
const createscheduledreactionrequest = new CreateScheduledReactionRequest();
createscheduledreactionrequest.setApiKey("API_KEY");
createscheduledreactionrequest.setCronTab("*****");
createscheduledreactionrequest.setName("REACTION_NAME1");
createscheduledreactionrequest.setReactionType(ScheduleReactionType.SCHEDULE_REACTION_TYPE_CREATE_CONTRACT);
createscheduledreactionrequest.setCreateContractPayload(createcontractreactionpayload);

service.createScheduledReaction(createscheduledreactionrequest, (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::CreateContractReactionPayload;
use grpc-sdks::webhook_api::v1::CreateScheduledReactionRequest;
use grpc-sdks::webhook_api::v1::webhook_manager_service_client::WebhookManagerServiceClient;
use grpc-sdks::webhook_api::v1::ScheduleReactionType;
use grpc-sdks::common::Amount;
use grpc-sdks::common::Commitment;
use grpc-sdks::common::HashCondition;
use grpc-sdks::common::Condition;

#[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(
    CreateScheduledReactionRequest{
      api_key: String::from("API_KEY"),
      cron_tab: String::from("*****"),
      name: String::from("REACTION_NAME1"),
      reaction_payload: Some(CreateContractReactionPayload{
        commitments: Vec::from([Commitment{
          amount: Some(Amount{
            amount: 100,
            currency_code: String::from("USD"),
            decimals: 2
          }),
          recipient: String::from("zRecipientPublicKey"),
          sender: String::from("zSenderPublicKey")
        }, Commitment{
          amount: Some(Amount{
            amount: 500,
            currency_code: String::from("USD"),
            decimals: 2
          }),
          recipient: String::from("zRecipientPublicKey2"),
          sender: String::from("zSenderPublicKey2")
        }]),
        conditions: Vec::from([Condition{
          condition: Some(HashCondition{
            algorithm_oid: None,
            hash: Vec::from([215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56]),
            presenter: String::from("PresenterPublicKey")
          })
        }, Condition{
          condition: Some(HashCondition{
            algorithm_oid: None,
            hash: Vec::from([215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56]),
            presenter: String::from("PresenterPublicKey")
          })
        }]),
        memo: String::from("MEMO"),
        sender_wallet_id: String::from("SENDER_WALLET_ID1"),
        timeout_secs: 10000
      }),
      reaction_type: ScheduleReactionType::ScheduleReactionTypeCreateContract as i32
    });
// sending request and waiting for response
  let response = client.create_scheduled_reaction(request).await?.into_inner();
  println!("RESPONSE={:?}", response);
  Ok(())
}
package app

import io.grpc.ManagedChannelBuilder
import common.Common.Amount
import common.Packet.Commitment
import common.Packet.Condition
import common.Packet.HashCondition
import webhook_api.v1.Webhook.CreateContractReactionPayload
import webhook_api.v1.Webhook.CreateScheduledReactionRequest
import webhook_api.v1.Webhook.CreateScheduledReactionResponse
import webhook_api.v1.Webhook.ScheduleReactionType
import webhook_api.v1.WebhookManagerServiceGrpc

fun main() {
    val channel = ManagedChannelBuilder
            .forAddress("YOUR_WEBHOOK_URL", 443)
            .usePlaintext()
            .build()
    var blockStub = WebhookManagerServiceGrpc.newBlockingStub(channel)
    
    val req_Amount = Amount.newBuilder()
          .setAmount(100)
          .setCurrencyCode("USD")
          .setDecimals(2)
          .build()
    val req_Commitment = Commitment.newBuilder()
          .setAmount(req_Amount)
          .setRecipient("zRecipientPublicKey")
          .setSender("zSenderPublicKey")
          .build()
    val req_Amount2 = Amount.newBuilder()
          .setAmount(500)
          .setCurrencyCode("USD")
          .setDecimals(2)
          .build()
    val req_Commitment2 = Commitment.newBuilder()
          .setAmount(req_Amount2)
          .setRecipient("zRecipientPublicKey2")
          .setSender("zSenderPublicKey2")
          .build()
    val req_HashCondition = HashCondition.newBuilder()
          .setHash(com.google.protobuf.ByteString.copyFrom(byteArrayOf(215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56)))
          .setPresenter("PresenterPublicKey")
          .build()
    val req_Condition = Condition.newBuilder()
          .setHash(req_HashCondition)
          .build()
    val req_HashCondition2 = HashCondition.newBuilder()
          .setHash(com.google.protobuf.ByteString.copyFrom(byteArrayOf(215, 126, 121, 211, 126, 116, 107, 206, 188, 213, 207, 56)))
          .setPresenter("PresenterPublicKey")
          .build()
    val req_Condition2 = Condition.newBuilder()
          .setHash(req_HashCondition2)
          .build()
    val req_CreateContractReactionPayload = CreateContractReactionPayload.newBuilder()
          .setMemo("MEMO")
          .setSenderWalletId("SENDER_WALLET_ID1")
          .setTimeoutSecs(10000)
          .addCommitments(req_Commitment)
          .addCommitments(req_Commitment2)
          .addConditions(req_Condition)
          .addConditions(req_Condition2)
          .build()
    val req_CreateScheduledReactionRequest = CreateScheduledReactionRequest.newBuilder()
          .setApiKey("API_KEY")
          .setCronTab("*****")
          .setName("REACTION_NAME1")
          .setReactionType(ScheduleReactionType.SCHEDULE_REACTION_TYPE_CREATE_CONTRACT)
          .setCreateContractPayload(req_CreateContractReactionPayload)
          .build()
    val resp = blockStub.createScheduledReaction(req_CreateScheduledReactionRequest)
    println(resp)
    channel.shutdown()
}


returns CreateScheduledReactionResponse

webhook_api.v1.CreateScheduledReactionResponse

FieldTypeDescription
scheduled_reactionScheduledReactionScheduled Reaction.
{
  "scheduled_reaction": {
    "id": "REACTION_ID2",
    "name": "REACTION_NAME2",
    "reaction_type": 1,
    "cron_tab": "*****",
    "reaction_payload": {
      "create_contract_payload": {
        "sender_wallet_id": "SENDER_WALLET_ID2",
        "commitments": [
          {
            "sender": "zSenderPublicKey",
            "recipient": "zRecipientPublicKey",
            "amount": {
              "currency_code": "USD",
              "amount": 100,
              "decimals": 2
            }
          },
          {
            "sender": "zSenderPublicKey2",
            "recipient": "zRecipientPublicKey2",
            "amount": {
              "currency_code": "USD",
              "amount": 500,
              "decimals": 2
            }
          }
        ],
        "conditions": [
          {
            "condition": {
              "hash": {
                "presenter": "PresenterPublicKey",
                "hash": "13550350a8681c84"
              }
            }
          },
          {
            "condition": {
              "hash": {
                "presenter": "PresenterPublicKey",
                "hash": "13550350a8681c84"
              }
            }
          }
        ],
        "timeout_secs": 10000,
        "memo": "MEMO"
      }
    }
  }
}