Unofficial Structurely Ruby Client
This gem lets you interface with the Structurely V1 API.
Adding to a gem:
# my-cool-gem.gemspec
Gem::Specification.new do |spec|
# ...
spec.add_dependency "structurely", "~> 0.1.0"
# ...
end
Or adding to your project:
# Gemfile
gem "structurely", "~> 0.1.0"
The easiest way to use this gem is to create an initializer.
# ./config/structurely.rb
Structurely::Settings.configure do |config|
config.api_key = 'your_api_key'
config.api_endpoint = 'https://api.structurely.com/v1'
end
Structurely Get Conversation Documentation
Structurely::Conversation.show("12345")
Sample output:
{
"id" => "12345",
"muted" => true,
"settings" =>
{
"allowedDomains" => [
"real_estate"
],
"dripCampaignEnabled" => false,
"holmesName" => "Aisa",
"leadTypes" => [
"buyer",
"seller"
],
"reDripsEnabled" => false,
"timeZone" => "America/Chicago"
},
"slots" => [
{"name" => "email", "value" => "[email protected]"},
{"name" => "name", "value" => "John"},
{"name" => "agent_name", "value" => "Eric Berry"}
],
"stages" => [
"responded",
"interested"
]
}
Structurely Create Conversation Documentation
Structurely::Conversation.create(
muted: false,
settings: Structurely::Entities::ConversationSettings.new(
time_zone: "America/Chicago"
),
slots: [
Structurely::Entities::ConversationSlot.new(
name: "email",
value: "[email protected]"
)
],
messages: [
Structurely::Entities::ConversationItem.new(
response: Structurely::Entities::ConversationMessage.new(
text: "Hello, what is your name?",
received: "2018-12-08T15:20:00.000Z"
),
context: "expect_name",
message: Structurely::Entities::ConversationMessage.new(
text: "John",
received: "2018-12-08T16:34:00.000Z"
)
)
]
)
Sample output:
{
"id" => "5f90958f9db94200311614a2",
"muted" => false,
"settings" => {
"allowedDomains" => [
"real_estate"
],
"dripCampaignEnabled" => false,
"holmesName" => "Aisa",
"leadTypes" => [
"buyer", "seller"
],
"reDripsEnabled" => false,
"timeZone" => "America/Chicago"
},
"slots" => [
{"name" => "email", "value" => "[email protected]"}
],
"stages" => [
"not_responded"
]
}
Structurely List Conversation Webhooks Documentation
Structurely::ConversationWebhook.index
Sample output:
{
"_metadata" => {
"collection" => "conversationWebhooks",
"limit" => 10,
"offset" => 0,
"total" => 0
},
"conversationWebhooks" => []
}
Structurely Create Conversation Webhook Documentation
Structurely::ConversationWebhook.create(
name: "conversations",
target: "https://fp-local.ngrok.io",
triggers: ["conversation:updated", "response:created"]
)
Sample output:
{
"created_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
"id" => "61045ede0566800108895968",
"name" => "conversations",
"secret" => "SECRET",
"target" => "https://fp-local.ngrok.io",
"triggers" => ["conversation:updated", "response:created"],
"updated_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
"version" => "v1"
}
Structurely Get Conversation Webhook Documentation
Structurely::ConversationWebhook.show("61045ede0566800108895968")
Sample output:
{
"created_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
"id" => "61045ede0566800108895968",
"name" => "conversations",
"secret" => "SECRET",
"target" => "https://fp-local.ngrok.io",
"triggers" => ["conversation:updated", "response:created"],
"updated_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
"version" => "v1"
}
Structurely Update Conversation Webhook Documentation
Structurely::ConversationWebhook.update("61045ede0566800108895968", {
name: "my_conversations",
triggers: ["conversation:updated"]
})
Sample output:
{
"created_at" => "Fri, 30 Jul 2021 20:19:42 GMT",
"id" => "61045ede0566800108895968",
"name" => "my_conversations",
"secret" => "ynpKYihXaxBUfc16xHi8Dc7LZL7xYwajlPUnT3kgKCbKy3Ce",
"target" => "https://fp-local.ngrok.io",
"triggers" => ["conversation:updated"],
"updated_at" => "Fri, 30 Jul 2021 20:25:11 GMT",
"version" => "v1"
}
Structurely Delete Conversation Webhook Documentation
Structurely::ConversationWebhook.delete("61045ede0566800108895968")
Sample output:
Dry::Monads::Result::Success(nil)
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
.
Guard provides a nice development experience by automatically running tests for you.
To start, run the following command in your terminal:
bin/guard
Ruby linting and formatting is handled via standard.
bin/lint
bin/format
To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Some resources for using api_structs.
Everyone interacting in the Structurely project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
The gem is available as open source under the terms of the MIT License.