I have configured Plivo SMS in my org. Sending and logging outbound messages is no problem. I have configured a Plivo app to direct inbound SMS to my rest resource to create an inbound record (custom object I've called Plivo_SMS__c), but am having an issue with receiving the "from" number. When I try to define a string labeled "from", I get an error. Here is my basic rest resource:
@RestResource(urlMapping='/sms/*')
Global with sharing class smslog{
@HttpPost
global static ID createSMSrecord(String MessageUUID, string From,
string to, String mtype, string Text) {
Plivo_SMS__C thisPlivo = new Plivo_SMS__C(
name=messageUUID,
Fromnum__c=From,
to__c=to,
type__c=type,
SMSmessage__c = text);
insert thisPlivo;
return thisPlivo.Id;
}
}
when I change the string "from" to something like fromnumber, my testing is successful, but the actual POST I receive looks like this:
{'To': '19165555554', 'From': '19165555555', 'Text': 'Example Message', 'Type': 'sms', 'MessageUUID': '015447-b20c-15r6-a746-06anob21425'}
I also anticipate a similar issue with the string "type" as well. Is there a way to assign a string variable to a key word? I am uncertain as to the correct way to receive and process this post. Thank you in advance for any assistance.