AtEx v0.20.21 AtEx.Gateway.Iot.PublishData View Source

This module allows you to make an HTTP POST to publish messages to your remote devices.

Link to this section Summary

Functions

Process results from calling the gateway

This function makes a POST request to to publish messages to your remote devices through the Africa's talking IOT endpoint The function accepts a map of parameters.

Link to this section Types

Link to this type

option()

View Source
option() ::
  {:method, Tesla.Env.method()}
  | {:url, Tesla.Env.url()}
  | {:query, Tesla.Env.query()}
  | {:headers, Tesla.Env.headers()}
  | {:body, Tesla.Env.body()}
  | {:opts, Tesla.Env.opts()}

Link to this section Functions

Process results from calling the gateway

This function makes a POST request to to publish messages to your remote devices through the Africa's talking IOT endpoint The function accepts a map of parameters.

Parameters

attrs: - a map containing:

  • deviceGroup - The device group to which the message is to be sent
  • topic - The messaging channel to which the message is to be sent. In the form //
  • payload - The message packet to be sent to the subscribed devices.

Example

iex> AtEx.Gateway.Iot.PublishData.publish(%{
...>   deviceGroup: "CrazyCats",
...>   topic: "any-topic",
...>   payload: "take me to your leader"
...> })
{:ok, %{ "status" => true, "description" => "Message processed successfully"}}