...
Filter by label | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
🛠 Examples by Language
These code snippets exhibit examples of sending SMS using the GraphQL API without using a GraphQL client library.
Note |
---|
We strongly suggest using a GraphQL client library in the language of your choice when interacting with the Volt GraphQL API. In addition, we suggest using a pattern of retrying requests with exponential backoff. While Volt strives to ensure all services achieve 99.99% availability, transient failures are inevitable with any service. Retries allow clients to survive these random partial failures and short-lived transient failures by sending the same request again. Most common HTTP libraries include the ability to retry requests as a built-in feature. |
C#
Code Block | ||
---|---|---|
| ||
var client = new RestClient("https://api.respondflow.com/graphql"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer <token>"); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\"query\":\"mutation createMessage ($to: String!, $from: String!, $body: String!, $media: [String!]) {\\n createMessage (to: $to, from: $from, body: $body, media: $media) {\\n id\\n legacyId\\n toNumber\\n fromNumber\\n status\\n statusDescription\\n media\\n body\\n sentAt\\n confirmedAt\\n }\\n}\",\"variables\":{\"to\":\"+15555550145\",\"from\":\"+15555550123\",\"body\":\"Your One Time Code is 654312\\n\\nReply STOP to opt-out.\",\"media\":[]}}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); Console.WriteLine(response.Content); |
...