Send a text message via API
Topic outline
-
-
PREREQ's: You must have a phone number with an approved BRAND and CAMPAIGN (see "getting ready for texting")
1)
Get your API KEY
-On the primary account visit https://my.ringplan.com/account/api-access
Copy the api key
2) Create or Get a conversation ID
https://ssp-backend.ringplan.com/ui/#/Texting%20-%20Conversations/controllers.texting.create_conversation_v2
In this example I’m sending from my office number 858-431-4411 to my cell phone 858-688-1740curl -X 'POST' \
'https://ssp-backend.ringplan.com/texting/v2/conversations' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <RINGPLAN_API_KEY> \
-H 'Content-Type: application/json' \
-d '{
"recipients": [
{
"number": "8586881740"
}
],
"from_number": "8584314411",
"conversation_type": "direct",
"name": "Business partners chat"
}'From there you will get a reply similar to:
"conversation_type": "direct",
"countunreadmessages": 0,
"created_at": "2021-03-01T14:56:57",
"from_number": "8584314411",
"has_direct_msg": true,
"has_hidden_msg": false,
"id": "603d00b9b23691e50d272844",
"last_message_created_at": "2024-03-15T12:46:13.697000-0700",
"last_msg": {
"created_at": "2024-03-15T19:46:13.697000Z",
"direction": "inbound",
"files": [],
"frm": "+18586881740",
"is_unread": false,
"text": "Got it",
"to": "+18584314411"
},
"lastmessage": {
"campaign_info": null,
"conversation_id": "603d00b9b233) SEND OUTBOUND TEXT
Now we will use the messages/publish method to send it out:
https://ssp-backend.ringplan.com/ui/#/Texting%20-%20Messages/controllers.texting.publish_message_v2
curl -X 'POST' \
'https://ssp
backend.ringplan.com/texting/v2/conversations/<CONVERSATION_ID_HE
RE>/messages/publish' \
-H 'accept: application/json' \
-H 'Authorization: Bearer <RINGPLAN_API_KEY> \
-H 'Content-Type: application/json' \
-d '{
"text": "Lorem ipsum dolor sit amet",
"with_warning": true
}'We will now get a response similar to:
[
{
"campaign_info": null,
"conversation_id": "603d00b9b23691e50d272844",
"conversation_type": "direct",
"created_at": "2024-03-22T13:09:24.026707-0700",
"direction": "outbound",
"files": [],
"frm": "+18584314411",
"id": "65fde574de76765391909d52",
"is_read": null,
"is_visible": true,
"media_urls": [],
"source_conversation_type": "direct",
"stamp_id": null,
"success": true,
"text": "Lorem ipsum dolor sit amet",
"to": "+18586881740"
}
]4) you should get the text message on your cell phone.
-