question

zgrada-zgrada11937 avatar image
zgrada-zgrada11937 asked zgrada-zgrada11937 commented

There is no recipient info in response

Hi,

I've tried to get fax  recipient info, but I always get null in response.


General Topic
1 |1500 characters needed characters left characters exceeded

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

1 Answer

Phong Vu avatar image
Phong Vu answered zgrada-zgrada11937 commented
Can you post some code where you send the fax message and check the recipient info instead of that screen shot. That way I can help you better.

+ Phong
5 comments
1 |1500 characters needed characters left characters exceeded

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

Hi,

I do not send a fax, but I've tried to download fax attachments. Here is code:

await rc.Authorize(Username, Extension, Password);
rc.AutoRefreshToken = false;

var account = rc.Restapi().Account();
var extension = account.Extension();
var response = await extension.MessageStore().List(new { direction = "Inbound", messageType = "Fax", messageStatus = "Received" });

if(response != null && response.records.Length > 0)
{
    // fax
    var messages = response.records.Where(m => m.messageStatus != "SendingFailed");

    foreach (var m in messages)
    {
        foreach (var a in m.attachments)
        {
            var messageResponse = await extension.MessageStore( m.id).Content( a.id).Get();

            if (messageResponse.data != null && messageResponse.data.Length > 0)
            {
                var content = messageResponse.data;
                
                    model.FileName = a.id,
                    model.FileContent = content,
                    model.To=m.to.Select(x=>x.phoneNumber).FirstOrDefault()
            }
        }
    }
0 Likes 0 ·
Just a quick note, there is no messageStatus query parameter so you get request params is invalid. Not 100% sure if that is the only cause of the problem but you should remove it and run the code again. Also, if you dont specify the dateFrom and dateTo params, it will just read the message store for the last 24 hrs, which may not have the fax you are looking for.

So try something like this:

var response = await extension.MessageStore().List(new { direction = "Inbound", messageType = "Fax", dateFrom = "2018-10-12T00:00:00.000Z", dateTo = "2018-12-12T00:00:00.000Z" });

Hope this helps!
+ Phong
0 Likes 0 ·
Here is the result. The same thing. NULL value for "to" property.
0 Likes 0 ·
Sorry that I misunderstood your question as you said you got the recipient as null in the response. I thought that the response was null.

Anyway, the message list (message-store) API reference is generic and it did not mention about the "to" field for inbound Fax message. For a fax record item with inbound type, the "to" field won't exist. Instead, the recipient's phone number is in the subject field. I see you wipe it out in your screenshot above. So have a look at that number and use it as the recipient's number.

+ Phong
0 Likes 0 ·
Ok, thanks. It should work.
0 Likes 0 ·

Developer sandbox tools

Using the RingCentral Phone for Desktop, you can dial or receive test calls, send and receive test SMS or Fax messages in your sandbox environment.

Download RingCentral Phone for Desktop:

Tip: switch to the "sandbox mode" before logging in the app:

  • On MacOS: press "fn + command + f2" keys
  • On Windows: press "Ctrl + F2" keys