darkhorse
darkhorse

Reputation: 8722

How can I trigger an API request using SMS?

Lets say I have 2 mobile phone numbers: X for Agent, Y for Merchant.

I want to be able to have a system where an SMS is sent from X to Y, and this triggers an API request in the Merchant's server, for example a POST request with data that looks something like this:

{
    "mobile_number": X,
    "type": "agent",
    "amount": "240.00"
}

Hopefully you get the idea. How can I do this? Are there any readily available SaaS services that offer these things? Thanks.

Upvotes: 0

Views: 1036

Answers (1)

Matt
Matt

Reputation: 21

If Y is going to be the receiving number that triggers the API request you could:

  1. Get an account at https://portal.ytel.com/user/signup where you can obtain a programmable SMS enabled number.
  2. Buy an SMS enabled number in the portal or the API. Under number management put in a Webhook url under SMS Settings->SMS Request Url and this Webhook will post to the url any inbound SMS sent to it.
  3. Parse the Posted Parameters to the URL for whatever you need from it.
  4. Execute a cURL request to your API endpoint and send over:

{"mobile_number": X,"type": "agent","amount": "240.00" }

Or whatever else you want, I'm assuming it will be different depending on what's sent in the SMS

Upvotes: 1

Related Questions