Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
So I am making a Facebook Workplace bot, I have test to make sure that 1 id will work which it did successfully. But I need to make it send to multiple people. so Under id I created an array using resources I found:

JavaScript
{
    "recipient": {
        "id": ["100036317", "10003631"]
            

        
    },
    
    "message": {
        "text": "Hello!"
    }
}


and receive the following error:
JavaScript
{
    "error": {
        "message": "(#100) Param recipient[id] must be a valid ID string (e.g., \"123\")",
        "type": "OAuthException",
        "code": 100,
        "fbtrace_id": "AxcFhBpdI_Fkoy_XOugkHOf"
    }
}


What I have tried:

From what I've seen online I have it correct. Basic knowledge I know arrays are usually with brackets but I tried with parenthesis with no luck.
Posted
Updated 14-May-20 7:36am

1 solution

If the property accepted an array, then your JSON would be correct.

But the error message is pretty clear: the recipient.id cannot be an array; it must be a single string.

You'll need to consult the documentation of the API you're trying to call to find out whether it supports sending to multiple recipients, and if so, how.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900