• Home
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • General
  • News & Announcements
  • Ideas
  • RingCentral Office
    • Getting Started
    • Authentication
    • App Graduation
    • API Betas & Developer Previews
    • REST API
      • Call Management API
      • Glip API
      • Meetings API
      • Messaging API (SMS, Fax, Voicemail)
      • Provisioning API
      • Voice and Telephony API
    • Environment (Sandbox, Gateway)
    • SDKs
    • Admin & Credentials
  • RingCentral Engage
    • Getting Started
    • REST API
      • Interactions API
      • Provisioning API
      • Routing API
  • Jobs/Requests for Help
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Users
  • Badges
Skip to main content
  • Create
    • Ask a question
    • Create an article
    • Post an idea
    • General
    • News & Announcements
    • Ideas
    • RingCentral Office
      • Getting Started
      • Authentication
      • App Graduation
      • API Betas & Developer Previews
      • REST API
        • Call Management API
        • Glip API
        • Meetings API
        • Messaging API (SMS, Fax, Voicemail)
        • Provisioning API
        • Voice and Telephony API
      • Environment (Sandbox, Gateway)
      • SDKs
      • Admin & Credentials
    • RingCentral Engage
      • Getting Started
      • REST API
        • Interactions API
        • Provisioning API
        • Routing API
    • Jobs/Requests for Help
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Sign in
  • Home
  • RingCentral Office
  • REST API
  • Messaging API (SMS, Fax, Voicemail)

question

P B avatar image
P B asked · Aug 23 at 01:44 PM

[sandbox] unable to capture payload on server side.

Problem: unable to capture payload from notifications

Platform: ASP.NET


Successfully execute the following code and webhook was created.

public static async Task Main(string[] args)
{
    try
    {
        var rc = new RestClient(RINGCENTRAL_CLIENT_ID, RINGCENTRAL_CLIENT_SECRET);
        await rc.Authorize(RINGCENTRAL_USERNAME, RINGCENTRAL_EXTENSION, RINGCENTRAL_PASSWORD);
        await rc.Restapi().Subscription().Post(new CreateSubscriptionRequest
        {
            eventFilters = new[] { "/restapi/v1.0/account/~/extension/~/message-store" },
            deliveryMode = new NotificationDeliveryModeRequest
            {
                transportType = "WebHook",
                address = DELIVERY_ADDRESS
            }
        });
        Console.WriteLine("WebHook ready!");
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message);
    }

    Console.Read();
}


Expected to capture (not exact, but similar) payload

{  "timestamp": "2018-10-07T12:05:00.408+0000",  "uuid": "b11c9430-9687-4498-b12b-3fcb470bfe04",  "event": "/restapi/v1.0/account/230919004/extension/230919004/message-store",  "subscriptionId": "9d38419f-645f-4ee3-a053-8cf1368c21c4",  "body": {    "extensionId": 230919004,    "lastUpdated": "2018-10-07T12:05:00.531+0000",    "changes": [      {        "type": "Fax",        "updatedCount": 0,        "newCount": 1      }    ]  }}


I am using the following code to handle both subscription creation and payload handling.

public void ProcessRequest(HttpContext context)
{
    string headers = string.Empty;
    foreach (var key in context.Request.Headers.AllKeys)
    {
        headers += key + "=" + context.Request.Headers[key] + Environment.NewLine;
    }
    context.Response.Write(context.Request.RequestType + " == " + headers);

    if (context.Request.Headers["Validation-Token"] != null)
        context.Response.Headers.Add("Validation-Token", context.Request.Headers["Validation-Token"]);

    using (StreamReader reader = new StreamReader(context.Request.InputStream))
    {
        context.Response.Write(reader.ReadToEnd()
    }
    context.Response.Write(context.Request);
}


Can some please help on this matter?

fax apisubscriptionsc#notificationspayload
Comment
0
1 |1000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Viewable by all users

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

2 Answers

· Write an Answer
  • Sort by Created Created
  • Sort by Oldest Oldest
  • Sort by Votes Votes
Phong Vu avatar image
Phong Vu answered · Aug 23 at 02:44 PM

I can't say what is wrong with your code. It's hard to trace w/o seeing the entire project and environment setup. But, please see this quick start for help.

· 1 comment · Share
1 |1000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Viewable by all users

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

P B avatar image P B · Aug 23 at 05:02 PM

Please view the code pasted as an answer below.

0 · ·
P B avatar image
P B answered · Aug 23 at 03:04 PM

Hi Phong,

I followed the this like Webhook Notifications C# Quick Start to create a dotnet core app.

After running the setup_webhook, I received the following subscription info

{
  "id": "6d926976-2db7-4963-8e92-3e18814800ca",
  "uri": "https://platform.devtest.ringcentral.com/restapi/v1.0/subscription/6d926976-2db7-4963-8e92-3e18814800ca",
  "eventFilters": [
    "/restapi/v1.0/account/265370004/extension/265370004/message-store"
  ],
  "disabledFilters": null,
  "expirationTime": "2019-08-30T14:40:56.347Z",
  "expiresIn": 604799,
  "status": "Active",
  "creationTime": "2019-08-23T14:40:56.347Z",
  "deliveryMode": {
    "transportType": "WebHook",
    "encryption": false,
    "address": "http://dev.jsacalltracker.com/webhook/update_faxes.ashx",
    "subscriberKey": null,
    "secretKey": null,
    "encryptionAlgorithm": null,
    "encryptionKey": null
  },
  "blacklistedData": null
}

I then sent a few faxes using Create Fax Message. I don't see any subscriptions received by the previous code.

I want to know, how to handle the notifications sent by RingCentral when a new fax is received by my fax number.

· 1 comment · Share
1 |1000 characters needed characters left characters exceeded
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Toggle Comment visibility. Current Visibility: Viewable by all users

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Phong Vu avatar image Phong Vu ♦♦ · Aug 23 at 05:10 PM

Did you run the server code?

cd webhook-server
dotnet run
0 · ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

question details

2 People are following this question.

P2568070020 follows this question Phong1426275020 follows this question
Answers Subscribe to Answers Answers and Comments Subscribe to Comments and Answers

Related Questions

RingCentral not reachable for Fax - Recurrences are increasing 1 Answer

Lookup a specific fax in the call log to get its status 2 Answers

Simulate fax 3 Answers

Sending a fax attachment using PowerShell 5 Answers

How can a fax "to" be null? 1 Answer

  • Developer Home
  • ·
  • Community Guidelines
  • ·
  • Legal
  • ·
  • Privacy Notice