Generated by the PHP http_build_query function.įor POST and PUT requests, the request body should contain either URL-encoded parameters formatted as above, or a JSON object, depending on whether the request's Content-Type header Telerivet's client libraries will automatically encode parameters in this format, which is the same as Objects recursively encoded using separate parameters for each key, like foo, foo, etc.Arrays recursively encoded using separate parameters for each item, like foo, foo, etc.Boolean false as either '0', or the case-sensitive string 'false'.Boolean true as either '1' or the case-sensitive string 'true'.Strings and numbers as normal URL-encoded query parameters. You can manage API clients and generate API keys on the Developer API settings page in the Telerivet dashboard.Īuthorization: Basic base64_encode(YOUR_API_KEY:)įor GET requests, parameters should be encoded in the query string as follows: (However, using the api_key parameter in the URL query string is discouraged, because the API key will appear in Telerivet's server logs.)Įach API key is associated with an API client, which has certain permissions for a Telerivet project or organization. This may be easier if your development environment doesn't support Basic authentication. To protect your API key, all API requests must be performed over SSL (i.e., HTTPS).Īlternatively, you can authenticate by passing your API key as a parameter named api_key in the URL query string or POST data. With your Telerivet API key as the username. Since Telerivet's API just uses standard HTTP methods, you can still easily integrate your application with Telerivet even without a client library.Īuthentication to the REST API occurs via HTTP Basic Auth, If you're using another programming language, let us know what language you're using, to help us decide which client libraries to work on next. If you're using one of the following programming languages, we highly recommend using one of our well-documented and supported client libraries for interacting with the REST API: To change the language used for the example code, click any of the links at the top right corner of the page. NET client library andįill in variables displayed in red like YOUR_API_KEY and PROJECT_ID with theĪppropriate values for your account, which you can find on your API Keys page. Install the PHP client library and install the Python client library and install the Ruby client library and install the Node.js client library and install the. Message sent_msg = await project.SendMessageAsync(Util.Options( Project project = tr.InitProjectById( project_id) Message sent_msg = ndMessage(Util.options( Project project = tr.initProjectById( project_id) TelerivetAPI tr = new TelerivetAPI( YOUR_API_KEY) Var project = tr.initProjectById( project_id) Var tr = new telerivet.API( YOUR_API_KEY) Project = tr.init_project_by_id( project_id) Project = tr.initProjectById( project_id) $project = $tr->initProjectById( $project_id) But I don't want to build a UI for purchasing numbers in my app, I want to let users just pick a number they already own on Twilio, from their main account.The code below sends an SMS message via Telerivet: I got it to work if I purchase a new number for the $TWILIO_CONNECTED_MAIN_ACCOUNT_SID account via cURL. How do I send an SMS on behalf of a connected account? I've tried various permutations of the 3 account SIDs but can't get any of them to work. $TWILIO_AUTH_TOKEN is my (not the connected account's) auth token. $TWILIO_CONNECTED_MAIN_ACCOUNT_SID is the account SID that the connect button sent back to me (has a name like "Subaccount for ConnectApp. Where $TWILIO_CONNECTED_SUBACCOUNT_SID is a account SID with the phone number I want to send from. Here's what I'm trying: curl -X POST -d "Body=Hi there, this is a test message from cURL" -d 'From=+1aaabbbcccc' -d "To=+1zzzxxxyyyy" "$TWILIO_CONNECTED_SUBACCOUNT_SID/Messages" -u "$TWILIO_CONNECTED_MAIN_ACCOUNT_SID:$TWILIO_AUTH_TOKEN"
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |